aboutsummaryrefslogtreecommitdiffhomepage
path: root/test/cpp/util/test_credentials_provider.h
diff options
context:
space:
mode:
authorGravatar Dan Born <dborn+github@google.com>2016-02-24 18:52:39 -0800
committerGravatar Dan Born <dborn+github@google.com>2016-02-24 18:52:39 -0800
commit1b5a264eb80817a6fc362637a7a0497cbc0611ec (patch)
tree17571fa750412ee6511a63324d82838fa85dbfbd /test/cpp/util/test_credentials_provider.h
parentb0ec2baa1594dd5fc2a1df8b744c8fad423059ec (diff)
Allow new credential types to be added to tests.
Diffstat (limited to 'test/cpp/util/test_credentials_provider.h')
-rw-r--r--test/cpp/util/test_credentials_provider.h19
1 files changed, 10 insertions, 9 deletions
diff --git a/test/cpp/util/test_credentials_provider.h b/test/cpp/util/test_credentials_provider.h
index a6b547cb07..50fadb53a2 100644
--- a/test/cpp/util/test_credentials_provider.h
+++ b/test/cpp/util/test_credentials_provider.h
@@ -46,20 +46,21 @@ namespace testing {
const char kInsecureCredentialsType[] = "INSECURE_CREDENTIALS";
const char kTlsCredentialsType[] = "TLS_CREDENTIALS";
-class CredentialsProvider {
+// Provide test credentials of a particular type.
+class CredentialTypeProvider {
public:
- virtual ~CredentialsProvider() {}
+ virtual ~CredentialTypeProvider() {}
virtual std::shared_ptr<ChannelCredentials> GetChannelCredentials(
- const grpc::string& type, ChannelArguments* args) = 0;
- virtual std::shared_ptr<ServerCredentials> GetServerCredentials(
- const grpc::string& type) = 0;
- virtual std::vector<grpc::string> GetSecureCredentialsTypeList() = 0;
+ ChannelArguments* args) = 0;
+ virtual std::shared_ptr<ServerCredentials> GetServerCredentials() = 0;
};
-// Set the CredentialsProvider used by the other functions in this file. If this
-// is not set, a default provider will be used.
-void SetTestCredentialsProvider(std::unique_ptr<CredentialsProvider> provider);
+// Add a secure type in addition to the defaults above
+// (kInsecureCredentialsType, kTlsCredentialsType) that can be returned from the
+// functions below.
+void AddSecureType(const grpc::string& type,
+ std::unique_ptr<CredentialTypeProvider> type_provider);
// Provide channel credentials according to the given type. Alter the channel
// arguments if needed.