| 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 "base/files/scoped_temp_dir.h" | 5 #include "base/files/scoped_temp_dir.h" |
| 6 #include "base/memory/ptr_util.h" | 6 #include "base/memory/ptr_util.h" |
| 7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/test/test_simple_task_runner.h" | 9 #include "base/test/test_simple_task_runner.h" |
| 10 #include "components/safe_browsing_db/v4_database.h" | 10 #include "components/safe_browsing_db/v4_database.h" |
| 11 #include "components/safe_browsing_db/v4_local_database_manager.h" | 11 #include "components/safe_browsing_db/v4_local_database_manager.h" |
| 12 #include "content/public/test/test_browser_thread_bundle.h" | 12 #include "content/public/test/test_browser_thread_bundle.h" |
| 13 #include "net/url_request/test_url_fetcher_factory.h" | 13 #include "net/url_request/test_url_fetcher_factory.h" |
| 14 #include "testing/platform_test.h" | 14 #include "testing/platform_test.h" |
| 15 | 15 |
| 16 namespace safe_browsing { | 16 namespace safe_browsing { |
| 17 | 17 |
| 18 class FakeV4Database : public V4Database { | 18 class FakeV4Database : public V4Database { |
| 19 public: | 19 public: |
| 20 FakeV4Database(const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, | 20 FakeV4Database(const scoped_refptr<base::SequencedTaskRunner>& db_task_runner, |
| 21 std::unique_ptr<StoreMap> store_map, | 21 std::unique_ptr<StoreMap> store_map, |
| 22 const StoreAndHashPrefixes& store_and_hash_prefixes) | 22 const StoreAndHashPrefixes& store_and_hash_prefixes) |
| 23 : V4Database(db_task_runner, std::move(store_map)), | 23 : V4Database(db_task_runner, std::move(store_map)), |
| 24 store_and_hash_prefixes_(store_and_hash_prefixes) {} | 24 store_and_hash_prefixes_(store_and_hash_prefixes) {} |
| 25 | 25 |
| 26 void GetStoresMatchingFullHash( | 26 void GetStoresMatchingFullHash( |
| 27 const FullHash& full_hash, | 27 const FullHash& full_hash, |
| 28 const base::hash_set<UpdateListIdentifier>& stores_to_look, | 28 const std::unordered_set<UpdateListIdentifier>& stores_to_look, |
| 29 StoreAndHashPrefixes* store_and_hash_prefixes) override { | 29 StoreAndHashPrefixes* store_and_hash_prefixes) override { |
| 30 *store_and_hash_prefixes = store_and_hash_prefixes_; | 30 *store_and_hash_prefixes = store_and_hash_prefixes_; |
| 31 } | 31 } |
| 32 | 32 |
| 33 private: | 33 private: |
| 34 const StoreAndHashPrefixes& store_and_hash_prefixes_; | 34 const StoreAndHashPrefixes& store_and_hash_prefixes_; |
| 35 }; | 35 }; |
| 36 | 36 |
| 37 class V4LocalDatabaseManagerTest : public PlatformTest { | 37 class V4LocalDatabaseManagerTest : public PlatformTest { |
| 38 public: | 38 public: |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 | 130 |
| 131 // The same URL returns |false| in the previous test because | 131 // The same URL returns |false| in the previous test because |
| 132 // v4_local_database_manager_ is enabled. | 132 // v4_local_database_manager_ is enabled. |
| 133 ForceDisableLocalDatabaseManager(); | 133 ForceDisableLocalDatabaseManager(); |
| 134 | 134 |
| 135 EXPECT_TRUE(v4_local_database_manager_->CheckBrowseUrl( | 135 EXPECT_TRUE(v4_local_database_manager_->CheckBrowseUrl( |
| 136 GURL("http://example.com/a/"), nullptr)); | 136 GURL("http://example.com/a/"), nullptr)); |
| 137 } | 137 } |
| 138 | 138 |
| 139 } // namespace safe_browsing | 139 } // namespace safe_browsing |
| OLD | NEW |