| 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 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 546 std::string ser; | 546 std::string ser; |
| 547 EXPECT_TRUE(state->Serialise(&ser)); | 547 EXPECT_TRUE(state->Serialise(&ser)); |
| 548 bool dirty; | 548 bool dirty; |
| 549 EXPECT_TRUE(state->LoadEntries(ser, &dirty)); | 549 EXPECT_TRUE(state->LoadEntries(ser, &dirty)); |
| 550 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "example.com", false)); | 550 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, "example.com", false)); |
| 551 EXPECT_EQ(1u, domain_state.public_key_hashes.size()); | 551 EXPECT_EQ(1u, domain_state.public_key_hashes.size()); |
| 552 EXPECT_TRUE(0 == memcmp(domain_state.public_key_hashes[0].data, hash.data, | 552 EXPECT_TRUE(0 == memcmp(domain_state.public_key_hashes[0].data, hash.data, |
| 553 sizeof(hash.data))); | 553 sizeof(hash.data))); |
| 554 } | 554 } |
| 555 | 555 |
| 556 TEST_F(TransportSecurityStateTest, BuiltinCertPins) { |
| 557 scoped_refptr<TransportSecurityState> state( |
| 558 new TransportSecurityState); |
| 559 |
| 560 TransportSecurityState::DomainState domain_state; |
| 561 EXPECT_TRUE(state->IsEnabledForHost(&domain_state, |
| 562 "chrome.google.com", |
| 563 true)); |
| 564 std::vector<SHA1Fingerprint> hashes; |
| 565 // This essential checks that a built-in list does exist. |
| 566 EXPECT_FALSE(domain_state.IsChainOfPublicKeysPermitted(hashes)); |
| 567 } |
| 568 |
| 556 } // namespace net | 569 } // namespace net |
| OLD | NEW |