| 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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 489 true)); | 489 true)); |
| 490 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, | 490 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, |
| 491 "accounts.google.com", | 491 "accounts.google.com", |
| 492 true)); | 492 true)); |
| 493 | 493 |
| 494 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "entropia.de", true)); | 494 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "entropia.de", true)); |
| 495 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.entropia.de", true)); | 495 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.entropia.de", true)); |
| 496 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "foo.entropia.de", true)); | 496 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "foo.entropia.de", true)); |
| 497 | 497 |
| 498 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "gmail.com", true)); | 498 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "gmail.com", true)); |
| 499 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.gmail.com", true)); | 499 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.gmail.com", true)); |
| 500 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "googlemail.com", true)); | 500 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "googlemail.com", true)); |
| 501 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, | 501 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, |
| 502 "www.googlemail.com", | 502 "www.googlemail.com", |
| 503 true)); | 503 true)); |
| 504 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "gmail.com", false)); | 504 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "gmail.com", false)); |
| 505 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.gmail.com", false)); | 505 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.gmail.com", false)); |
| 506 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "googlemail.com", false)); | 506 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "googlemail.com", false)); |
| 507 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, | 507 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, |
| 508 "www.googlemail.com", | 508 "www.googlemail.com", |
| 509 false)); | 509 false)); |
| 510 } | 510 } |
| 511 | 511 |
| 512 TEST_F(TransportSecurityStateTest, LongNames) { | 512 TEST_F(TransportSecurityStateTest, LongNames) { |
| 513 scoped_refptr<TransportSecurityState> state( | 513 scoped_refptr<TransportSecurityState> state( |
| 514 new TransportSecurityState); | 514 new TransportSecurityState); |
| 515 const char kLongName[] = | 515 const char kLongName[] = |
| 516 "lookupByWaveIdHashAndWaveIdIdAndWaveIdDomainAndWaveletIdIdAnd" | 516 "lookupByWaveIdHashAndWaveIdIdAndWaveIdDomainAndWaveletIdIdAnd" |
| 517 "WaveletIdDomainAndBlipBlipid"; | 517 "WaveletIdDomainAndBlipBlipid"; |
| 518 TransportSecurityState::DomainState domain_state; | 518 TransportSecurityState::DomainState domain_state; |
| 519 // Just checks that we don't hit a NOTREACHED. | 519 // Just checks that we don't hit a NOTREACHED. |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 true)); | 582 true)); |
| 583 EXPECT_FALSE(state->HasPinsForHost(&domain_state, | 583 EXPECT_FALSE(state->HasPinsForHost(&domain_state, |
| 584 "www.google-analytics.com", | 584 "www.google-analytics.com", |
| 585 false)); | 585 false)); |
| 586 EXPECT_TRUE(state->HasPinsForHost(&domain_state, | 586 EXPECT_TRUE(state->HasPinsForHost(&domain_state, |
| 587 "www.google-analytics.com", | 587 "www.google-analytics.com", |
| 588 true)); | 588 true)); |
| 589 } | 589 } |
| 590 | 590 |
| 591 } // namespace net | 591 } // namespace net |
| OLD | NEW |