aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/interop
diff options
context:
space:
mode:
authorGravatar David Garcia Quintas <dgq@google.com>2015-07-23 04:58:20 -0700
committerGravatar David Garcia Quintas <dgq@google.com>2015-07-23 04:58:20 -0700
commit7c0d914cce379f14a1adfae9374641967c45d7b2 (patch)
tree5357b9b9b4d376ad6f165cbb47777823240bc59b /test/cpp/interop
parent607dd2eeb7edb055c3cda8c2206d5cfc99ef8190 (diff)
wip for accept-encoding into tests
Diffstat (limited to 'test/cpp/interop')
-rw-r--r--test/cpp/interop/server.cc6
-rw-r--r--test/cpp/interop/server_helper.cc8
-rw-r--r--test/cpp/interop/server_helper.h1
3 files changed, 13 insertions, 2 deletions
diff --git a/test/cpp/interop/server.cc b/test/cpp/interop/server.cc
index 32c60aff44..6c429b3393 100644
--- a/test/cpp/interop/server.cc
+++ b/test/cpp/interop/server.cc
@@ -42,6 +42,7 @@
#include <gflags/gflags.h>
#include <grpc/grpc.h>
#include <grpc/support/log.h>
+#include <grpc/support/useful.h>
#include <grpc++/config.h>
#include <grpc++/server.h>
#include <grpc++/server_builder.h>
@@ -67,6 +68,7 @@ using grpc::ServerReader;
using grpc::ServerReaderWriter;
using grpc::ServerWriter;
using grpc::SslServerCredentialsOptions;
+using grpc::testing::InteropServerContextInspector;
using grpc::testing::Payload;
using grpc::testing::PayloadType;
using grpc::testing::SimpleRequest;
@@ -138,6 +140,7 @@ class TestServiceImpl : public TestService::Service {
Status UnaryCall(ServerContext* context, const SimpleRequest* request,
SimpleResponse* response) {
+ InteropServerContextInspector inspector(*context);
SetResponseCompression(context, *request);
if (request->has_response_size() && request->response_size() > 0) {
if (!SetPayload(request->response_type(), request->response_size(),
@@ -145,6 +148,9 @@ class TestServiceImpl : public TestService::Service {
return Status(grpc::StatusCode::INTERNAL, "Error creating payload.");
}
}
+ const gpr_uint32 client_accept_encodings_bitset =
+ inspector.GetEncodingsAcceptedByClient();
+ gpr_log(GPR_INFO, "%d", GPR_BITCOUNT(client_accept_encodings_bitset));
return Status::OK;
}
diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc
index 8cfed2acb5..3721d79635 100644
--- a/test/cpp/interop/server_helper.cc
+++ b/test/cpp/interop/server_helper.cc
@@ -69,8 +69,12 @@ InteropServerContextInspector::GetCallCompressionAlgorithm() const {
return grpc_call_get_compression_algorithm(context_.call_);
}
-std::shared_ptr<const AuthContext> InteropServerContextInspector::GetAuthContext()
- const {
+gpr_uint32 InteropServerContextInspector::GetEncodingsAcceptedByClient() const {
+ return grpc_call_get_encodings_accepted_by_peer(context_.call_);
+}
+
+std::shared_ptr<const AuthContext>
+InteropServerContextInspector::GetAuthContext() const {
return context_.auth_context();
}
diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h
index a57ef0b3c5..7b6b12cd4d 100644
--- a/test/cpp/interop/server_helper.h
+++ b/test/cpp/interop/server_helper.h
@@ -53,6 +53,7 @@ class InteropServerContextInspector {
std::shared_ptr<const AuthContext> GetAuthContext() const;
bool IsCancelled() const;
grpc_compression_algorithm GetCallCompressionAlgorithm() const;
+ gpr_uint32 GetEncodingsAcceptedByClient() const;
private:
const ::grpc::ServerContext& context_;