| OLD | NEW |
| 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/location.h" |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 waiting_(false) { | 282 waiting_(false) { |
| 283 } | 283 } |
| 284 | 284 |
| 285 ~TestMessageLoopCondition() { | 285 ~TestMessageLoopCondition() { |
| 286 } | 286 } |
| 287 | 287 |
| 288 // Signal a waiting method that it can continue executing. | 288 // Signal a waiting method that it can continue executing. |
| 289 void Signal() { | 289 void Signal() { |
| 290 signaled_ = true; | 290 signaled_ = true; |
| 291 if (waiting_) | 291 if (waiting_) |
| 292 base::MessageLoop::current()->Quit(); | 292 base::MessageLoop::current()->QuitWhenIdle(); |
| 293 } | 293 } |
| 294 | 294 |
| 295 // Pause execution and recursively run the message loop until |Signal()| is | 295 // Pause execution and recursively run the message loop until |Signal()| is |
| 296 // called. Do not pause if |Signal()| has already been called. | 296 // called. Do not pause if |Signal()| has already been called. |
| 297 void Wait() { | 297 void Wait() { |
| 298 while (!signaled_) { | 298 while (!signaled_) { |
| 299 waiting_ = true; | 299 waiting_ = true; |
| 300 base::MessageLoop::current()->Run(); | 300 base::MessageLoop::current()->Run(); |
| 301 waiting_ = false; | 301 waiting_ = false; |
| 302 } | 302 } |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 // kLoginUser instead. | 430 // kLoginUser instead. |
| 431 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, | 431 command_line->AppendSwitchASCII(chromeos::switches::kLoginUser, |
| 432 kSampleUser); | 432 kSampleUser); |
| 433 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, | 433 command_line->AppendSwitchASCII(chromeos::switches::kLoginProfile, |
| 434 chrome::kTestUserProfileDir); | 434 chrome::kTestUserProfileDir); |
| 435 #endif | 435 #endif |
| 436 WebUIBrowserTest::SetUpCommandLine(command_line); | 436 WebUIBrowserTest::SetUpCommandLine(command_line); |
| 437 } | 437 } |
| 438 | 438 |
| 439 void RunFor(base::TimeDelta time_period) { | 439 void RunFor(base::TimeDelta time_period) { |
| 440 base::CancelableCallback<void()> callback(base::Bind( | 440 base::CancelableCallback<void()> callback( |
| 441 &base::MessageLoop::Quit, base::Unretained( | 441 base::Bind(&base::MessageLoop::QuitWhenIdle, |
| 442 base::MessageLoop::current()))); | 442 base::Unretained(base::MessageLoop::current()))); |
| 443 base::MessageLoop::current()->task_runner()->PostDelayedTask( | 443 base::MessageLoop::current()->task_runner()->PostDelayedTask( |
| 444 FROM_HERE, callback.callback(), time_period); | 444 FROM_HERE, callback.callback(), time_period); |
| 445 | 445 |
| 446 base::MessageLoop::current()->Run(); | 446 base::MessageLoop::current()->Run(); |
| 447 callback.Cancel(); | 447 callback.Cancel(); |
| 448 } | 448 } |
| 449 | 449 |
| 450 TestServiceDiscoveryClient* test_service_discovery_client() { | 450 TestServiceDiscoveryClient* test_service_discovery_client() { |
| 451 return test_service_discovery_client_.get(); | 451 return test_service_discovery_client_.get(); |
| 452 } | 452 } |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); | 566 kAnnouncePacketRegistered, sizeof(kAnnouncePacketRegistered)); |
| 567 | 567 |
| 568 base::MessageLoop::current()->RunUntilIdle(); | 568 base::MessageLoop::current()->RunUntilIdle(); |
| 569 | 569 |
| 570 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); | 570 EXPECT_TRUE(WebUIBrowserTest::RunJavascriptTest("expectRegisterDone")); |
| 571 } | 571 } |
| 572 | 572 |
| 573 } // namespace | 573 } // namespace |
| 574 | 574 |
| 575 } // namespace local_discovery | 575 } // namespace local_discovery |
| OLD | NEW |