OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 | 341 |
342 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.noisebridge.net")); | 342 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.noisebridge.net")); |
343 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "noisebridge.net")); | 343 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "noisebridge.net")); |
344 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "foo.noisebridge.net")); | 344 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "foo.noisebridge.net")); |
345 | 345 |
346 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "neg9.org")); | 346 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "neg9.org")); |
347 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.neg9.org")); | 347 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.neg9.org")); |
348 | 348 |
349 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "factor.cc")); | 349 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "factor.cc")); |
350 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.factor.cc")); | 350 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, "www.factor.cc")); |
| 351 |
| 352 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "splendidbacon.com")); |
| 353 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "www.splendidbacon.com")); |
| 354 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "foo.splendidbacon.com")); |
351 } | 355 } |
352 | 356 |
353 TEST_F(TransportSecurityStateTest, LongNames) { | 357 TEST_F(TransportSecurityStateTest, LongNames) { |
354 scoped_refptr<TransportSecurityState> state( | 358 scoped_refptr<TransportSecurityState> state( |
355 new TransportSecurityState); | 359 new TransportSecurityState); |
356 const char kLongName[] = | 360 const char kLongName[] = |
357 "lookupByWaveIdHashAndWaveIdIdAndWaveIdDomainAndWaveletIdIdAnd" | 361 "lookupByWaveIdHashAndWaveIdIdAndWaveIdDomainAndWaveletIdIdAnd" |
358 "WaveletIdDomainAndBlipBlipid"; | 362 "WaveletIdDomainAndBlipBlipid"; |
359 TransportSecurityState::DomainState domain_state; | 363 TransportSecurityState::DomainState domain_state; |
360 // Just checks that we don't hit a NOTREACHED. | 364 // Just checks that we don't hit a NOTREACHED. |
361 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, kLongName)); | 365 EXPECT_FALSE(state->IsEnabledForHost(&domain_state, kLongName)); |
362 } | 366 } |
363 | 367 |
364 } // namespace net | 368 } // namespace net |
OLD | NEW |