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

Unified Diff: net/base/transport_security_state_unittest.cc

Issue 6895039: Merge 82409 - Add command-line control of the HSTS preload list. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/742/src/
Patch Set: Created 9 years, 8 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
« no previous file with comments | « net/base/transport_security_state.cc ('k') | net/net.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/transport_security_state_unittest.cc
===================================================================
--- net/base/transport_security_state_unittest.cc (revision 82778)
+++ net/base/transport_security_state_unittest.cc (working copy)
@@ -206,7 +206,7 @@
std::string output;
bool dirty;
state->Serialise(&output);
- EXPECT_TRUE(state->Deserialise(output, &dirty));
+ EXPECT_TRUE(state->LoadEntries(output, &dirty));
EXPECT_FALSE(dirty);
}
@@ -227,7 +227,7 @@
std::string output;
bool dirty;
state->Serialise(&output);
- EXPECT_TRUE(state->Deserialise(output, &dirty));
+ EXPECT_TRUE(state->LoadEntries(output, &dirty));
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "google.com", true));
EXPECT_EQ(domain_state.mode, TransportSecurityState::DomainState::MODE_STRICT);
@@ -260,7 +260,7 @@
std::string output;
bool dirty;
state->Serialise(&output);
- EXPECT_TRUE(state->Deserialise(output, &dirty));
+ EXPECT_TRUE(state->LoadEntries(output, &dirty));
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "google.com", true));
EXPECT_EQ(domain_state.mode,
@@ -318,7 +318,7 @@
"}"
"}";
bool dirty;
- EXPECT_TRUE(state->Deserialise(output, &dirty));
+ EXPECT_TRUE(state->LoadEntries(output, &dirty));
EXPECT_TRUE(dirty);
}
@@ -336,14 +336,20 @@
const std::string aypal =
TransportSecurityState::CanonicalizeHost("aypal.com");
- bool b;
- EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(paypal, true, &b));
- EXPECT_TRUE(TransportSecurityState::IsPreloadedSTS(www_paypal, true, &b));
- EXPECT_FALSE(b);
- EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(a_www_paypal, true, &b));
- EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(abc_paypal, true, &b));
- EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(example, true, &b));
- EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(aypal, true, &b));
+ TransportSecurityState::DomainState domain_state;
+ EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(
+ paypal, true, &domain_state));
+ EXPECT_TRUE(TransportSecurityState::IsPreloadedSTS(
+ www_paypal, true, &domain_state));
+ EXPECT_FALSE(domain_state.include_subdomains);
+ EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(
+ a_www_paypal, true, &domain_state));
+ EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(
+ abc_paypal, true, &domain_state));
+ EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(
+ example, true, &domain_state));
+ EXPECT_FALSE(TransportSecurityState::IsPreloadedSTS(
+ aypal, true, &domain_state));
}
TEST_F(TransportSecurityStateTest, Preloaded) {
@@ -461,6 +467,13 @@
EXPECT_TRUE(state->IsEnabledForHost(&domain_state,
"market.android.com",
true));
+ // The domain wasn't being set, leading to a blank string in the
+ // chrome://net-internals/#hsts UI. So test that.
+ EXPECT_EQ(domain_state.domain, "market.android.com");
+ EXPECT_TRUE(state->IsEnabledForHost(&domain_state,
+ "sub.market.android.com",
+ true));
+ EXPECT_EQ(domain_state.domain, "market.android.com");
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "lastpass.com", true));
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.lastpass.com", true));
@@ -533,7 +546,7 @@
std::string ser;
EXPECT_TRUE(state->Serialise(&ser));
bool dirty;
- EXPECT_TRUE(state->Deserialise(ser, &dirty));
+ EXPECT_TRUE(state->LoadEntries(ser, &dirty));
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "example.com", false));
EXPECT_EQ(1u, domain_state.public_key_hashes.size());
EXPECT_TRUE(0 == memcmp(domain_state.public_key_hashes[0].data, hash.data,
« no previous file with comments | « net/base/transport_security_state.cc ('k') | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698