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" |
11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
14 #include "base/test/multiprocess_test.h" | 14 #include "base/test/multiprocess_test.h" |
15 #include "base/test/test_timeouts.h" | 15 #include "base/test/test_timeouts.h" |
16 #include "base/time.h" | 16 #include "base/time.h" |
| 17 #include "chrome/browser/operation_output.h" |
17 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" | 18 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" |
18 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 19 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
19 #include "chrome/browser/profiles/profile_keyed_service.h" | 20 #include "chrome/browser/profiles/profile_keyed_service.h" |
20 #include "chrome/browser/service/service_process_control.h" | 21 #include "chrome/browser/service/service_process_control.h" |
21 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 22 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
22 #include "chrome/common/chrome_switches.h" | 23 #include "chrome/common/chrome_switches.h" |
23 #include "chrome/common/pref_names.h" | 24 #include "chrome/common/pref_names.h" |
24 #include "chrome/common/service_messages.h" | 25 #include "chrome/common/service_messages.h" |
25 #include "chrome/common/service_process_util.h" | 26 #include "chrome/common/service_process_util.h" |
26 #include "chrome/service/service_ipc_server.h" | 27 #include "chrome/service/service_ipc_server.h" |
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 301 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
301 return false; | 302 return false; |
302 } | 303 } |
303 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; | 304 virtual void OnChannelConnected(int32 peer_pid) OVERRIDE; |
304 | 305 |
305 // MultiProcessTest implementation. | 306 // MultiProcessTest implementation. |
306 virtual CommandLine MakeCmdLine(const std::string& procname, | 307 virtual CommandLine MakeCmdLine(const std::string& procname, |
307 bool debug_on_start) OVERRIDE; | 308 bool debug_on_start) OVERRIDE; |
308 | 309 |
309 bool LaunchBrowser(const CommandLine& command_line, Profile* profile) { | 310 bool LaunchBrowser(const CommandLine& command_line, Profile* profile) { |
310 int return_code = 0; | |
311 StartupBrowserCreator browser_creator; | 311 StartupBrowserCreator browser_creator; |
312 return StartupBrowserCreator::ProcessCmdLineImpl( | 312 return StartupBrowserCreator::ProcessCmdLineImpl( |
313 command_line, base::FilePath(), false, profile, | 313 command_line, base::FilePath(), false, profile, |
314 StartupBrowserCreator::Profiles(), &return_code, &browser_creator); | 314 StartupBrowserCreator::Profiles(), &browser_creator, |
| 315 scoped_ptr<OperationOutput>()); |
315 } | 316 } |
316 | 317 |
317 protected: | 318 protected: |
318 MessageLoopForUI message_loop_; | 319 MessageLoopForUI message_loop_; |
319 content::TestBrowserThread ui_thread_; | 320 content::TestBrowserThread ui_thread_; |
320 base::Thread io_thread_; | 321 base::Thread io_thread_; |
321 | 322 |
322 std::string startup_channel_id_; | 323 std::string startup_channel_id_; |
323 scoped_ptr<IPC::ChannelProxy> startup_channel_; | 324 scoped_ptr<IPC::ChannelProxy> startup_channel_; |
324 | 325 |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
537 // No expectations on run_loop being true here; that would be a race | 538 // No expectations on run_loop being true here; that would be a race |
538 // condition. | 539 // condition. |
539 if (run_loop) | 540 if (run_loop) |
540 MessageLoop::current()->Run(); | 541 MessageLoop::current()->Run(); |
541 | 542 |
542 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); | 543 EXPECT_EQ("", prefs->GetString(prefs::kCloudPrintEmail)); |
543 | 544 |
544 ShutdownAndWaitForExitWithTimeout(handle); | 545 ShutdownAndWaitForExitWithTimeout(handle); |
545 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); | 546 profile_manager.DeleteTestingProfile("StartBrowserWithPolicy"); |
546 } | 547 } |
OLD | NEW |