| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/process_util.h" | 5 #include "base/process_util.h" |
| 6 #include "base/test/test_timeouts.h" | 6 #include "base/test/test_timeouts.h" |
| 7 #include "chrome/browser/service/service_process_control.h" | 7 #include "chrome/browser/service/service_process_control.h" |
| 8 #include "chrome/browser/service/service_process_control_manager.h" | 8 #include "chrome/browser/service/service_process_control_manager.h" |
| 9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/common/chrome_version_info.h" | 10 #include "chrome/common/chrome_version_info.h" |
| 11 #include "chrome/common/service_process_util.h" | 11 #include "chrome/common/service_process_util.h" |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 this, | 45 this, |
| 46 &ServiceProcessControlBrowserTest::ProcessControlLaunched), | 46 &ServiceProcessControlBrowserTest::ProcessControlLaunched), |
| 47 NewRunnableMethod( | 47 NewRunnableMethod( |
| 48 this, | 48 this, |
| 49 &ServiceProcessControlBrowserTest::ProcessControlLaunchFailed)); | 49 &ServiceProcessControlBrowserTest::ProcessControlLaunchFailed)); |
| 50 | 50 |
| 51 // Then run the message loop to keep things running. | 51 // Then run the message loop to keep things running. |
| 52 ui_test_utils::RunMessageLoop(); | 52 ui_test_utils::RunMessageLoop(); |
| 53 } | 53 } |
| 54 | 54 |
| 55 // Send a remoting host status request and wait reply from the service. | 55 // Send a Cloud Print status request and wait for a reply from the service. |
| 56 void SendRequestAndWait() { | 56 void SendRequestAndWait() { |
| 57 process()->GetCloudPrintProxyStatus(NewCallback( | 57 process()->GetCloudPrintProxyStatus(NewCallback( |
| 58 this, &ServiceProcessControlBrowserTest::CloudPrintStatusCallback)); | 58 this, &ServiceProcessControlBrowserTest::CloudPrintStatusCallback)); |
| 59 ui_test_utils::RunMessageLoop(); | 59 ui_test_utils::RunMessageLoop(); |
| 60 } | 60 } |
| 61 | 61 |
| 62 void CloudPrintStatusCallback( | 62 void CloudPrintStatusCallback( |
| 63 bool enabled, std::string email) { | 63 bool enabled, std::string email) { |
| 64 MessageLoop::current()->Quit(); | 64 MessageLoop::current()->Quit(); |
| 65 } | 65 } |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 LaunchServiceProcessControl(); | 112 LaunchServiceProcessControl(); |
| 113 | 113 |
| 114 // Make sure we are connected to the service process. | 114 // Make sure we are connected to the service process. |
| 115 EXPECT_TRUE(process()->is_connected()); | 115 EXPECT_TRUE(process()->is_connected()); |
| 116 SendRequestAndWait(); | 116 SendRequestAndWait(); |
| 117 | 117 |
| 118 // And then shutdown the service process. | 118 // And then shutdown the service process. |
| 119 EXPECT_TRUE(process()->Shutdown()); | 119 EXPECT_TRUE(process()->Shutdown()); |
| 120 } | 120 } |
| 121 | 121 |
| 122 // This tests the case when a service process is launched when browser | 122 // This tests the case when a service process is launched when the browser |
| 123 // starts but we try to launch it again in the remoting setup dialog. | 123 // starts but we try to launch it again while setting up Cloud Print. |
| 124 // Crashes on mac. http://crbug.com/75518 | 124 // Crashes on mac. http://crbug.com/75518 |
| 125 #if defined(OS_MACOSX) | 125 #if defined(OS_MACOSX) |
| 126 #define MAYBE_LaunchTwice DISABLED_LaunchTwice | 126 #define MAYBE_LaunchTwice DISABLED_LaunchTwice |
| 127 #else | 127 #else |
| 128 #define MAYBE_LaunchTwice LaunchTwice | 128 #define MAYBE_LaunchTwice LaunchTwice |
| 129 #endif | 129 #endif |
| 130 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, MAYBE_LaunchTwice) { | 130 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, MAYBE_LaunchTwice) { |
| 131 // Launch the service process the first time. | 131 // Launch the service process the first time. |
| 132 LaunchServiceProcessControl(); | 132 LaunchServiceProcessControl(); |
| 133 | 133 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, MAYBE_CheckPid) { | 243 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, MAYBE_CheckPid) { |
| 244 base::ProcessId service_pid; | 244 base::ProcessId service_pid; |
| 245 EXPECT_FALSE(GetServiceProcessData(NULL, &service_pid)); | 245 EXPECT_FALSE(GetServiceProcessData(NULL, &service_pid)); |
| 246 // Launch the service process. | 246 // Launch the service process. |
| 247 LaunchServiceProcessControl(); | 247 LaunchServiceProcessControl(); |
| 248 EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); | 248 EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); |
| 249 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); | 249 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); |
| 250 } | 250 } |
| 251 | 251 |
| 252 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControlBrowserTest); | 252 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControlBrowserTest); |
| OLD | NEW |