Introduced InteropContextInspector to be able to peek into server contexts during interop testing.

pull/2413/head
David Garcia Quintas 10 years ago
parent 4d0b7427fa
commit 8d9f830168
  1. 5
      include/grpc++/server_context.h
  2. 4
      test/cpp/interop/server_helper.cc
  3. 11
      test/cpp/interop/server_helper.h

@ -76,6 +76,10 @@ class CallOpBuffer;
class CompletionQueue; class CompletionQueue;
class Server; class Server;
namespace testing {
class InteropContextInspector;
} // namespace testing
// Interface of server side rpc context. // Interface of server side rpc context.
class ServerContext { class ServerContext {
public: public:
@ -104,6 +108,7 @@ class ServerContext {
} }
private: private:
friend class ::grpc::testing::InteropContextInspector;
friend class ::grpc::Server; friend class ::grpc::Server;
template <class W, class R> template <class W, class R>
friend class ::grpc::ServerAsyncReader; friend class ::grpc::ServerAsyncReader;

@ -58,5 +58,9 @@ std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() {
} }
} }
InteropContextInspector::InteropContextInspector(
const ::grpc::ServerContext& context)
: context_(context) {}
} // namespace testing } // namespace testing
} // namespace grpc } // namespace grpc

@ -36,6 +36,7 @@
#include <memory> #include <memory>
#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h> #include <grpc++/server_credentials.h>
namespace grpc { namespace grpc {
@ -43,6 +44,16 @@ namespace testing {
std::shared_ptr<ServerCredentials> CreateInteropServerCredentials(); std::shared_ptr<ServerCredentials> 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 testing
} // namespace grpc } // namespace grpc

Loading…
Cancel
Save