| 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 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 144 } | 144 } |
| 145 | 145 |
| 146 std::unique_ptr<ParsedServerResponse> CreateFakeServerResponse( | 146 std::unique_ptr<ParsedServerResponse> CreateFakeServerResponse( |
| 147 StoreStateMap store_state_map, | 147 StoreStateMap store_state_map, |
| 148 bool use_valid_response_type) { | 148 bool use_valid_response_type) { |
| 149 std::unique_ptr<ParsedServerResponse> parsed_server_response( | 149 std::unique_ptr<ParsedServerResponse> parsed_server_response( |
| 150 new ParsedServerResponse); | 150 new ParsedServerResponse); |
| 151 for (const auto& store_state_iter : store_state_map) { | 151 for (const auto& store_state_iter : store_state_map) { |
| 152 ListIdentifier identifier = store_state_iter.first; | 152 ListIdentifier identifier = store_state_iter.first; |
| 153 ListUpdateResponse* lur = new ListUpdateResponse; | 153 ListUpdateResponse* lur = new ListUpdateResponse; |
| 154 lur->set_platform_type(identifier.platform_type); | 154 lur->set_platform_type(identifier.platform_type()); |
| 155 lur->set_threat_entry_type(identifier.threat_entry_type); | 155 lur->set_threat_entry_type(identifier.threat_entry_type()); |
| 156 lur->set_threat_type(identifier.threat_type); | 156 lur->set_threat_type(identifier.threat_type()); |
| 157 lur->set_new_client_state(store_state_iter.second); | 157 lur->set_new_client_state(store_state_iter.second); |
| 158 if (use_valid_response_type) { | 158 if (use_valid_response_type) { |
| 159 lur->set_response_type(ListUpdateResponse::FULL_UPDATE); | 159 lur->set_response_type(ListUpdateResponse::FULL_UPDATE); |
| 160 } else { | 160 } else { |
| 161 lur->set_response_type(ListUpdateResponse::RESPONSE_TYPE_UNSPECIFIED); | 161 lur->set_response_type(ListUpdateResponse::RESPONSE_TYPE_UNSPECIFIED); |
| 162 } | 162 } |
| 163 parsed_server_response->push_back(base::WrapUnique(lur)); | 163 parsed_server_response->push_back(base::WrapUnique(lur)); |
| 164 } | 164 } |
| 165 return parsed_server_response; | 165 return parsed_server_response; |
| 166 } | 166 } |
| (...skipping 296 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 |