diff options
author | yang-g <yangg@google.com> | 2015-07-20 09:39:51 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2015-07-20 09:39:51 -0700 |
commit | ba5f98081a1a55a832ba4577d4af178b882abf7a (patch) | |
tree | 3d33b6a794ff7306295e93b94d319c3e082da045 /test/cpp/interop | |
parent | 8c31ee2751ec973b1b1bdde4bd57ab65a515aaf9 (diff) | |
parent | baf2ab0c30c680aadcdf90e8f202eb321ea692d7 (diff) |
Merge remote-tracking branch 'upstream/master' into per_call_oauth_creds_impl
Diffstat (limited to 'test/cpp/interop')
-rw-r--r-- | test/cpp/interop/interop_client.cc | 12 | ||||
-rw-r--r-- | test/cpp/interop/server_helper.cc | 13 | ||||
-rw-r--r-- | test/cpp/interop/server_helper.h | 13 |
3 files changed, 35 insertions, 3 deletions
diff --git a/test/cpp/interop/interop_client.cc b/test/cpp/interop/interop_client.cc index c77cbce5c4..e5c0e4631f 100644 --- a/test/cpp/interop/interop_client.cc +++ b/test/cpp/interop/interop_client.cc @@ -148,18 +148,24 @@ void InteropClient::DoServiceAccountCreds(const grpc::string& username, void InteropClient::DoOauth2AuthToken(const grpc::string& username, const grpc::string& oauth_scope) { gpr_log(GPR_INFO, - "Sending a large unary rpc with raw oauth2 access token ..."); + "Sending a unary rpc with raw oauth2 access token credentials ..."); SimpleRequest request; SimpleResponse response; request.set_fill_username(true); request.set_fill_oauth_scope(true); - PerformLargeUnary(&request, &response); + std::unique_ptr<TestService::Stub> stub(TestService::NewStub(channel_)); + + ClientContext context; + + Status s = stub->UnaryCall(&context, request, &response); + + AssertOkOrPrintErrorStatus(s); GPR_ASSERT(!response.username().empty()); GPR_ASSERT(!response.oauth_scope().empty()); GPR_ASSERT(username.find(response.username()) != grpc::string::npos); const char* oauth_scope_str = response.oauth_scope().c_str(); GPR_ASSERT(oauth_scope.find(oauth_scope_str) != grpc::string::npos); - gpr_log(GPR_INFO, "Large unary with oauth2 access token done."); + gpr_log(GPR_INFO, "Unary with oauth2 access token credentials done."); } void InteropClient::DoPerRpcCreds(const grpc::string& username, 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 |