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

Side by Side Diff: chrome/service/cloud_print/printer_job_handler_unittest.cc

Issue 2083363002: Remove calls to deprecated MessageLoop methods in chrome. (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 | « chrome/service/cloud_print/printer_job_handler.cc ('k') | chrome/service/service_main.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 (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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 "chrome/service/cloud_print/printer_job_handler.h" 5 #include "chrome/service/cloud_print/printer_job_handler.h"
6 6
7 #include <memory> 7 #include <memory>
8 8
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/location.h" 10 #include "base/location.h"
11 #include "base/md5.h" 11 #include "base/md5.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/message_loop/message_loop.h" 13 #include "base/message_loop/message_loop.h"
14 #include "base/run_loop.h"
14 #include "base/single_thread_task_runner.h" 15 #include "base/single_thread_task_runner.h"
15 #include "base/strings/stringprintf.h" 16 #include "base/strings/stringprintf.h"
16 #include "base/threading/thread_task_runner_handle.h" 17 #include "base/threading/thread_task_runner_handle.h"
17 #include "chrome/common/cloud_print/cloud_print_constants.h" 18 #include "chrome/common/cloud_print/cloud_print_constants.h"
18 #include "chrome/service/cloud_print/cloud_print_service_helpers.h" 19 #include "chrome/service/cloud_print/cloud_print_service_helpers.h"
19 #include "chrome/service/cloud_print/cloud_print_token_store.h" 20 #include "chrome/service/cloud_print/cloud_print_token_store.h"
20 #include "chrome/service/cloud_print/print_system.h" 21 #include "chrome/service/cloud_print/print_system.h"
21 #include "net/http/http_response_headers.h" 22 #include "net/http/http_response_headers.h"
22 #include "net/http/http_status_code.h" 23 #include "net/http/http_status_code.h"
23 #include "net/url_request/test_url_fetcher_factory.h" 24 #include "net/url_request/test_url_fetcher_factory.h"
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after
611 print_system_.get(), 612 print_system_.get(),
612 &jobhandler_delegate_); 613 &jobhandler_delegate_);
613 614
614 job_handler_->Initialize(); 615 job_handler_->Initialize();
615 616
616 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( 617 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
617 FROM_HERE, base::Bind(&PrinterJobHandlerTest::MessageLoopQuitSoonHelper, 618 FROM_HERE, base::Bind(&PrinterJobHandlerTest::MessageLoopQuitSoonHelper,
618 base::MessageLoop::current()), 619 base::MessageLoop::current()),
619 base::TimeDelta::FromSeconds(timeout_seconds)); 620 base::TimeDelta::FromSeconds(timeout_seconds));
620 621
621 base::MessageLoop::current()->Run(); 622 base::RunLoop().Run();
622 } 623 }
623 624
624 void PrinterJobHandlerTest::SendCapsAndDefaults( 625 void PrinterJobHandlerTest::SendCapsAndDefaults(
625 const std::string& printer_name, 626 const std::string& printer_name,
626 const PrintSystem::PrinterCapsAndDefaultsCallback& callback) { 627 const PrintSystem::PrinterCapsAndDefaultsCallback& callback) {
627 callback.Run(true, printer_name, caps_and_defaults_); 628 callback.Run(true, printer_name, caps_and_defaults_);
628 } 629 }
629 630
630 bool PrinterJobHandlerTest::GetPrinterInfo(printing::PrinterBasicInfo* info) { 631 bool PrinterJobHandlerTest::GetPrinterInfo(printing::PrinterBasicInfo* info) {
631 *info = basic_info_; 632 *info = basic_info_;
632 return true; 633 return true;
633 } 634 }
634 635
635 void PrinterJobHandlerTest::TearDown() { 636 void PrinterJobHandlerTest::TearDown() {
636 IdleOut(); 637 IdleOut();
637 CloudPrintURLFetcher::set_test_factory(nullptr); 638 CloudPrintURLFetcher::set_test_factory(nullptr);
638 } 639 }
639 640
640 void PrinterJobHandlerTest::IdleOut() { 641 void PrinterJobHandlerTest::IdleOut() {
641 base::MessageLoop::current()->RunUntilIdle(); 642 base::RunLoop().RunUntilIdle();
642 } 643 }
643 644
644 MockPrintServerWatcher::MockPrintServerWatcher() : delegate_(NULL) { 645 MockPrintServerWatcher::MockPrintServerWatcher() : delegate_(NULL) {
645 ON_CALL(*this, StartWatching(_)) 646 ON_CALL(*this, StartWatching(_))
646 .WillByDefault(DoAll(SaveArg<0>(&delegate_), Return(true))); 647 .WillByDefault(DoAll(SaveArg<0>(&delegate_), Return(true)));
647 ON_CALL(*this, StopWatching()).WillByDefault(Return(true)); 648 ON_CALL(*this, StopWatching()).WillByDefault(Return(true));
648 } 649 }
649 650
650 651
651 MockPrinterWatcher::MockPrinterWatcher() : delegate_(NULL) { 652 MockPrinterWatcher::MockPrinterWatcher() : delegate_(NULL) {
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
819 .WillOnce(InvokeWithoutArgs( 820 .WillOnce(InvokeWithoutArgs(
820 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs)); 821 this, &PrinterJobHandlerTest::MakeJobFetchReturnNoJobs));
821 822
822 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _)) 823 EXPECT_CALL(url_callback_, OnRequestCreate(TicketURI(1), _))
823 .Times(AtLeast(kNumRetriesBeforeAbandonJob)); 824 .Times(AtLeast(kNumRetriesBeforeAbandonJob));
824 825
825 BeginTest(70); 826 BeginTest(70);
826 } 827 }
827 828
828 } // namespace cloud_print 829 } // namespace cloud_print
OLDNEW
« no previous file with comments | « chrome/service/cloud_print/printer_job_handler.cc ('k') | chrome/service/service_main.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698