| 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 #include "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
| 7 #include "base/process_util.h" | 7 #include "base/process_util.h" |
| 8 #include "base/test/test_timeouts.h" | 8 #include "base/test/test_timeouts.h" |
| 9 #include "chrome/browser/service/service_process_control.h" | 9 #include "chrome/browser/service/service_process_control.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 } | 59 } |
| 60 | 60 |
| 61 void Disconnect() { | 61 void Disconnect() { |
| 62 // This will close the IPC connection. | 62 // This will close the IPC connection. |
| 63 ServiceProcessControl::GetInstance()->Disconnect(); | 63 ServiceProcessControl::GetInstance()->Disconnect(); |
| 64 } | 64 } |
| 65 | 65 |
| 66 void WaitForShutdown() { | 66 void WaitForShutdown() { |
| 67 EXPECT_TRUE(base::WaitForSingleProcess( | 67 EXPECT_TRUE(base::WaitForSingleProcess( |
| 68 service_process_handle_, | 68 service_process_handle_, |
| 69 TestTimeouts::action_max_timeout_ms())); | 69 TestTimeouts::action_max_timeout())); |
| 70 } | 70 } |
| 71 | 71 |
| 72 void ProcessControlLaunched() { | 72 void ProcessControlLaunched() { |
| 73 base::ProcessId service_pid; | 73 base::ProcessId service_pid; |
| 74 EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); | 74 EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); |
| 75 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); | 75 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); |
| 76 EXPECT_TRUE(base::OpenProcessHandleWithAccess( | 76 EXPECT_TRUE(base::OpenProcessHandleWithAccess( |
| 77 service_pid, | 77 service_pid, |
| 78 base::kProcessAccessWaitForTermination | | 78 base::kProcessAccessWaitForTermination | |
| 79 // we need query permission to get exit code | 79 // we need query permission to get exit code |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, CheckPid) { | 198 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, CheckPid) { |
| 199 base::ProcessId service_pid; | 199 base::ProcessId service_pid; |
| 200 EXPECT_FALSE(GetServiceProcessData(NULL, &service_pid)); | 200 EXPECT_FALSE(GetServiceProcessData(NULL, &service_pid)); |
| 201 // Launch the service process. | 201 // Launch the service process. |
| 202 LaunchServiceProcessControl(); | 202 LaunchServiceProcessControl(); |
| 203 EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); | 203 EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); |
| 204 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); | 204 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); |
| 205 // Disconnect from service process. | 205 // Disconnect from service process. |
| 206 ServiceProcessControl::GetInstance()->Disconnect(); | 206 ServiceProcessControl::GetInstance()->Disconnect(); |
| 207 } | 207 } |
| OLD | NEW |