OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/transport_security_state.h" | 5 #include "net/base/transport_security_state.h" |
6 #include "testing/gtest/include/gtest/gtest.h" | 6 #include "testing/gtest/include/gtest/gtest.h" |
7 | 7 |
8 namespace net { | 8 namespace net { |
9 | 9 |
10 class TransportSecurityStateTest : public testing::Test { | 10 class TransportSecurityStateTest : public testing::Test { |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 "health.google.com", | 438 "health.google.com", |
439 true)); | 439 true)); |
440 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, | 440 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, |
441 "aladdinschools.appspot.com", | 441 "aladdinschools.appspot.com", |
442 true)); | 442 true)); |
443 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "ottospora.nl", true)); | 443 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "ottospora.nl", true)); |
444 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.ottospora.nl", true)); | 444 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.ottospora.nl", true)); |
445 | 445 |
446 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "docs.google.com", true)); | 446 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "docs.google.com", true)); |
447 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "sites.google.com", true)); | 447 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "sites.google.com", true)); |
| 448 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "drive.google.com", true)); |
448 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, | 449 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, |
449 "spreadsheets.google.com", | 450 "spreadsheets.google.com", |
450 true)); | 451 true)); |
451 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, | 452 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, |
452 "appengine.google.com", | 453 "appengine.google.com", |
453 true)); | 454 true)); |
454 | 455 |
455 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, | 456 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, |
456 "www.paycheckrecords.com", | 457 "www.paycheckrecords.com", |
457 true)); | 458 true)); |
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
706 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "chrome.google.com", true)); | 707 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "chrome.google.com", true)); |
707 std::vector<SHA1Fingerprint> hashes; | 708 std::vector<SHA1Fingerprint> hashes; |
708 // This essential checks that a built-in list does exist. | 709 // This essential checks that a built-in list does exist. |
709 EXPECT_FALSE(domain_state.IsChainOfPublicKeysPermitted(hashes)); | 710 EXPECT_FALSE(domain_state.IsChainOfPublicKeysPermitted(hashes)); |
710 EXPECT_FALSE(state->HasPinsForHost(&domain_state, "www.paypal.com", true)); | 711 EXPECT_FALSE(state->HasPinsForHost(&domain_state, "www.paypal.com", true)); |
711 EXPECT_FALSE(state->HasPinsForHost(&domain_state, "twitter.com", true)); | 712 EXPECT_FALSE(state->HasPinsForHost(&domain_state, "twitter.com", true)); |
712 | 713 |
713 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "docs.google.com", true)); | 714 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "docs.google.com", true)); |
714 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "1.docs.google.com", true)); | 715 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "1.docs.google.com", true)); |
715 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "sites.google.com", true)); | 716 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "sites.google.com", true)); |
| 717 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "drive.google.com", true)); |
716 EXPECT_TRUE(state->HasPinsForHost(&domain_state, | 718 EXPECT_TRUE(state->HasPinsForHost(&domain_state, |
717 "spreadsheets.google.com", | 719 "spreadsheets.google.com", |
718 true)); | 720 true)); |
719 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "health.google.com", true)); | 721 EXPECT_TRUE(state->HasPinsForHost(&domain_state, "health.google.com", true)); |
720 EXPECT_TRUE(state->HasPinsForHost(&domain_state, | 722 EXPECT_TRUE(state->HasPinsForHost(&domain_state, |
721 "checkout.google.com", | 723 "checkout.google.com", |
722 true)); | 724 true)); |
723 EXPECT_TRUE(state->HasPinsForHost(&domain_state, | 725 EXPECT_TRUE(state->HasPinsForHost(&domain_state, |
724 "appengine.google.com", | 726 "appengine.google.com", |
725 true)); | 727 true)); |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
834 domain_state = TransportSecurityState::DomainState(); | 836 domain_state = TransportSecurityState::DomainState(); |
835 const base::Time current_time(base::Time::Now()); | 837 const base::Time current_time(base::Time::Now()); |
836 const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000); | 838 const base::Time expiry = current_time + base::TimeDelta::FromSeconds(1000); |
837 domain_state.expiry = expiry; | 839 domain_state.expiry = expiry; |
838 state->EnableHost("www.google.com", domain_state); | 840 state->EnableHost("www.google.com", domain_state); |
839 | 841 |
840 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.google.com", true)); | 842 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.google.com", true)); |
841 } | 843 } |
842 | 844 |
843 } // namespace net | 845 } // namespace net |
OLD | NEW |