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

Unified Diff: net/base/transport_security_state_unittest.cc

Issue 6500010: HSTS: add net-internals UI. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ... Created 9 years, 10 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
« net/base/dns_util.cc ('K') | « net/base/transport_security_state.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/transport_security_state_unittest.cc
diff --git a/net/base/transport_security_state_unittest.cc b/net/base/transport_security_state_unittest.cc
index 3c81c69789b8f8c9d75262c02ba12f6e58a6dc71..8283aa34b65b58e3f9e61df04d0117a7fa04bbae 100644
--- a/net/base/transport_security_state_unittest.cc
+++ b/net/base/transport_security_state_unittest.cc
@@ -281,6 +281,23 @@ TEST_F(TransportSecurityStateTest, DeleteSince) {
EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "google.com"));
}
+TEST_F(TransportSecurityStateTest, DeleteHost) {
+ scoped_refptr<TransportSecurityState> state(
+ new TransportSecurityState);
+
+ TransportSecurityState::DomainState domain_state;
+ const base::Time current_time(base::Time::Now());
+ const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000);
+ domain_state.mode = TransportSecurityState::DomainState::MODE_STRICT;
+ domain_state.expiry = expiry;
+ state->EnableHost("google.com", domain_state);
+
+ EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "google.com"));
+ EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "example.com"));
+ EXPECT_TRUE(state->DeleteHost("google.com"));
+ EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "google.com"));
+}
+
TEST_F(TransportSecurityStateTest, SerialiseOld) {
scoped_refptr<TransportSecurityState> state(
new TransportSecurityState);
@@ -331,6 +348,7 @@ TEST_F(TransportSecurityStateTest, Preloaded) {
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.paypal.com"));
EXPECT_EQ(domain_state.mode,
TransportSecurityState::DomainState::MODE_STRICT);
+ EXPECT_TRUE(domain_state.preloaded);
EXPECT_FALSE(domain_state.include_subdomains);
EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www2.paypal.com"));
EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "a.www.paypal.com"));
@@ -370,6 +388,10 @@ TEST_F(TransportSecurityStateTest, Preloaded) {
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "splendidbacon.com"));
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.splendidbacon.com"));
EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "foo.splendidbacon.com"));
+
+ EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "chrome.google.com"));
+ EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "checkout.google.com"));
+ EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "health.google.com"));
}
TEST_F(TransportSecurityStateTest, LongNames) {
« net/base/dns_util.cc ('K') | « net/base/transport_security_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698