Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(720)

Side by Side Diff: components/safe_browsing_db/v4_database_unittest.cc

Issue 2128173003: Merge the hash prefixes from the old store and the additions in the partial (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Simplified merge logic. +Nit: Fix a failing test Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 v4_database_ = std::move(v4_database); 126 v4_database_ = std::move(v4_database);
127 } 127 }
128 128
129 std::unique_ptr<ParsedServerResponse> CreateFakeServerResponse( 129 std::unique_ptr<ParsedServerResponse> CreateFakeServerResponse(
130 StoreStateMap store_state_map) { 130 StoreStateMap store_state_map) {
131 std::unique_ptr<ParsedServerResponse> parsed_server_response( 131 std::unique_ptr<ParsedServerResponse> parsed_server_response(
132 new ParsedServerResponse); 132 new ParsedServerResponse);
133 for (const auto& store_state_iter : store_state_map) { 133 for (const auto& store_state_iter : store_state_map) {
134 UpdateListIdentifier identifier = store_state_iter.first; 134 UpdateListIdentifier identifier = store_state_iter.first;
135 ListUpdateResponse* list_update_response = new ListUpdateResponse; 135 ListUpdateResponse* list_update_response = new ListUpdateResponse;
136 list_update_response->set_response_type(ListUpdateResponse::FULL_UPDATE);
136 list_update_response->set_platform_type(identifier.platform_type); 137 list_update_response->set_platform_type(identifier.platform_type);
137 list_update_response->set_threat_entry_type(identifier.threat_entry_type); 138 list_update_response->set_threat_entry_type(identifier.threat_entry_type);
138 list_update_response->set_threat_type(identifier.threat_type); 139 list_update_response->set_threat_type(identifier.threat_type);
139 list_update_response->set_new_client_state(store_state_iter.second); 140 list_update_response->set_new_client_state(store_state_iter.second);
140 parsed_server_response->push_back(base::WrapUnique(list_update_response)); 141 parsed_server_response->push_back(base::WrapUnique(list_update_response));
141 } 142 }
142 return parsed_server_response; 143 return parsed_server_response;
143 } 144 }
144 145
145 void VerifyExpectedStoresState(bool expect_new_stores) { 146 void VerifyExpectedStoresState(bool expect_new_stores) {
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 v4_database_->ApplyUpdate(std::move(parsed_server_response), 303 v4_database_->ApplyUpdate(std::move(parsed_server_response),
303 callback_db_updated_); 304 callback_db_updated_);
304 305
305 task_runner_->RunPendingTasks(); 306 task_runner_->RunPendingTasks();
306 base::RunLoop().RunUntilIdle(); 307 base::RunLoop().RunUntilIdle();
307 308
308 VerifyExpectedStoresState(false); 309 VerifyExpectedStoresState(false);
309 } 310 }
310 311
311 } // namespace safe_browsing 312 } // namespace safe_browsing
OLDNEW
« no previous file with comments | « no previous file | components/safe_browsing_db/v4_store.h » ('j') | components/safe_browsing_db/v4_store.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698