aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/util/create_test_channel.cc
diff options
context:
space:
mode:
authorGravatar yang-g <yangg@google.com>2016-11-23 10:55:03 -0800
committerGravatar yang-g <yangg@google.com>2016-11-23 10:55:03 -0800
commita7ef49bf6a4392afaf0d4db9922ae703092b6e55 (patch)
tree2f2528d04ab660b31a3a2859a8a8b21c141be894 /test/cpp/util/create_test_channel.cc
parent71b275bc10558107cd41448a8c8ce96d1d1dd79c (diff)
Support custom credential type in interop
Diffstat (limited to 'test/cpp/util/create_test_channel.cc')
-rw-r--r--test/cpp/util/create_test_channel.cc14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/cpp/util/create_test_channel.cc b/test/cpp/util/create_test_channel.cc
index 4512193fdd..ad62e03490 100644
--- a/test/cpp/util/create_test_channel.cc
+++ b/test/cpp/util/create_test_channel.cc
@@ -135,4 +135,18 @@ std::shared_ptr<Channel> CreateTestChannel(const grpc::string& server,
return CreateTestChannel(server, "foo.test.google.fr", enable_ssl, false);
}
+std::shared_ptr<Channel> CreateTestChannel(
+ const grpc::string& server, const grpc::string& credential_type,
+ const std::shared_ptr<CallCredentials>& creds) {
+ ChannelArguments channel_args;
+ std::shared_ptr<ChannelCredentials> channel_creds =
+ testing::GetCredentialsProvider()->GetChannelCredentials(credential_type,
+ &channel_args);
+ GPR_ASSERT(channel_creds != nullptr);
+ if (creds.get()) {
+ channel_creds = CompositeChannelCredentials(channel_creds, creds);
+ }
+ return CreateCustomChannel(server, channel_creds, channel_args);
+}
+
} // namespace grpc