Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: net/http/transport_security_state_unittest.cc

Issue 2155753002: Enable Expect-Staple in SSLClientSocket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@ocsp-reporting
Patch Set: Enable by default Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: net/http/transport_security_state_unittest.cc
diff --git a/net/http/transport_security_state_unittest.cc b/net/http/transport_security_state_unittest.cc
index f0a49814cb353ea022ecc1eee12c676a034d43a5..c1f99a9fe645b96b788a504d905f528975f29fc7 100644
--- a/net/http/transport_security_state_unittest.cc
+++ b/net/http/transport_security_state_unittest.cc
@@ -364,8 +364,9 @@ class TransportSecurityStateTest : public testing::Test {
state->enable_static_expect_ct_ = true;
}
- static void EnableStaticExpectStaple(TransportSecurityState* state) {
- state->enable_static_expect_staple_ = true;
+ static void SetEnableStaticExpectStaple(TransportSecurityState* state,
+ bool enabled) {
+ state->enable_static_expect_staple_ = enabled;
}
static HashValueVector GetSampleSPKIHashes() {
@@ -1841,9 +1842,10 @@ TEST_F(TransportSecurityStateTest, PreloadedExpectCT) {
TEST_F(TransportSecurityStateTest, PreloadedExpectStaple) {
TransportSecurityState state;
TransportSecurityState::ExpectStapleState expect_staple_state;
+ TransportSecurityStateTest::SetEnableStaticExpectStaple(&state, false);
EXPECT_FALSE(GetExpectStapleState(&state, kExpectStapleStaticHostname,
&expect_staple_state));
- TransportSecurityStateTest::EnableStaticExpectStaple(&state);
+ TransportSecurityStateTest::SetEnableStaticExpectStaple(&state, true);
EXPECT_TRUE(GetExpectStapleState(&state, kExpectStapleStaticHostname,
&expect_staple_state));
EXPECT_EQ(kExpectStapleStaticHostname, expect_staple_state.domain);
@@ -1858,7 +1860,7 @@ TEST_F(TransportSecurityStateTest, PreloadedExpectStaple) {
TEST_F(TransportSecurityStateTest, PreloadedExpectStapleIncludeSubdomains) {
TransportSecurityState state;
- TransportSecurityStateTest::EnableStaticExpectStaple(&state);
+ TransportSecurityStateTest::SetEnableStaticExpectStaple(&state, true);
TransportSecurityState::ExpectStapleState expect_staple_state;
std::string subdomain = "subdomain.";
subdomain += kExpectStapleStaticIncludeSubdomainsHostname;
@@ -2028,7 +2030,7 @@ class ExpectStapleErrorResponseTest
// serialized correctly.
TEST_P(ExpectStapleErrorResponseTest, CheckResponseStatusSerialization) {
TransportSecurityState state;
- TransportSecurityStateTest::EnableStaticExpectStaple(&state);
+ TransportSecurityStateTest::SetEnableStaticExpectStaple(&state, true);
MockCertificateReportSender reporter;
ExpectStapleErrorResponseData test = GetParam();
@@ -2083,7 +2085,7 @@ class ExpectStapleErrorCertStatusTest
// |revocation_status| != GOOD.
TEST_P(ExpectStapleErrorCertStatusTest, CheckCertStatusSerialization) {
TransportSecurityState state;
- TransportSecurityStateTest::EnableStaticExpectStaple(&state);
+ TransportSecurityStateTest::SetEnableStaticExpectStaple(&state, true);
MockCertificateReportSender reporter;
ExpectStapleErrorCertStatusData test = GetParam();
std::string ocsp_response = "dummy_response";
@@ -2123,7 +2125,7 @@ INSTANTIATE_TEST_CASE_P(ExpectStaple,
TEST_F(TransportSecurityStateTest, ExpectStapleDoesNotReportValidStaple) {
TransportSecurityState state;
- TransportSecurityStateTest::EnableStaticExpectStaple(&state);
+ TransportSecurityStateTest::SetEnableStaticExpectStaple(&state, true);
MockCertificateReportSender reporter;
state.SetReportSender(&reporter);
@@ -2158,7 +2160,7 @@ TEST_F(TransportSecurityStateTest, ExpectStapleDoesNotReportValidStaple) {
TEST_F(TransportSecurityStateTest, ExpectStapleRequiresPreload) {
TransportSecurityState state;
- TransportSecurityStateTest::EnableStaticExpectStaple(&state);
+ TransportSecurityStateTest::SetEnableStaticExpectStaple(&state, true);
MockCertificateReportSender reporter;
state.SetReportSender(&reporter);

Powered by Google App Engine
This is Rietveld 408576698