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/safe_browsing_db/v4_local_database_manager.h" | 5 #include "components/safe_browsing_db/v4_local_database_manager.h" |
6 #include "base/files/scoped_temp_dir.h" | 6 #include "base/files/scoped_temp_dir.h" |
7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
8 #include "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
(...skipping 1075 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 const GURL url_bad("https://" + url_bad_no_scheme), | 1086 const GURL url_bad("https://" + url_bad_no_scheme), |
1087 url_good("https://example.com/good/"); | 1087 url_good("https://example.com/good/"); |
1088 const std::vector<GURL> url_chain({url_good, url_bad}); | 1088 const std::vector<GURL> url_chain({url_good, url_bad}); |
1089 | 1089 |
1090 // Put a match in the db that will cause a protocol-manager request. | 1090 // Put a match in the db that will cause a protocol-manager request. |
1091 const HashPrefix bad_hash_prefix(bad_full_hash.substr(0, 5)); | 1091 const HashPrefix bad_hash_prefix(bad_full_hash.substr(0, 5)); |
1092 StoreAndHashPrefixes store_and_hash_prefixes; | 1092 StoreAndHashPrefixes store_and_hash_prefixes; |
1093 store_and_hash_prefixes.emplace_back(GetUrlMalBinId(), bad_hash_prefix); | 1093 store_and_hash_prefixes.emplace_back(GetUrlMalBinId(), bad_hash_prefix); |
1094 ReplaceV4Database(store_and_hash_prefixes, true /* stores_available */); | 1094 ReplaceV4Database(store_and_hash_prefixes, true /* stores_available */); |
1095 | 1095 |
1096 TestClient client(SB_THREAT_TYPE_BINARY_MALWARE_URL, url_chain); | 1096 TestClient client(SB_THREAT_TYPE_URL_BINARY_MALWARE, url_chain); |
1097 EXPECT_FALSE( | 1097 EXPECT_FALSE( |
1098 v4_local_database_manager_->CheckDownloadUrl(url_chain, &client)); | 1098 v4_local_database_manager_->CheckDownloadUrl(url_chain, &client)); |
1099 EXPECT_FALSE(client.on_check_download_urls_result_called_); | 1099 EXPECT_FALSE(client.on_check_download_urls_result_called_); |
1100 WaitForTasksOnTaskRunner(); | 1100 WaitForTasksOnTaskRunner(); |
1101 EXPECT_TRUE(client.on_check_download_urls_result_called_); | 1101 EXPECT_TRUE(client.on_check_download_urls_result_called_); |
1102 } | 1102 } |
1103 | 1103 |
1104 } // namespace safe_browsing | 1104 } // namespace safe_browsing |
OLD | NEW |