diff --git a/include/grpc++/server_context.h b/include/grpc++/server_context.h index a4ee986df17..e6440c7fd81 100644 --- a/include/grpc++/server_context.h +++ b/include/grpc++/server_context.h @@ -76,6 +76,10 @@ class CallOpBuffer; class CompletionQueue; class Server; +namespace testing { +class InteropContextInspector; +} // namespace testing + // Interface of server side rpc context. class ServerContext { public: @@ -104,6 +108,7 @@ class ServerContext { } 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