|
|
|
@ -45,7 +45,7 @@ static void test_create(void) { |
|
|
|
|
grpc_arg arg_string; |
|
|
|
|
grpc_arg to_add[2]; |
|
|
|
|
grpc_channel_args *ch_args; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
arg_int.key = "int_arg"; |
|
|
|
|
arg_int.type = GRPC_ARG_INTEGER; |
|
|
|
|
arg_int.value.integer = 123; |
|
|
|
@ -57,7 +57,7 @@ static void test_create(void) { |
|
|
|
|
to_add[0] = arg_int; |
|
|
|
|
to_add[1] = arg_string; |
|
|
|
|
ch_args = grpc_channel_args_copy_and_add(NULL, to_add, 2); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GPR_ASSERT(ch_args->num_args == 2); |
|
|
|
|
GPR_ASSERT(strcmp(ch_args->args[0].key, arg_int.key) == 0); |
|
|
|
|
GPR_ASSERT(ch_args->args[0].type == arg_int.type); |
|
|
|
@ -84,7 +84,7 @@ static void test_set_compression_algorithm(void) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
static void test_compression_algorithm_states(void) { |
|
|
|
|
grpc_channel_args *ch_args; |
|
|
|
|
grpc_channel_args *ch_args, *ch_args_wo_gzip, *ch_args_wo_gzip_deflate; |
|
|
|
|
int states_bitset; |
|
|
|
|
size_t i; |
|
|
|
|
|
|
|
|
@ -97,12 +97,15 @@ static void test_compression_algorithm_states(void) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* disable gzip and deflate */ |
|
|
|
|
ch_args = grpc_channel_args_compression_algorithm_set_state( |
|
|
|
|
ch_args, GRPC_COMPRESS_GZIP, 0); |
|
|
|
|
ch_args = grpc_channel_args_compression_algorithm_set_state( |
|
|
|
|
ch_args, GRPC_COMPRESS_DEFLATE, 0); |
|
|
|
|
|
|
|
|
|
states_bitset = grpc_channel_args_compression_algorithm_get_states(ch_args); |
|
|
|
|
ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state( |
|
|
|
|
&ch_args, GRPC_COMPRESS_GZIP, 0); |
|
|
|
|
GPR_ASSERT(ch_args == ch_args_wo_gzip); |
|
|
|
|
ch_args_wo_gzip_deflate = grpc_channel_args_compression_algorithm_set_state( |
|
|
|
|
&ch_args_wo_gzip, GRPC_COMPRESS_DEFLATE, 0); |
|
|
|
|
GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate); |
|
|
|
|
|
|
|
|
|
states_bitset = grpc_channel_args_compression_algorithm_get_states( |
|
|
|
|
ch_args_wo_gzip_deflate); |
|
|
|
|
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) { |
|
|
|
|
if (i == GRPC_COMPRESS_GZIP || i == GRPC_COMPRESS_DEFLATE) { |
|
|
|
|
GPR_ASSERT(GPR_BITGET(states_bitset, i) == 0); |
|
|
|
@ -112,10 +115,12 @@ static void test_compression_algorithm_states(void) { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/* re-enabled gzip only */ |
|
|
|
|
ch_args = grpc_channel_args_compression_algorithm_set_state( |
|
|
|
|
ch_args, GRPC_COMPRESS_GZIP, 1); |
|
|
|
|
ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state( |
|
|
|
|
&ch_args_wo_gzip_deflate, GRPC_COMPRESS_GZIP, 1); |
|
|
|
|
GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate); |
|
|
|
|
|
|
|
|
|
states_bitset = grpc_channel_args_compression_algorithm_get_states(ch_args); |
|
|
|
|
states_bitset = |
|
|
|
|
grpc_channel_args_compression_algorithm_get_states(ch_args_wo_gzip); |
|
|
|
|
for (i = 0; i < GRPC_COMPRESS_ALGORITHMS_COUNT; i++) { |
|
|
|
|
if (i == GRPC_COMPRESS_DEFLATE) { |
|
|
|
|
GPR_ASSERT(GPR_BITGET(states_bitset, i) == 0); |
|
|
|
|