From 1b5a264eb80817a6fc362637a7a0497cbc0611ec Mon Sep 17 00:00:00 2001 From: Dan Born Date: Wed, 24 Feb 2016 18:52:39 -0800 Subject: Allow new credential types to be added to tests. --- test/cpp/util/test_credentials_provider.h | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'test/cpp/util/test_credentials_provider.h') 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 GetChannelCredentials( - const grpc::string& type, ChannelArguments* args) = 0; - virtual std::shared_ptr GetServerCredentials( - const grpc::string& type) = 0; - virtual std::vector GetSecureCredentialsTypeList() = 0; + ChannelArguments* args) = 0; + virtual std::shared_ptr 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 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 type_provider); // Provide channel credentials according to the given type. Alter the channel // arguments if needed. -- cgit v1.2.3