Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(206)

Side by Side Diff: net/base/transport_security_state_unittest.cc

Issue 6894026: Add support for built-in certificate pins, and add a pin list suitable for (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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
OLDNEW
« net/base/transport_security_state.cc ('K') | « net/base/transport_security_state.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698