| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/debug/leak_annotations.h" | 6 #include "base/debug/leak_annotations.h" |
| 7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
| 8 #include "base/memory/ptr_util.h" | 8 #include "base/memory/ptr_util.h" |
| 9 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 10 #include "base/test/test_simple_task_runner.h" | 10 #include "base/test/test_simple_task_runner.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 V4DatabaseTest() | 70 V4DatabaseTest() |
| 71 : task_runner_(new base::TestSimpleTaskRunner), | 71 : task_runner_(new base::TestSimpleTaskRunner), |
| 72 linux_malware_id_(LINUX_PLATFORM, URL, MALWARE_THREAT), | 72 linux_malware_id_(LINUX_PLATFORM, URL, MALWARE_THREAT), |
| 73 win_malware_id_(WINDOWS_PLATFORM, URL, MALWARE_THREAT) {} | 73 win_malware_id_(WINDOWS_PLATFORM, URL, MALWARE_THREAT) {} |
| 74 | 74 |
| 75 void SetUp() override { | 75 void SetUp() override { |
| 76 PlatformTest::SetUp(); | 76 PlatformTest::SetUp(); |
| 77 | 77 |
| 78 // Setup a database in a temporary directory. | 78 // Setup a database in a temporary directory. |
| 79 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); | 79 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); |
| 80 database_dirname_ = temp_dir_.path().AppendASCII("V4DatabaseTest"); | 80 database_dirname_ = temp_dir_.GetPath().AppendASCII("V4DatabaseTest"); |
| 81 | 81 |
| 82 created_but_not_called_back_ = false; | 82 created_but_not_called_back_ = false; |
| 83 created_and_called_back_ = false; | 83 created_and_called_back_ = false; |
| 84 | 84 |
| 85 callback_db_updated_ = | 85 callback_db_updated_ = |
| 86 base::Bind(&V4DatabaseTest::DatabaseUpdated, base::Unretained(this)); | 86 base::Bind(&V4DatabaseTest::DatabaseUpdated, base::Unretained(this)); |
| 87 | 87 |
| 88 callback_db_ready_ = base::Bind( | 88 callback_db_ready_ = base::Bind( |
| 89 &V4DatabaseTest::NewDatabaseReadyWithExpectedStorePathsAndIds, | 89 &V4DatabaseTest::NewDatabaseReadyWithExpectedStorePathsAndIds, |
| 90 base::Unretained(this)); | 90 base::Unretained(this)); |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 463 // Don't add win_malware_id_ to the stores_to_look. | 463 // Don't add win_malware_id_ to the stores_to_look. |
| 464 StoreAndHashPrefixes store_and_hash_prefixes; | 464 StoreAndHashPrefixes store_and_hash_prefixes; |
| 465 v4_database_->GetStoresMatchingFullHash("anything", stores_to_look, | 465 v4_database_->GetStoresMatchingFullHash("anything", stores_to_look, |
| 466 &store_and_hash_prefixes); | 466 &store_and_hash_prefixes); |
| 467 EXPECT_EQ(1u, store_and_hash_prefixes.size()); | 467 EXPECT_EQ(1u, store_and_hash_prefixes.size()); |
| 468 EXPECT_EQ(store_and_hash_prefixes.begin()->list_id, linux_malware_id_); | 468 EXPECT_EQ(store_and_hash_prefixes.begin()->list_id, linux_malware_id_); |
| 469 EXPECT_FALSE(store_and_hash_prefixes.begin()->hash_prefix.empty()); | 469 EXPECT_FALSE(store_and_hash_prefixes.begin()->hash_prefix.empty()); |
| 470 } | 470 } |
| 471 | 471 |
| 472 } // namespace safe_browsing | 472 } // namespace safe_browsing |
| OLD | NEW |