| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Create a service process that uses a Mock to respond to the browser in order | 5 // Create a service process that uses a Mock to respond to the browser in order |
| 6 // to test launching the browser using the cloud print policy check command | 6 // to test launching the browser using the cloud print policy check command |
| 7 // line switch. | 7 // line switch. |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 void Wait() { | 357 void Wait() { |
| 358 if (seen_) | 358 if (seen_) |
| 359 return; | 359 return; |
| 360 running_ = true; | 360 running_ = true; |
| 361 content::RunMessageLoop(); | 361 content::RunMessageLoop(); |
| 362 } | 362 } |
| 363 | 363 |
| 364 void Notify() { | 364 void Notify() { |
| 365 seen_ = true; | 365 seen_ = true; |
| 366 if (running_) | 366 if (running_) |
| 367 base::MessageLoopForUI::current()->Quit(); | 367 base::MessageLoopForUI::current()->QuitWhenIdle(); |
| 368 } | 368 } |
| 369 | 369 |
| 370 private: | 370 private: |
| 371 bool seen_; | 371 bool seen_; |
| 372 bool running_; | 372 bool running_; |
| 373 }; | 373 }; |
| 374 | 374 |
| 375 WindowedChannelConnectionObserver observer_; | 375 WindowedChannelConnectionObserver observer_; |
| 376 }; | 376 }; |
| 377 | 377 |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 511 // LocalState for the BrowserProcess. Must be created before profiles are | 511 // LocalState for the BrowserProcess. Must be created before profiles are |
| 512 // constructed. | 512 // constructed. |
| 513 chrome::TestingIOThreadState testing_io_thread_state; | 513 chrome::TestingIOThreadState testing_io_thread_state; |
| 514 | 514 |
| 515 base::Process process = | 515 base::Process process = |
| 516 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); | 516 Launch("CloudPrintMockService_StartEnabledWaitForQuit"); |
| 517 WaitForConnect(); | 517 WaitForConnect(); |
| 518 ShutdownAndWaitForExitWithTimeout(process.Pass()); | 518 ShutdownAndWaitForExitWithTimeout(process.Pass()); |
| 519 content::RunAllPendingInMessageLoop(); | 519 content::RunAllPendingInMessageLoop(); |
| 520 } | 520 } |
| OLD | NEW |