diff options
author | 2015-07-21 16:07:36 -0700 | |
---|---|---|
committer | 2015-07-21 16:07:36 -0700 | |
commit | 80f3995e47ae1ccd30a48c00ef8770cf18e51280 (patch) | |
tree | 8a628a88e43173658d368ebd22a0d5a27ddf3988 /test/cpp/interop/client_helper.cc | |
parent | cead5e83e28b64bcbf91870e36e42c495baae13e (diff) |
wip
Diffstat (limited to 'test/cpp/interop/client_helper.cc')
-rw-r--r-- | test/cpp/interop/client_helper.cc | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/test/cpp/interop/client_helper.cc b/test/cpp/interop/client_helper.cc index 48b1b2e864..9df79bdbb5 100644 --- a/test/cpp/interop/client_helper.cc +++ b/test/cpp/interop/client_helper.cc @@ -48,10 +48,13 @@ #include <grpc++/create_channel.h> #include <grpc++/credentials.h> #include <grpc++/stream.h> -#include "src/cpp/client/secure_credentials.h" + #include "test/core/security/oauth2_utils.h" #include "test/cpp/util/create_test_channel.h" +#include "src/core/surface/call.h" +#include "src/cpp/client/secure_credentials.h" + DECLARE_bool(enable_ssl); DECLARE_bool(use_prod_roots); DECLARE_int32(server_port); @@ -62,6 +65,8 @@ DECLARE_string(default_service_account); DECLARE_string(service_account_key_file); DECLARE_string(oauth_scope); +using grpc::testing::CompressionType; + namespace grpc { namespace testing { @@ -137,5 +142,29 @@ std::shared_ptr<ChannelInterface> CreateChannelForTestCase( } } +CompressionType GetInteropCompressionTypeFromCompressionAlgorithm( + grpc_compression_algorithm algorithm) { + switch (algorithm) { + case GRPC_COMPRESS_NONE: + return CompressionType::NONE; + case GRPC_COMPRESS_GZIP: + return CompressionType::GZIP; + case GRPC_COMPRESS_DEFLATE: + return CompressionType::DEFLATE; + default: + GPR_ASSERT(false); + } +} + +InteropClientContextInspector::InteropClientContextInspector( + const ::grpc::ClientContext& context) + : context_(context) {} + +grpc_compression_algorithm +InteropClientContextInspector::GetCallCompressionAlgorithm() const { + return grpc_call_get_compression_algorithm(context_.call_); +} + + } // namespace testing } // namespace grpc |