Chromium Code Reviews| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/files/file_path.h" | 12 #include "base/files/file_path.h" |
| 13 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 14 #include "base/files/scoped_temp_dir.h" | 14 #include "base/files/scoped_temp_dir.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/run_loop.h" | |
| 16 #include "net/http/transport_security_state.h" | 17 #include "net/http/transport_security_state.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 19 |
| 19 namespace net { | 20 namespace net { |
| 20 | 21 |
| 21 namespace { | 22 namespace { |
| 22 | 23 |
| 23 const char kReportUri[] = "http://www.example.test/report"; | 24 const char kReportUri[] = "http://www.example.test/report"; |
| 24 | 25 |
| 25 class TransportSecurityPersisterTest : public testing::Test { | 26 class TransportSecurityPersisterTest : public testing::Test { |
| 26 public: | 27 public: |
| 27 TransportSecurityPersisterTest() { | 28 TransportSecurityPersisterTest() { |
| 28 } | 29 } |
| 29 | 30 |
| 30 ~TransportSecurityPersisterTest() override { | 31 ~TransportSecurityPersisterTest() override { base::RunLoop().RunUntilIdle(); } |
|
gab
2016/08/05 01:09:57
Missing DCHECK ForIO
fdoray
2016/08/05 16:10:36
Done.
| |
| 31 base::MessageLoopForIO::current()->RunUntilIdle(); | |
| 32 } | |
| 33 | 32 |
| 34 void SetUp() override { | 33 void SetUp() override { |
| 35 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 34 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 36 persister_.reset(new TransportSecurityPersister( | 35 persister_.reset(new TransportSecurityPersister( |
| 37 &state_, temp_dir_.path(), | 36 &state_, temp_dir_.path(), |
| 38 base::MessageLoopForIO::current()->task_runner(), false)); | 37 base::MessageLoopForIO::current()->task_runner(), false)); |
| 39 } | 38 } |
| 40 | 39 |
| 41 protected: | 40 protected: |
| 42 base::ScopedTempDir temp_dir_; | 41 base::ScopedTempDir temp_dir_; |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 EXPECT_EQ(1u, new_pkp_state.spki_hashes.size()); | 221 EXPECT_EQ(1u, new_pkp_state.spki_hashes.size()); |
| 223 EXPECT_EQ(sha256.tag, new_pkp_state.spki_hashes[0].tag); | 222 EXPECT_EQ(sha256.tag, new_pkp_state.spki_hashes[0].tag); |
| 224 EXPECT_EQ(0, memcmp(new_pkp_state.spki_hashes[0].data(), sha256.data(), | 223 EXPECT_EQ(0, memcmp(new_pkp_state.spki_hashes[0].data(), sha256.data(), |
| 225 sha256.size())); | 224 sha256.size())); |
| 226 EXPECT_EQ(report_uri, new_pkp_state.report_uri); | 225 EXPECT_EQ(report_uri, new_pkp_state.report_uri); |
| 227 } | 226 } |
| 228 | 227 |
| 229 } // namespace | 228 } // namespace |
| 230 | 229 |
| 231 } // namespace net | 230 } // namespace net |
| OLD | NEW |