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

Side by Side Diff: chrome/browser/ui/webui/local_discovery/local_discovery_ui_browsertest.cc

Issue 1160073004: chrome/browser/ui: Remove use of MessageLoopProxy and deprecated MessageLoop APIs (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Check for task runner instead of current message loop. Created 5 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/bind.h" 6 #include "base/bind.h"
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/location.h"
10 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/thread_task_runner_handle.h"
12 #include "chrome/browser/local_discovery/test_service_discovery_client.h" 14 #include "chrome/browser/local_discovery/test_service_discovery_client.h"
13 #include "chrome/browser/profiles/profile.h" 15 #include "chrome/browser/profiles/profile.h"
14 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h" 16 #include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
15 #include "chrome/browser/signin/signin_manager_factory.h" 17 #include "chrome/browser/signin/signin_manager_factory.h"
16 #include "chrome/browser/ui/browser.h" 18 #include "chrome/browser/ui/browser.h"
17 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h" 19 #include "chrome/browser/ui/webui/local_discovery/local_discovery_ui_handler.h"
18 #include "chrome/common/chrome_constants.h" 20 #include "chrome/common/chrome_constants.h"
19 #include "chrome/common/chrome_switches.h" 21 #include "chrome/common/chrome_switches.h"
20 #include "chrome/common/url_constants.h" 22 #include "chrome/common/url_constants.h"
21 #include "chrome/test/base/ui_test_utils.h" 23 #include "chrome/test/base/ui_test_utils.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, 434 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser,
433 kSampleUser); 435 kSampleUser);
434 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, 436 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile,
435 chrome::kTestUserProfileDir); 437 chrome::kTestUserProfileDir);
436 #endif 438 #endif
437 WebUIBrowserTest::SetUpCommandLine(command_line); 439 WebUIBrowserTest::SetUpCommandLine(command_line);
438 } 440 }
439 441
440 void RunFor(base::TimeDelta time_period) { 442 void RunFor(base::TimeDelta time_period) {
441 base::CancelableCallback<void()> callback(base::Bind( 443 base::CancelableCallback<void()> callback(base::Bind(
442 &base::MessageLoop::Quit, base::Unretained( 444 &base::MessageLoop::Quit, base::Unretained(
msw 2015/06/10 00:12:58 Is this and base::MessageLoop::current() here and
Sami 2015/06/10 12:35:34 Yes, both MessageLoop::current and ThreadTaskRunne
msw 2015/06/10 19:34:00 Again, it seems odd to use inconsistent terminolog
443 base::MessageLoop::current()))); 445 base::MessageLoop::current())));
444 base::MessageLoop::current()->PostDelayedTask( 446 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask(
445 FROM_HERE, callback.callback(), time_period); 447 FROM_HERE, callback.callback(), time_period);
446 448
447 base::MessageLoop::current()->Run(); 449 base::MessageLoop::current()->Run();
448 callback.Cancel(); 450 callback.Cancel();
449 } 451 }
450 452
451 TestServiceDiscoveryClient* test_service_discovery_client() { 453 TestServiceDiscoveryClient* test_service_discovery_client() {
452 return test_service_discovery_client_.get(); 454 return test_service_discovery_client_.get();
453 } 455 }
454 456
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); 569 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered));
568 570
569 base::MessageLoop::current()->RunUntilIdle(); 571 base::MessageLoop::current()->RunUntilIdle();
570 572
571 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); 573 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone"));
572 } 574 }
573 575
574 } // namespace 576 } // namespace
575 577
576 } // namespace local_discovery 578 } // namespace local_discovery
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698