diff options
Diffstat (limited to 'test/core/channel/channel_args_test.cc')
-rw-r--r-- | test/core/channel/channel_args_test.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/test/core/channel/channel_args_test.cc b/test/core/channel/channel_args_test.cc index 4a8195e984..5b0a770c84 100644 --- a/test/core/channel/channel_args_test.cc +++ b/test/core/channel/channel_args_test.cc @@ -62,8 +62,8 @@ static void test_set_compression_algorithm(void) { grpc_core::ExecCtx exec_ctx; grpc_channel_args* ch_args; - ch_args = - grpc_channel_args_set_compression_algorithm(nullptr, GRPC_COMPRESS_GZIP); + ch_args = grpc_channel_args_set_compression_algorithm( + nullptr, GRPC_COMPRESS_MESSAGE_GZIP); GPR_ASSERT(ch_args->num_args == 1); GPR_ASSERT(strcmp(ch_args->args[0].key, GRPC_COMPRESSION_CHANNEL_DEFAULT_ALGORITHM) == 0); @@ -74,7 +74,8 @@ static void test_set_compression_algorithm(void) { static void test_compression_algorithm_states(void) { grpc_core::ExecCtx exec_ctx; - grpc_channel_args *ch_args, *ch_args_wo_gzip, *ch_args_wo_gzip_deflate; + grpc_channel_args *ch_args, *ch_args_wo_gzip, *ch_args_wo_gzip_deflate, + *ch_args_wo_gzip_deflate_gzip; unsigned states_bitset; size_t i; @@ -87,33 +88,40 @@ static void test_compression_algorithm_states(void) { GPR_ASSERT(GPR_BITGET(states_bitset, i)); } - /* disable gzip and deflate */ + /* disable message/gzip and message/deflate and stream/gzip */ ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state( - &ch_args, GRPC_COMPRESS_GZIP, 0); + &ch_args, GRPC_COMPRESS_MESSAGE_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); + &ch_args_wo_gzip, GRPC_COMPRESS_MESSAGE_DEFLATE, 0); GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate); + ch_args_wo_gzip_deflate_gzip = + grpc_channel_args_compression_algorithm_set_state( + &ch_args_wo_gzip_deflate, GRPC_COMPRESS_STREAM_GZIP, 0); + GPR_ASSERT(ch_args_wo_gzip_deflate == ch_args_wo_gzip_deflate_gzip); states_bitset = (unsigned)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) { + if (i == GRPC_COMPRESS_MESSAGE_GZIP || i == GRPC_COMPRESS_MESSAGE_DEFLATE || + i == GRPC_COMPRESS_STREAM_GZIP) { GPR_ASSERT(GPR_BITGET(states_bitset, i) == 0); } else { GPR_ASSERT(GPR_BITGET(states_bitset, i) != 0); } } - /* re-enabled gzip only */ + /* re-enabled message/gzip and stream/gzip only */ 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); + &ch_args_wo_gzip_deflate_gzip, GRPC_COMPRESS_MESSAGE_GZIP, 1); + ch_args_wo_gzip = grpc_channel_args_compression_algorithm_set_state( + &ch_args_wo_gzip, GRPC_COMPRESS_STREAM_GZIP, 1); + GPR_ASSERT(ch_args_wo_gzip == ch_args_wo_gzip_deflate_gzip); states_bitset = (unsigned)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) { + if (i == GRPC_COMPRESS_MESSAGE_DEFLATE) { GPR_ASSERT(GPR_BITGET(states_bitset, i) == 0); } else { GPR_ASSERT(GPR_BITGET(states_bitset, i) != 0); |