| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/http/transport_security_persister.h" | 5 #include "net/http/transport_security_persister.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "net/http/transport_security_state.h" | 15 #include "net/http/transport_security_state.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 17 |
| 18 using net::TransportSecurityPersister; | 18 using net::TransportSecurityPersister; |
| 19 using net::TransportSecurityState; | 19 using net::TransportSecurityState; |
| 20 | 20 |
| 21 class TransportSecurityPersisterTest : public testing::Test { | 21 class TransportSecurityPersisterTest : public testing::Test { |
| 22 public: | 22 public: |
| 23 TransportSecurityPersisterTest() { | 23 TransportSecurityPersisterTest() { |
| 24 } | 24 } |
| 25 | 25 |
| 26 virtual ~TransportSecurityPersisterTest() { | 26 virtual ~TransportSecurityPersisterTest() { |
| 27 base::MessageLoopForIO::current()->RunUntilIdle(); | 27 base::MessageLoopForIO::current()->RunUntilIdle(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 virtual void SetUp() OVERRIDE { | 30 virtual void SetUp() override { |
| 31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 31 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 32 persister_.reset(new TransportSecurityPersister( | 32 persister_.reset(new TransportSecurityPersister( |
| 33 &state_, | 33 &state_, |
| 34 temp_dir_.path(), | 34 temp_dir_.path(), |
| 35 base::MessageLoopForIO::current()->message_loop_proxy(), | 35 base::MessageLoopForIO::current()->message_loop_proxy(), |
| 36 false)); | 36 false)); |
| 37 } | 37 } |
| 38 | 38 |
| 39 protected: | 39 protected: |
| 40 base::ScopedTempDir temp_dir_; | 40 base::ScopedTempDir temp_dir_; |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 | 197 |
| 198 TransportSecurityState::DomainState new_domain_state; | 198 TransportSecurityState::DomainState new_domain_state; |
| 199 EXPECT_TRUE(state_.GetDynamicDomainState(kTestDomain, &new_domain_state)); | 199 EXPECT_TRUE(state_.GetDynamicDomainState(kTestDomain, &new_domain_state)); |
| 200 EXPECT_EQ(1u, new_domain_state.pkp.spki_hashes.size()); | 200 EXPECT_EQ(1u, new_domain_state.pkp.spki_hashes.size()); |
| 201 EXPECT_EQ(sha1.tag, new_domain_state.pkp.spki_hashes[0].tag); | 201 EXPECT_EQ(sha1.tag, new_domain_state.pkp.spki_hashes[0].tag); |
| 202 EXPECT_EQ(0, | 202 EXPECT_EQ(0, |
| 203 memcmp(new_domain_state.pkp.spki_hashes[0].data(), | 203 memcmp(new_domain_state.pkp.spki_hashes[0].data(), |
| 204 sha1.data(), | 204 sha1.data(), |
| 205 sha1.size())); | 205 sha1.size())); |
| 206 } | 206 } |
| OLD | NEW |