diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index a2f0a2f990a..5ea52b045d1 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -75,6 +75,10 @@ class CallOpBuffer; class CompletionQueue; class Server; +namespace testing { +class InteropContextInspector; +} // namespace testing + // Interface of server side rpc context. class ServerContext { public: @@ -109,6 +113,7 @@ class ServerContext { void set_compression_algorithm(grpc_compression_algorithm algorithm); private: + friend class ::grpc::testing::InteropContextInspector; friend class ::grpc::Server; template friend class ::grpc::ServerAsyncReader; diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc index c2e750dcf77..0f8b89ced2f 100644 --- a/test/cpp/interop/server_helper.cc +++ b/test/cpp/interop/server_helper.cc @@ -58,5 +58,9 @@ std::shared_ptr CreateInteropServerCredentials() { } } +InteropContextInspector::InteropContextInspector( + const ::grpc::ServerContext& context) + : context_(context) {} + } // namespace testing } // namespace grpc diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h index f98e67bb673..52332bf6336 100644 --- a/test/cpp/interop/server_helper.h +++ b/test/cpp/interop/server_helper.h @@ -36,6 +36,7 @@ #include +#include #include namespace grpc { @@ -43,6 +44,16 @@ namespace testing { std::shared_ptr CreateInteropServerCredentials(); +class InteropContextInspector { + public: + InteropContextInspector (const ::grpc::ServerContext& context); + + // Inspector methods, able to peek inside ServerContext go here. + + private: + const ::grpc::ServerContext& context_; +}; + } // namespace testing } // namespace grpc