aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/interop
diff options
context:
space:
mode:
authorGravatar Craig Tiller <ctiller@google.com>2015-07-17 11:30:57 -0700
committerGravatar Craig Tiller <ctiller@google.com>2015-07-17 11:30:57 -0700
commiteec373c555174163c270163cff713c4a0a73b670 (patch)
treeb25304825c34b5f269ee2cf9509a03f4efe98a0b /test/cpp/interop
parent1eedf268e68c10f9b11270810ef3963fb3b6892c (diff)
parent6dd49a5c8f64369ebc269fdc41a97c4a27f160f5 (diff)
Merge pull request #2413 from dgquintas/interop_sniffer
Introduced InteropContextInspector
Diffstat (limited to 'test/cpp/interop')
-rw-r--r--test/cpp/interop/server_helper.cc13
-rw-r--r--test/cpp/interop/server_helper.h13
2 files changed, 26 insertions, 0 deletions
diff --git a/test/cpp/interop/server_helper.cc b/test/cpp/interop/server_helper.cc
index c2e750dcf7..30a78ffddf 100644
--- a/test/cpp/interop/server_helper.cc
+++ b/test/cpp/interop/server_helper.cc
@@ -58,5 +58,18 @@ std::shared_ptr<ServerCredentials> CreateInteropServerCredentials() {
}
}
+InteropContextInspector::InteropContextInspector(
+ const ::grpc::ServerContext& context)
+ : context_(context) {}
+
+std::shared_ptr<const AuthContext> InteropContextInspector::GetAuthContext()
+ const {
+ return context_.auth_context();
+}
+
+bool InteropContextInspector::IsCancelled() const {
+ return context_.IsCancelled();
+}
+
} // namespace testing
} // namespace grpc
diff --git a/test/cpp/interop/server_helper.h b/test/cpp/interop/server_helper.h
index f98e67bb67..ce977b4705 100644
--- a/test/cpp/interop/server_helper.h
+++ b/test/cpp/interop/server_helper.h
@@ -36,6 +36,7 @@
#include <memory>
+#include <grpc++/server_context.h>
#include <grpc++/server_credentials.h>
namespace grpc {
@@ -43,6 +44,18 @@ namespace testing {
std::shared_ptr<ServerCredentials> CreateInteropServerCredentials();
+class InteropContextInspector {
+ public:
+ InteropContextInspector(const ::grpc::ServerContext& context);
+
+ // Inspector methods, able to peek inside ServerContext, follow.
+ std::shared_ptr<const AuthContext> GetAuthContext() const;
+ bool IsCancelled() const;
+
+ private:
+ const ::grpc::ServerContext& context_;
+};
+
} // namespace testing
} // namespace grpc