| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "components/certificate_transparency/ct_policy_manager.h" | 5 #include "components/certificate_transparency/ct_policy_manager.h" |
| 6 | 6 |
| 7 #include <iterator> | 7 #include <iterator> |
| 8 | 8 |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/sequenced_task_runner.h" | 10 #include "base/sequenced_task_runner.h" |
| 11 #include "base/single_thread_task_runner.h" | 11 #include "base/single_thread_task_runner.h" |
| 12 #include "base/test/test_message_loop.h" | 12 #include "base/test/test_message_loop.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "components/certificate_transparency/pref_names.h" | 14 #include "components/certificate_transparency/pref_names.h" |
| 15 #include "components/prefs/pref_registry_simple.h" | 15 #include "components/prefs/pref_registry_simple.h" |
| 16 #include "components/prefs/testing_pref_service.h" | 16 #include "components/prefs/testing_pref_service.h" |
| 17 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 18 | 18 |
| 19 namespace certificate_transparency { | 19 namespace certificate_transparency { |
| 20 | 20 |
| 21 namespace { | 21 namespace { |
| 22 | 22 |
| 23 base::ListValue* ListValueFromStrings(const std::vector<const char*>& strings) { | 23 std::unique_ptr<base::ListValue> ListValueFromStrings( |
| 24 const std::vector<const char*>& strings) { |
| 24 std::unique_ptr<base::ListValue> result(new base::ListValue); | 25 std::unique_ptr<base::ListValue> result(new base::ListValue); |
| 25 for (auto* const str : strings) { | 26 for (auto* const str : strings) { |
| 26 result->AppendString(str); | 27 result->AppendString(str); |
| 27 } | 28 } |
| 28 return result.release(); | 29 return result; |
| 29 } | 30 } |
| 30 | 31 |
| 31 class CTPolicyManagerTest : public ::testing::Test { | 32 class CTPolicyManagerTest : public ::testing::Test { |
| 32 public: | 33 public: |
| 33 CTPolicyManagerTest() : message_loop_(base::MessageLoop::TYPE_IO) {} | 34 CTPolicyManagerTest() : message_loop_(base::MessageLoop::TYPE_IO) {} |
| 34 | 35 |
| 35 protected: | 36 protected: |
| 36 base::TestMessageLoop message_loop_; | 37 base::TestMessageLoop message_loop_; |
| 37 TestingPrefServiceSimple pref_service_; | 38 TestingPrefServiceSimple pref_service_; |
| 38 }; | 39 }; |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 266 delegate->IsCTRequiredForHost("sub.example.com")); | 267 delegate->IsCTRequiredForHost("sub.example.com")); |
| 267 | 268 |
| 268 // And it should still be possible to get the delegate, even after calling | 269 // And it should still be possible to get the delegate, even after calling |
| 269 // Shutdown(). | 270 // Shutdown(). |
| 270 EXPECT_TRUE(manager.GetDelegate()); | 271 EXPECT_TRUE(manager.GetDelegate()); |
| 271 } | 272 } |
| 272 | 273 |
| 273 } // namespace | 274 } // namespace |
| 274 | 275 |
| 275 } // namespace certificate_transparency | 276 } // namespace certificate_transparency |
| OLD | NEW |