diff options
author | 2016-02-19 00:19:39 -0800 | |
---|---|---|
committer | 2016-02-19 00:19:39 -0800 | |
commit | 4c8aed3dbad9fdf749052a79d8f5f608bfb120fe (patch) | |
tree | 69830acec974fb5b30a82b17f335c2aab26a70fb /test/cpp/end2end/end2end_test.cc | |
parent | 17197ddc714d5268a6b1fca678ac8b94ed74f3bd (diff) |
Add a helper to return all the secure types
Diffstat (limited to 'test/cpp/end2end/end2end_test.cc')
-rw-r--r-- | test/cpp/end2end/end2end_test.cc | 51 |
1 files changed, 34 insertions, 17 deletions
diff --git a/test/cpp/end2end/end2end_test.cc b/test/cpp/end2end/end2end_test.cc index df9aae7436..ce8e4d2a10 100644 --- a/test/cpp/end2end/end2end_test.cc +++ b/test/cpp/end2end/end2end_test.cc @@ -1365,25 +1365,42 @@ TEST_P(SecureEnd2endTest, ClientAuthContext) { EXPECT_EQ("*.test.youtube.com", ToString(auth_ctx->GetPeerIdentity()[2])); } -INSTANTIATE_TEST_CASE_P( - End2end, End2endTest, - ::testing::Values(TestScenario(false, kInsecureCredentialsType), - TestScenario(false, kTlsCredentialsType))); - -INSTANTIATE_TEST_CASE_P( - End2endServerTryCancel, End2endServerTryCancelTest, - ::testing::Values(TestScenario(false, kInsecureCredentialsType))); - -INSTANTIATE_TEST_CASE_P( - ProxyEnd2end, ProxyEnd2endTest, - ::testing::Values(TestScenario(false, kInsecureCredentialsType), - TestScenario(false, kTlsCredentialsType), - TestScenario(true, kInsecureCredentialsType), - TestScenario(true, kTlsCredentialsType))); +std::vector<TestScenario> CreateTestScenarios(bool use_proxy, + bool test_insecure, + bool test_secure) { + std::vector<TestScenario> scenarios; + std::vector<grpc::string> credentials_types; + if (test_secure) { + credentials_types = GetSecureCredentialsTypeList(); + } + if (test_insecure) { + credentials_types.push_back(kInsecureCredentialsType); + } + for (auto it = credentials_types.begin(); it != credentials_types.end(); + ++it) { + scenarios.push_back(TestScenario(false, *it)); + if (use_proxy) { + scenarios.push_back(TestScenario(true, *it)); + } + } + return scenarios; +} + +INSTANTIATE_TEST_CASE_P(End2end, End2endTest, + ::testing::ValuesIn(CreateTestScenarios(false, true, + true))); + +INSTANTIATE_TEST_CASE_P(End2endServerTryCancel, End2endServerTryCancelTest, + ::testing::ValuesIn(CreateTestScenarios(false, true, + false))); + +INSTANTIATE_TEST_CASE_P(ProxyEnd2end, ProxyEnd2endTest, + ::testing::ValuesIn(CreateTestScenarios(true, true, + true))); INSTANTIATE_TEST_CASE_P(SecureEnd2end, SecureEnd2endTest, - ::testing::Values(TestScenario(false, - kTlsCredentialsType))); + ::testing::ValuesIn(CreateTestScenarios(false, false, + true))); } // namespace } // namespace testing |