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

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

Issue 1954393002: Initialize and reset V4LocalDBManager. Instantiate V4Stores. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@v4_01_db_realz
Patch Set: CR feedback Created 4 years, 7 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 "components/safe_browsing_db/v4_update_protocol_manager.h" 5 #include "components/safe_browsing_db/v4_update_protocol_manager.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
235 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0); 235 net::TestURLFetcher* fetcher = factory.GetFetcherByID(0);
236 DCHECK(fetcher); 236 DCHECK(fetcher);
237 fetcher->set_status(net::URLRequestStatus()); 237 fetcher->set_status(net::URLRequestStatus());
238 fetcher->set_response_code(net::HTTP_OK); 238 fetcher->set_response_code(net::HTTP_OK);
239 fetcher->SetResponseString(GetExpectedV4UpdateResponse(expected_lurs)); 239 fetcher->SetResponseString(GetExpectedV4UpdateResponse(expected_lurs));
240 fetcher->delegate()->OnURLFetchComplete(fetcher); 240 fetcher->delegate()->OnURLFetchComplete(fetcher);
241 241
242 // No error, back off multiplier is unchanged. 242 // No error, back off multiplier is unchanged.
243 EXPECT_EQ(0ul, pm->update_error_count_); 243 EXPECT_EQ(0ul, pm->update_error_count_);
244 EXPECT_EQ(1ul, pm->update_back_off_mult_); 244 EXPECT_EQ(1ul, pm->update_back_off_mult_);
245 EXPECT_TRUE(pm->IsUpdateScheduled()); 245 EXPECT_FALSE(pm->IsUpdateScheduled());
246 } 246 }
247 247
248 TEST_F(V4UpdateProtocolManagerTest, TestGetUpdatesWithOneBackoff) { 248 TEST_F(V4UpdateProtocolManagerTest, TestGetUpdatesWithOneBackoff) {
249 scoped_refptr<base::TestSimpleTaskRunner> runner( 249 scoped_refptr<base::TestSimpleTaskRunner> runner(
250 new base::TestSimpleTaskRunner()); 250 new base::TestSimpleTaskRunner());
251 base::ThreadTaskRunnerHandle runner_handler(runner); 251 base::ThreadTaskRunnerHandle runner_handler(runner);
252 net::TestURLFetcherFactory factory; 252 net::TestURLFetcherFactory factory;
253 std::vector<ListUpdateResponse> expected_lurs; 253 std::vector<ListUpdateResponse> expected_lurs;
254 SetupExpectedListUpdateResponse(&expected_lurs); 254 SetupExpectedListUpdateResponse(&expected_lurs);
255 base::hash_map<UpdateListIdentifier, std::string> current_list_states; 255 base::hash_map<UpdateListIdentifier, std::string> current_list_states;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 fetcher = factory.GetFetcherByID(1); 288 fetcher = factory.GetFetcherByID(1);
289 DCHECK(fetcher); 289 DCHECK(fetcher);
290 fetcher->set_status(net::URLRequestStatus()); 290 fetcher->set_status(net::URLRequestStatus());
291 fetcher->set_response_code(net::HTTP_OK); 291 fetcher->set_response_code(net::HTTP_OK);
292 fetcher->SetResponseString(GetExpectedV4UpdateResponse(expected_lurs)); 292 fetcher->SetResponseString(GetExpectedV4UpdateResponse(expected_lurs));
293 fetcher->delegate()->OnURLFetchComplete(fetcher); 293 fetcher->delegate()->OnURLFetchComplete(fetcher);
294 294
295 // No error, back off multiplier is unchanged. 295 // No error, back off multiplier is unchanged.
296 EXPECT_EQ(0ul, pm->update_error_count_); 296 EXPECT_EQ(0ul, pm->update_error_count_);
297 EXPECT_EQ(1ul, pm->update_back_off_mult_); 297 EXPECT_EQ(1ul, pm->update_back_off_mult_);
298 EXPECT_TRUE(pm->IsUpdateScheduled()); 298 EXPECT_FALSE(pm->IsUpdateScheduled());
299 } 299 }
300 300
301 } // namespace safe_browsing 301 } // namespace safe_browsing
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698