OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/http/transport_security_state.h" | 5 #include "net/http/transport_security_state.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1221 EXPECT_FALSE(pkp_state.spki_hashes.empty()); | 1221 EXPECT_FALSE(pkp_state.spki_hashes.empty()); |
1222 | 1222 |
1223 EXPECT_TRUE(HasStaticPublicKeyPins("www.twitter.com")); | 1223 EXPECT_TRUE(HasStaticPublicKeyPins("www.twitter.com")); |
1224 | 1224 |
1225 // Check that Facebook subdomains have pinning but not HSTS. | 1225 // Check that Facebook subdomains have pinning but not HSTS. |
1226 EXPECT_TRUE( | 1226 EXPECT_TRUE( |
1227 state.GetStaticDomainState("facebook.com", &sts_state, &pkp_state)); | 1227 state.GetStaticDomainState("facebook.com", &sts_state, &pkp_state)); |
1228 EXPECT_FALSE(pkp_state.spki_hashes.empty()); | 1228 EXPECT_FALSE(pkp_state.spki_hashes.empty()); |
1229 EXPECT_TRUE(StaticShouldRedirect("facebook.com")); | 1229 EXPECT_TRUE(StaticShouldRedirect("facebook.com")); |
1230 | 1230 |
1231 EXPECT_FALSE( | 1231 EXPECT_TRUE( |
1232 state.GetStaticDomainState("foo.facebook.com", &sts_state, &pkp_state)); | 1232 state.GetStaticDomainState("foo.facebook.com", &sts_state, &pkp_state)); |
| 1233 EXPECT_FALSE(pkp_state.spki_hashes.empty()); |
| 1234 EXPECT_FALSE(StaticShouldRedirect("foo.facebook.com")); |
1233 | 1235 |
1234 EXPECT_TRUE( | 1236 EXPECT_TRUE( |
1235 state.GetStaticDomainState("www.facebook.com", &sts_state, &pkp_state)); | 1237 state.GetStaticDomainState("www.facebook.com", &sts_state, &pkp_state)); |
1236 EXPECT_FALSE(pkp_state.spki_hashes.empty()); | 1238 EXPECT_FALSE(pkp_state.spki_hashes.empty()); |
1237 EXPECT_TRUE(StaticShouldRedirect("www.facebook.com")); | 1239 EXPECT_TRUE(StaticShouldRedirect("www.facebook.com")); |
1238 | 1240 |
1239 EXPECT_TRUE(state.GetStaticDomainState("foo.www.facebook.com", &sts_state, | 1241 EXPECT_TRUE(state.GetStaticDomainState("foo.www.facebook.com", &sts_state, |
1240 &pkp_state)); | 1242 &pkp_state)); |
1241 EXPECT_FALSE(pkp_state.spki_hashes.empty()); | 1243 EXPECT_FALSE(pkp_state.spki_hashes.empty()); |
1242 EXPECT_TRUE(StaticShouldRedirect("foo.www.facebook.com")); | 1244 EXPECT_TRUE(StaticShouldRedirect("foo.www.facebook.com")); |
(...skipping 1556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2799 MockExpectCTReporter reporter; | 2801 MockExpectCTReporter reporter; |
2800 state.SetExpectCTReporter(&reporter); | 2802 state.SetExpectCTReporter(&reporter); |
2801 state.ProcessExpectCTHeader(kHeader, HostPortPair("example.test", 443), ssl); | 2803 state.ProcessExpectCTHeader(kHeader, HostPortPair("example.test", 443), ssl); |
2802 TransportSecurityState::ExpectCTState expect_ct_state; | 2804 TransportSecurityState::ExpectCTState expect_ct_state; |
2803 EXPECT_FALSE(state.GetDynamicExpectCTState("example.test", &expect_ct_state)); | 2805 EXPECT_FALSE(state.GetDynamicExpectCTState("example.test", &expect_ct_state)); |
2804 EXPECT_EQ(1u, reporter.num_failures()); | 2806 EXPECT_EQ(1u, reporter.num_failures()); |
2805 EXPECT_EQ("example.test", reporter.host_port_pair().host()); | 2807 EXPECT_EQ("example.test", reporter.host_port_pair().host()); |
2806 } | 2808 } |
2807 | 2809 |
2808 } // namespace net | 2810 } // namespace net |
OLD | NEW |