aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/core/transport
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2016-12-27 16:03:43 -0800
committerGravatar Craig Tiller <ctiller@google.com>2016-12-27 16:03:43 -0800
commiteb30c809cf9d72fd5572c58cefa384c24c0ef14a (patch)
tree8051f32b2cd90cda4234266de4f32af93ed521f4 /test/core/transport
parenta7e70de752c2c0d02e7ee7405451f9424b79d43b (diff)
parent5aca1dde32c4d8c278c00aa6662f01a9a6c49517 (diff)
Merge branch 'flow_control_v2' into bwest
Diffstat (limited to 'test/core/transport')
-rw-r--r--test/core/transport/chttp2/alpn_test.c19
-rw-r--r--test/core/transport/chttp2/bin_decoder_test.c45
-rw-r--r--test/core/transport/chttp2/bin_encoder_test.c59
-rw-r--r--test/core/transport/chttp2/hpack_encoder_test.c27
-rw-r--r--test/core/transport/chttp2/hpack_parser_test.c18
-rw-r--r--test/core/transport/chttp2/hpack_table_test.c2
-rw-r--r--test/core/transport/chttp2/varint_test.c17
-rw-r--r--test/core/transport/metadata_test.c40
8 files changed, 125 insertions, 102 deletions
diff --git a/test/core/transport/chttp2/alpn_test.c b/test/core/transport/chttp2/alpn_test.c
index 48064ec9b3..cde891cd5d 100644
--- a/test/core/transport/chttp2/alpn_test.c
+++ b/test/core/transport/chttp2/alpn_test.c
@@ -38,6 +38,7 @@
static void test_alpn_success(void) {
GPR_ASSERT(grpc_chttp2_is_alpn_version_supported("h2", 2));
+ GPR_ASSERT(grpc_chttp2_is_alpn_version_supported("grpc-exp", 8));
}
static void test_alpn_failure(void) {
@@ -45,9 +46,27 @@ static void test_alpn_failure(void) {
GPR_ASSERT(!grpc_chttp2_is_alpn_version_supported("h1-15", 5));
}
+// First index in ALPN supported version list of a given protocol. Returns a
+// value one beyond the last valid element index if not found.
+static size_t alpn_version_index(const char *version, size_t size) {
+ size_t i;
+ for (i = 0; i < grpc_chttp2_num_alpn_versions(); ++i) {
+ if (!strncmp(version, grpc_chttp2_get_alpn_version_index(i), size)) {
+ return i;
+ }
+ }
+ return i;
+}
+
+static void test_alpn_grpc_before_h2(void) {
+ // grpc-exp is preferred over h2.
+ GPR_ASSERT(alpn_version_index("grpc-exp", 8) < alpn_version_index("h2", 2));
+}
+
int main(int argc, char **argv) {
grpc_test_init(argc, argv);
test_alpn_success();
test_alpn_failure();
+ test_alpn_grpc_before_h2();
return 0;
}
diff --git a/test/core/transport/chttp2/bin_decoder_test.c b/test/core/transport/chttp2/bin_decoder_test.c
index c4e6cd332f..7ddc30291a 100644
--- a/test/core/transport/chttp2/bin_decoder_test.c
+++ b/test/core/transport/chttp2/bin_decoder_test.c
@@ -38,50 +38,51 @@
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
#include "src/core/ext/transport/chttp2/transport/bin_encoder.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
static int all_ok = 1;
-static void expect_slice_eq(gpr_slice expected, gpr_slice slice, char *debug,
+static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug,
int line) {
- if (0 != gpr_slice_cmp(slice, expected)) {
- char *hs = gpr_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *he = gpr_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ if (0 != grpc_slice_cmp(slice, expected)) {
+ char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs,
he);
gpr_free(hs);
gpr_free(he);
all_ok = 0;
}
- gpr_slice_unref(expected);
- gpr_slice_unref(slice);
+ grpc_slice_unref(expected);
+ grpc_slice_unref(slice);
}
-static gpr_slice base64_encode(const char *s) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_base64_encode(ss);
- gpr_slice_unref(ss);
+static grpc_slice base64_encode(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_encode(ss);
+ grpc_slice_unref(ss);
return out;
}
-static gpr_slice base64_decode(const char *s) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_base64_decode(ss);
- gpr_slice_unref(ss);
+static grpc_slice base64_decode(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_decode(ss);
+ grpc_slice_unref(ss);
return out;
}
-static gpr_slice base64_decode_with_length(const char *s,
- size_t output_length) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_base64_decode_with_length(ss, output_length);
- gpr_slice_unref(ss);
+static grpc_slice base64_decode_with_length(const char *s,
+ size_t output_length) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_decode_with_length(ss, output_length);
+ grpc_slice_unref(ss);
return out;
}
-#define EXPECT_SLICE_EQ(expected, slice) \
- expect_slice_eq( \
- gpr_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
+#define EXPECT_SLICE_EQ(expected, slice) \
+ expect_slice_eq( \
+ grpc_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
#slice, __LINE__);
#define ENCODE_AND_DECODE(s) \
diff --git a/test/core/transport/chttp2/bin_encoder_test.c b/test/core/transport/chttp2/bin_encoder_test.c
index 08d10735a5..53b55a301e 100644
--- a/test/core/transport/chttp2/bin_encoder_test.c
+++ b/test/core/transport/chttp2/bin_encoder_test.c
@@ -41,53 +41,54 @@
#include <grpc/grpc.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
static int all_ok = 1;
-static void expect_slice_eq(gpr_slice expected, gpr_slice slice, char *debug,
+static void expect_slice_eq(grpc_slice expected, grpc_slice slice, char *debug,
int line) {
- if (0 != gpr_slice_cmp(slice, expected)) {
- char *hs = gpr_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *he = gpr_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ if (0 != grpc_slice_cmp(slice, expected)) {
+ char *hs = grpc_dump_slice(slice, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *he = grpc_dump_slice(expected, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "FAILED:%d: %s\ngot: %s\nwant: %s", line, debug, hs,
he);
gpr_free(hs);
gpr_free(he);
all_ok = 0;
}
- gpr_slice_unref(expected);
- gpr_slice_unref(slice);
+ grpc_slice_unref(expected);
+ grpc_slice_unref(slice);
}
-static gpr_slice B64(const char *s) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_base64_encode(ss);
- gpr_slice_unref(ss);
+static grpc_slice B64(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_base64_encode(ss);
+ grpc_slice_unref(ss);
return out;
}
-static gpr_slice HUFF(const char *s) {
- gpr_slice ss = gpr_slice_from_copied_string(s);
- gpr_slice out = grpc_chttp2_huffman_compress(ss);
- gpr_slice_unref(ss);
+static grpc_slice HUFF(const char *s) {
+ grpc_slice ss = grpc_slice_from_copied_string(s);
+ grpc_slice out = grpc_chttp2_huffman_compress(ss);
+ grpc_slice_unref(ss);
return out;
}
-#define EXPECT_SLICE_EQ(expected, slice) \
- expect_slice_eq( \
- gpr_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
+#define EXPECT_SLICE_EQ(expected, slice) \
+ expect_slice_eq( \
+ grpc_slice_from_copied_buffer(expected, sizeof(expected) - 1), slice, \
#slice, __LINE__);
static void expect_combined_equiv(const char *s, size_t len, int line) {
- gpr_slice input = gpr_slice_from_copied_buffer(s, len);
- gpr_slice base64 = grpc_chttp2_base64_encode(input);
- gpr_slice expect = grpc_chttp2_huffman_compress(base64);
- gpr_slice got = grpc_chttp2_base64_encode_and_huffman_compress_impl(input);
- if (0 != gpr_slice_cmp(expect, got)) {
- char *t = gpr_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *e = gpr_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *g = gpr_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ grpc_slice input = grpc_slice_from_copied_buffer(s, len);
+ grpc_slice base64 = grpc_chttp2_base64_encode(input);
+ grpc_slice expect = grpc_chttp2_huffman_compress(base64);
+ grpc_slice got = grpc_chttp2_base64_encode_and_huffman_compress_impl(input);
+ if (0 != grpc_slice_cmp(expect, got)) {
+ char *t = grpc_dump_slice(input, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *e = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *g = grpc_dump_slice(got, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "FAILED:%d:\ntest: %s\ngot: %s\nwant: %s", line, t, g,
e);
gpr_free(t);
@@ -95,10 +96,10 @@ static void expect_combined_equiv(const char *s, size_t len, int line) {
gpr_free(g);
all_ok = 0;
}
- gpr_slice_unref(input);
- gpr_slice_unref(base64);
- gpr_slice_unref(expect);
- gpr_slice_unref(got);
+ grpc_slice_unref(input);
+ grpc_slice_unref(base64);
+ grpc_slice_unref(expect);
+ grpc_slice_unref(got);
}
#define EXPECT_COMBINED_EQUIV(x) \
diff --git a/test/core/transport/chttp2/hpack_encoder_test.c b/test/core/transport/chttp2/hpack_encoder_test.c
index 1c1c74879b..91421e18f4 100644
--- a/test/core/transport/chttp2/hpack_encoder_test.c
+++ b/test/core/transport/chttp2/hpack_encoder_test.c
@@ -41,6 +41,7 @@
#include <grpc/support/string_util.h>
#include "src/core/ext/transport/chttp2/transport/hpack_parser.h"
+#include "src/core/lib/slice/slice_string_helpers.h"
#include "src/core/lib/support/string.h"
#include "src/core/lib/transport/metadata.h"
#include "test/core/util/parse_hexstring.h"
@@ -60,9 +61,9 @@ size_t cap_to_delete = 0;
hexstring passed in */
static void verify(size_t window_available, int eof, size_t expect_window_used,
const char *expected, size_t nheaders, ...) {
- gpr_slice_buffer output;
- gpr_slice merged;
- gpr_slice expect = parse_hexstring(expected);
+ grpc_slice_buffer output;
+ grpc_slice merged;
+ grpc_slice expect = parse_hexstring(expected);
size_t i;
va_list l;
grpc_linked_mdelem *e = gpr_malloc(sizeof(*e) * nheaders);
@@ -93,19 +94,19 @@ static void verify(size_t window_available, int eof, size_t expect_window_used,
}
to_delete[num_to_delete++] = e;
- gpr_slice_buffer_init(&output);
+ grpc_slice_buffer_init(&output);
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, eof, 16384, &stats,
&output);
merged = grpc_slice_merge(output.slices, output.count);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&output);
grpc_metadata_batch_destroy(&b);
- if (0 != gpr_slice_cmp(merged, expect)) {
- char *expect_str = gpr_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
- char *got_str = gpr_dump_slice(merged, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ if (0 != grpc_slice_cmp(merged, expect)) {
+ char *expect_str = grpc_dump_slice(expect, GPR_DUMP_HEX | GPR_DUMP_ASCII);
+ char *got_str = grpc_dump_slice(merged, GPR_DUMP_HEX | GPR_DUMP_ASCII);
gpr_log(GPR_ERROR, "mismatched output for %s", expected);
gpr_log(GPR_ERROR, "EXPECT: %s", expect_str);
gpr_log(GPR_ERROR, "GOT: %s", got_str);
@@ -114,8 +115,8 @@ static void verify(size_t window_available, int eof, size_t expect_window_used,
g_failure = 1;
}
- gpr_slice_unref(merged);
- gpr_slice_unref(expect);
+ grpc_slice_unref(merged);
+ grpc_slice_unref(expect);
}
static void test_basic_headers(void) {
@@ -186,7 +187,7 @@ static void test_decode_table_overflow(void) {
static void verify_table_size_change_match_elem_size(const char *key,
const char *value) {
- gpr_slice_buffer output;
+ grpc_slice_buffer output;
grpc_mdelem *elem = grpc_mdelem_from_strings(key, value);
size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem);
size_t initial_table_size = g_compressor.table_size;
@@ -198,13 +199,13 @@ static void verify_table_size_change_match_elem_size(const char *key,
e[0].next = NULL;
b.list.head = &e[0];
b.list.tail = &e[0];
- gpr_slice_buffer_init(&output);
+ grpc_slice_buffer_init(&output);
grpc_transport_one_way_stats stats;
memset(&stats, 0, sizeof(stats));
grpc_chttp2_encode_header(&g_compressor, 0xdeadbeef, &b, 0, 16384, &stats,
&output);
- gpr_slice_buffer_destroy(&output);
+ grpc_slice_buffer_destroy(&output);
grpc_metadata_batch_destroy(&b);
GPR_ASSERT(g_compressor.table_size == elem_size + initial_table_size);
diff --git a/test/core/transport/chttp2/hpack_parser_test.c b/test/core/transport/chttp2/hpack_parser_test.c
index 55b64f5d99..e2813df70c 100644
--- a/test/core/transport/chttp2/hpack_parser_test.c
+++ b/test/core/transport/chttp2/hpack_parser_test.c
@@ -36,9 +36,9 @@
#include <stdarg.h>
#include <grpc/grpc.h>
+#include <grpc/slice.h>
#include <grpc/support/alloc.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include "test/core/util/parse_hexstring.h"
#include "test/core/util/slice_splitter.h"
#include "test/core/util/test_config.h"
@@ -52,16 +52,16 @@ static void onhdr(grpc_exec_ctx *exec_ctx, void *ud, grpc_mdelem *md) {
GPR_ASSERT(ekey);
evalue = va_arg(chk->args, char *);
GPR_ASSERT(evalue);
- GPR_ASSERT(gpr_slice_str_cmp(md->key->slice, ekey) == 0);
- GPR_ASSERT(gpr_slice_str_cmp(md->value->slice, evalue) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md->key->slice, ekey) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(md->value->slice, evalue) == 0);
GRPC_MDELEM_UNREF(md);
}
static void test_vector(grpc_chttp2_hpack_parser *parser,
grpc_slice_split_mode mode, const char *hexstring,
... /* char *key, char *value */) {
- gpr_slice input = parse_hexstring(hexstring);
- gpr_slice *slices;
+ grpc_slice input = parse_hexstring(hexstring);
+ grpc_slice *slices;
size_t nslices;
size_t i;
test_checker chk;
@@ -72,18 +72,18 @@ static void test_vector(grpc_chttp2_hpack_parser *parser,
parser->on_header_user_data = &chk;
grpc_split_slices(mode, &input, 1, &slices, &nslices);
- gpr_slice_unref(input);
+ grpc_slice_unref(input);
for (i = 0; i < nslices; i++) {
grpc_exec_ctx exec_ctx = GRPC_EXEC_CTX_INIT;
GPR_ASSERT(grpc_chttp2_hpack_parser_parse(
- &exec_ctx, parser, GPR_SLICE_START_PTR(slices[i]),
- GPR_SLICE_END_PTR(slices[i])) == GRPC_ERROR_NONE);
+ &exec_ctx, parser, GRPC_SLICE_START_PTR(slices[i]),
+ GRPC_SLICE_END_PTR(slices[i])) == GRPC_ERROR_NONE);
grpc_exec_ctx_finish(&exec_ctx);
}
for (i = 0; i < nslices; i++) {
- gpr_slice_unref(slices[i]);
+ grpc_slice_unref(slices[i]);
}
gpr_free(slices);
diff --git a/test/core/transport/chttp2/hpack_table_test.c b/test/core/transport/chttp2/hpack_table_test.c
index 75b0ef4629..1a7e2442ca 100644
--- a/test/core/transport/chttp2/hpack_table_test.c
+++ b/test/core/transport/chttp2/hpack_table_test.c
@@ -48,7 +48,7 @@
static void assert_str(const grpc_chttp2_hptbl *tbl, grpc_mdstr *mdstr,
const char *str) {
- GPR_ASSERT(gpr_slice_str_cmp(mdstr->slice, str) == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(mdstr->slice, str) == 0);
}
static void assert_index(const grpc_chttp2_hptbl *tbl, uint32_t idx,
diff --git a/test/core/transport/chttp2/varint_test.c b/test/core/transport/chttp2/varint_test.c
index 3552bf0c59..e29be4b056 100644
--- a/test/core/transport/chttp2/varint_test.c
+++ b/test/core/transport/chttp2/varint_test.c
@@ -33,24 +33,25 @@
#include "src/core/ext/transport/chttp2/transport/varint.h"
+#include <grpc/slice.h>
#include <grpc/support/log.h>
-#include <grpc/support/slice.h>
#include "test/core/util/test_config.h"
static void test_varint(uint32_t value, uint32_t prefix_bits, uint8_t prefix_or,
const char *expect_bytes, size_t expect_length) {
uint32_t nbytes = GRPC_CHTTP2_VARINT_LENGTH(value, prefix_bits);
- gpr_slice expect = gpr_slice_from_copied_buffer(expect_bytes, expect_length);
- gpr_slice slice;
+ grpc_slice expect =
+ grpc_slice_from_copied_buffer(expect_bytes, expect_length);
+ grpc_slice slice;
gpr_log(GPR_DEBUG, "Test: 0x%08x", value);
GPR_ASSERT(nbytes == expect_length);
- slice = gpr_slice_malloc(nbytes);
+ slice = grpc_slice_malloc(nbytes);
GRPC_CHTTP2_WRITE_VARINT(value, prefix_bits, prefix_or,
- GPR_SLICE_START_PTR(slice), nbytes);
- GPR_ASSERT(gpr_slice_cmp(expect, slice) == 0);
- gpr_slice_unref(expect);
- gpr_slice_unref(slice);
+ GRPC_SLICE_START_PTR(slice), nbytes);
+ GPR_ASSERT(grpc_slice_cmp(expect, slice) == 0);
+ grpc_slice_unref(expect);
+ grpc_slice_unref(slice);
}
#define TEST_VARINT(value, prefix_bits, prefix_or, expect) \
diff --git a/test/core/transport/metadata_test.c b/test/core/transport/metadata_test.c
index 007892930c..5c89d8530a 100644
--- a/test/core/transport/metadata_test.c
+++ b/test/core/transport/metadata_test.c
@@ -68,8 +68,8 @@ static void test_create_string(void) {
s3 = grpc_mdstr_from_string("very much not hello");
GPR_ASSERT(s1 == s2);
GPR_ASSERT(s3 != s1);
- GPR_ASSERT(gpr_slice_str_cmp(s1->slice, "hello") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(s3->slice, "very much not hello") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(s1->slice, "hello") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(s3->slice, "very much not hello") == 0);
GRPC_MDSTR_UNREF(s1);
GRPC_MDSTR_UNREF(s2);
GRPC_MDSTR_UNREF(s3);
@@ -89,9 +89,9 @@ static void test_create_metadata(void) {
GPR_ASSERT(m3 != m1);
GPR_ASSERT(m3->key == m1->key);
GPR_ASSERT(m3->value != m1->value);
- GPR_ASSERT(gpr_slice_str_cmp(m1->key->slice, "a") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(m1->value->slice, "b") == 0);
- GPR_ASSERT(gpr_slice_str_cmp(m3->value->slice, "c") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(m1->key->slice, "a") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(m1->value->slice, "b") == 0);
+ GPR_ASSERT(grpc_slice_str_cmp(m3->value->slice, "c") == 0);
GRPC_MDELEM_UNREF(m1);
GRPC_MDELEM_UNREF(m2);
GRPC_MDELEM_UNREF(m3);
@@ -205,7 +205,7 @@ static void test_things_stick_around(void) {
static void test_slices_work(void) {
/* ensure no memory leaks when switching representation from mdstr to slice */
grpc_mdstr *str;
- gpr_slice slice;
+ grpc_slice slice;
LOG_TEST("test_slices_work");
@@ -213,14 +213,14 @@ static void test_slices_work(void) {
str = grpc_mdstr_from_string(
"123456789012345678901234567890123456789012345678901234567890");
- slice = gpr_slice_ref(str->slice);
+ slice = grpc_slice_ref(str->slice);
GRPC_MDSTR_UNREF(str);
- gpr_slice_unref(slice);
+ grpc_slice_unref(slice);
str = grpc_mdstr_from_string(
"123456789012345678901234567890123456789012345678901234567890");
- slice = gpr_slice_ref(str->slice);
- gpr_slice_unref(slice);
+ slice = grpc_slice_ref(str->slice);
+ grpc_slice_unref(slice);
GRPC_MDSTR_UNREF(str);
grpc_shutdown();
@@ -228,8 +228,8 @@ static void test_slices_work(void) {
static void test_base64_and_huffman_works(void) {
grpc_mdstr *str;
- gpr_slice slice1;
- gpr_slice slice2;
+ grpc_slice slice1;
+ grpc_slice slice2;
LOG_TEST("test_base64_and_huffman_works");
@@ -237,9 +237,9 @@ static void test_base64_and_huffman_works(void) {
str = grpc_mdstr_from_string("abcdefg");
slice1 = grpc_mdstr_as_base64_encoded_and_huffman_compressed(str);
slice2 = grpc_chttp2_base64_encode_and_huffman_compress(str->slice);
- GPR_ASSERT(0 == gpr_slice_cmp(slice1, slice2));
+ GPR_ASSERT(0 == grpc_slice_cmp(slice1, slice2));
- gpr_slice_unref(slice2);
+ grpc_slice_unref(slice2);
GRPC_MDSTR_UNREF(str);
grpc_shutdown();
}
@@ -276,13 +276,13 @@ static void verify_binary_header_size(const char *key, const uint8_t *value,
grpc_mdelem *elem = grpc_mdelem_from_string_and_buffer(key, value, value_len);
GPR_ASSERT(grpc_is_binary_header(key, strlen(key)));
size_t elem_size = grpc_mdelem_get_size_in_hpack_table(elem);
- gpr_slice value_slice =
- gpr_slice_from_copied_buffer((const char *)value, value_len);
- gpr_slice base64_encoded = grpc_chttp2_base64_encode(value_slice);
- size_t expected_size = 32 + strlen(key) + GPR_SLICE_LENGTH(base64_encoded);
+ grpc_slice value_slice =
+ grpc_slice_from_copied_buffer((const char *)value, value_len);
+ grpc_slice base64_encoded = grpc_chttp2_base64_encode(value_slice);
+ size_t expected_size = 32 + strlen(key) + GRPC_SLICE_LENGTH(base64_encoded);
GPR_ASSERT(expected_size == elem_size);
- gpr_slice_unref(value_slice);
- gpr_slice_unref(base64_encoded);
+ grpc_slice_unref(value_slice);
+ grpc_slice_unref(base64_encoded);
GRPC_MDELEM_UNREF(elem);
}