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

Side by Side Diff: components/autofill/core/browser/autofill_download_manager_unittest.cc

Issue 2082333002: Remove calls to deprecated MessageLoop methods in components. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/autofill/core/browser/autofill_download_manager.h" 5 #include "components/autofill/core/browser/autofill_download_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <list> 9 #include <list>
10 #include <memory> 10 #include <memory>
11 #include <utility> 11 #include <utility>
12 12
13 #include "base/run_loop.h"
13 #include "base/strings/string_number_conversions.h" 14 #include "base/strings/string_number_conversions.h"
14 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
15 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
16 #include "base/test/histogram_tester.h" 17 #include "base/test/histogram_tester.h"
17 #include "base/test/test_timeouts.h" 18 #include "base/test/test_timeouts.h"
18 #include "base/threading/thread_task_runner_handle.h" 19 #include "base/threading/thread_task_runner_handle.h"
19 #include "components/autofill/core/browser/autofill_field.h" 20 #include "components/autofill/core/browser/autofill_field.h"
20 #include "components/autofill/core/browser/autofill_metrics.h" 21 #include "components/autofill/core/browser/autofill_metrics.h"
21 #include "components/autofill/core/browser/autofill_type.h" 22 #include "components/autofill/core/browser/autofill_type.h"
22 #include "components/autofill/core/browser/form_structure.h" 23 #include "components/autofill/core/browser/form_structure.h"
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 ASSERT_TRUE(fetcher); 357 ASSERT_TRUE(fetcher);
357 358
358 // Request error incurs a retry after 1 second. 359 // Request error incurs a retry after 1 second.
359 FakeOnURLFetchComplete(fetcher, net::HTTP_NOT_FOUND, "<html></html>"); 360 FakeOnURLFetchComplete(fetcher, net::HTTP_NOT_FOUND, "<html></html>");
360 EXPECT_EQ(1U, responses_.size()); 361 EXPECT_EQ(1U, responses_.size());
361 EXPECT_LT(download_manager_.fetcher_backoff_.GetTimeUntilRelease(), 362 EXPECT_LT(download_manager_.fetcher_backoff_.GetTimeUntilRelease(),
362 base::TimeDelta::FromMilliseconds(1100)); 363 base::TimeDelta::FromMilliseconds(1100));
363 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 364 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
364 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 365 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
365 base::TimeDelta::FromMilliseconds(1100)); 366 base::TimeDelta::FromMilliseconds(1100));
366 base::MessageLoop::current()->Run(); 367 base::RunLoop().Run();
367 368
368 // Get the retried request. 369 // Get the retried request.
369 fetcher = factory.GetFetcherByID(1); 370 fetcher = factory.GetFetcherByID(1);
370 ASSERT_TRUE(fetcher); 371 ASSERT_TRUE(fetcher);
371 372
372 // Next error incurs a retry after 2 seconds. 373 // Next error incurs a retry after 2 seconds.
373 FakeOnURLFetchComplete(fetcher, net::HTTP_INTERNAL_SERVER_ERROR, ""); 374 FakeOnURLFetchComplete(fetcher, net::HTTP_INTERNAL_SERVER_ERROR, "");
374 EXPECT_EQ(2U, responses_.size()); 375 EXPECT_EQ(2U, responses_.size());
375 EXPECT_LT(download_manager_.fetcher_backoff_.GetTimeUntilRelease(), 376 EXPECT_LT(download_manager_.fetcher_backoff_.GetTimeUntilRelease(),
376 base::TimeDelta::FromMilliseconds(2100)); 377 base::TimeDelta::FromMilliseconds(2100));
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 ASSERT_TRUE(fetcher); 413 ASSERT_TRUE(fetcher);
413 414
414 // Error incurs a retry after 1 second. 415 // Error incurs a retry after 1 second.
415 FakeOnURLFetchComplete(fetcher, net::HTTP_NOT_FOUND, "<html></html>"); 416 FakeOnURLFetchComplete(fetcher, net::HTTP_NOT_FOUND, "<html></html>");
416 EXPECT_EQ(1U, responses_.size()); 417 EXPECT_EQ(1U, responses_.size());
417 EXPECT_LT(download_manager_.fetcher_backoff_.GetTimeUntilRelease(), 418 EXPECT_LT(download_manager_.fetcher_backoff_.GetTimeUntilRelease(),
418 base::TimeDelta::FromMilliseconds(1100)); 419 base::TimeDelta::FromMilliseconds(1100));
419 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 420 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
420 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(), 421 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure(),
421 base::TimeDelta::FromMilliseconds(1100)); 422 base::TimeDelta::FromMilliseconds(1100));
422 base::MessageLoop::current()->Run(); 423 base::RunLoop().Run();
423 424
424 // Check that it was a failure. 425 // Check that it was a failure.
425 EXPECT_EQ(AutofillDownloadManagerTest::REQUEST_UPLOAD_FAILED, 426 EXPECT_EQ(AutofillDownloadManagerTest::REQUEST_UPLOAD_FAILED,
426 responses_.front().type_of_response); 427 responses_.front().type_of_response);
427 EXPECT_EQ(net::HTTP_NOT_FOUND, responses_.front().error); 428 EXPECT_EQ(net::HTTP_NOT_FOUND, responses_.front().error);
428 EXPECT_EQ(form_structure->FormSignature(), responses_.front().signature); 429 EXPECT_EQ(form_structure->FormSignature(), responses_.front().signature);
429 // Expected response on non-query request is an empty string. 430 // Expected response on non-query request is an empty string.
430 EXPECT_EQ(std::string(), responses_.front().response); 431 EXPECT_EQ(std::string(), responses_.front().response);
431 responses_.pop_front(); 432 responses_.pop_front();
432 433
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
635 EXPECT_EQ(0U, responses_.size()); 636 EXPECT_EQ(0U, responses_.size());
636 637
637 fetcher = factory.GetFetcherByID(3); 638 fetcher = factory.GetFetcherByID(3);
638 ASSERT_TRUE(fetcher); 639 ASSERT_TRUE(fetcher);
639 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0])); 640 FakeOnURLFetchComplete(fetcher, 200, std::string(responses[0]));
640 ASSERT_EQ(1U, responses_.size()); 641 ASSERT_EQ(1U, responses_.size());
641 EXPECT_EQ(responses[0], responses_.front().response); 642 EXPECT_EQ(responses[0], responses_.front().response);
642 } 643 }
643 644
644 } // namespace autofill 645 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | components/autofill/core/browser/personal_data_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698