aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/util
diff options
context:
space:
mode:
authorGravatar Yang Gao <yangg@google.com>2015-05-17 21:54:54 -0700
committerGravatar Yang Gao <yangg@google.com>2015-05-17 21:54:54 -0700
commitb57f72dbeeffee0bdb3f39f470f048a23bdb6a08 (patch)
tree68a24792c151d603e2f4d4703843d31e4846e019 /test/cpp/util
parent26a49125588108e18d12d6ed13ba65d7ef565a10 (diff)
resolve comments
Diffstat (limited to 'test/cpp/util')
-rw-r--r--test/cpp/util/fake_credentials.cc31
-rw-r--r--test/cpp/util/fake_credentials.h4
2 files changed, 7 insertions, 28 deletions
diff --git a/test/cpp/util/fake_credentials.cc b/test/cpp/util/fake_credentials.cc
index 6b89e2fc96..f5b83b8159 100644
--- a/test/cpp/util/fake_credentials.cc
+++ b/test/cpp/util/fake_credentials.cc
@@ -36,39 +36,18 @@
#include <grpc++/credentials.h>
#include <grpc++/server_credentials.h>
#include "src/cpp/client/channel.h"
+#include "src/cpp/client/secure_credentials.h"
#include "src/cpp/server/secure_server_credentials.h"
namespace grpc {
namespace testing {
-namespace {
-class FakeCredentialsImpl GRPC_FINAL : public Credentials {
- public:
- FakeCredentialsImpl()
- : c_creds_(grpc_fake_transport_security_credentials_create()) {}
- ~FakeCredentialsImpl() { grpc_credentials_release(c_creds_); }
- SecureCredentials* AsSecureCredentials() GRPC_OVERRIDE { return nullptr; }
- std::shared_ptr<ChannelInterface> CreateChannel(
- const grpc::string& target, const ChannelArguments& args) GRPC_OVERRIDE {
- grpc_channel_args channel_args;
- args.SetChannelArgs(&channel_args);
- return std::shared_ptr<ChannelInterface>(new Channel(
- target,
- grpc_secure_channel_create(c_creds_, target.c_str(), &channel_args)));
- }
- bool ApplyToCall(grpc_call* call) GRPC_OVERRIDE { return false; }
-
- private:
- grpc_credentials* const c_creds_;
-};
-
-} // namespace
-
-std::shared_ptr<Credentials> FakeCredentials() {
- return std::shared_ptr<Credentials>(new FakeCredentialsImpl());
+std::shared_ptr<Credentials> FakeTransportSecurityCredentials() {
+ grpc_credentials* c_creds = grpc_fake_transport_security_credentials_create();
+ return std::shared_ptr<Credentials>(new SecureCredentials(c_creds));
}
-std::shared_ptr<ServerCredentials> FakeServerCredentials() {
+std::shared_ptr<ServerCredentials> FakeTransportSecurityServerCredentials() {
grpc_server_credentials* c_creds =
grpc_fake_transport_security_server_credentials_create();
return std::shared_ptr<ServerCredentials>(
diff --git a/test/cpp/util/fake_credentials.h b/test/cpp/util/fake_credentials.h
index 7e134ceef4..e1ba7bb9e4 100644
--- a/test/cpp/util/fake_credentials.h
+++ b/test/cpp/util/fake_credentials.h
@@ -42,8 +42,8 @@ class ServerCredentials;
namespace testing {
-std::shared_ptr<Credentials> FakeCredentials();
-std::shared_ptr<ServerCredentials> FakeServerCredentials();
+std::shared_ptr<Credentials> FakeTransportSecurityCredentials();
+std::shared_ptr<ServerCredentials> FakeTransportSecurityServerCredentials();
} // namespace testing
} // namespace grpc