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 "chrome/browser/service_process/service_process_control.h" | 5 #include "chrome/browser/service_process/service_process_control.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 } | 73 } |
74 | 74 |
75 virtual void TearDown() override { | 75 virtual void TearDown() override { |
76 if (ServiceProcessControl::GetInstance()->IsConnected()) | 76 if (ServiceProcessControl::GetInstance()->IsConnected()) |
77 EXPECT_TRUE(ServiceProcessControl::GetInstance()->Shutdown()); | 77 EXPECT_TRUE(ServiceProcessControl::GetInstance()->Shutdown()); |
78 #if defined(OS_MACOSX) | 78 #if defined(OS_MACOSX) |
79 // ForceServiceProcessShutdown removes the process from launched on Mac. | 79 // ForceServiceProcessShutdown removes the process from launched on Mac. |
80 ForceServiceProcessShutdown("", 0); | 80 ForceServiceProcessShutdown("", 0); |
81 #endif // OS_MACOSX | 81 #endif // OS_MACOSX |
82 if (service_process_.IsValid()) { | 82 if (service_process_.IsValid()) { |
83 EXPECT_TRUE(base::WaitForSingleProcess( | 83 int exit_code; |
84 service_process_.Handle(), | 84 EXPECT_TRUE(service_process_.WaitForExitWithTimeout( |
85 TestTimeouts::action_max_timeout())); | 85 TestTimeouts::action_max_timeout(), &exit_code)); |
| 86 EXPECT_EQ(0, exit_code); |
86 service_process_.Close(); | 87 service_process_.Close(); |
87 } | 88 } |
88 } | 89 } |
89 | 90 |
90 void ProcessControlLaunched() { | 91 void ProcessControlLaunched() { |
91 base::ProcessId service_pid; | 92 base::ProcessId service_pid; |
92 EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); | 93 EXPECT_TRUE(GetServiceProcessData(NULL, &service_pid)); |
93 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); | 94 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); |
94 #if defined(OS_WIN) | 95 #if defined(OS_WIN) |
95 service_process_ = | 96 service_process_ = |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
281 // Callback should not be called during GetHistograms call. | 282 // Callback should not be called during GetHistograms call. |
282 EXPECT_CALL(*this, MockHistogramsCallback()).Times(0); | 283 EXPECT_CALL(*this, MockHistogramsCallback()).Times(0); |
283 // Wait for real callback by providing large timeout value. | 284 // Wait for real callback by providing large timeout value. |
284 EXPECT_TRUE(ServiceProcessControl::GetInstance()->GetHistograms( | 285 EXPECT_TRUE(ServiceProcessControl::GetInstance()->GetHistograms( |
285 base::Bind(&ServiceProcessControlBrowserTest::HistogramsCallback, | 286 base::Bind(&ServiceProcessControlBrowserTest::HistogramsCallback, |
286 base::Unretained(this)), | 287 base::Unretained(this)), |
287 base::TimeDelta::FromHours(1))); | 288 base::TimeDelta::FromHours(1))); |
288 EXPECT_CALL(*this, MockHistogramsCallback()).Times(1); | 289 EXPECT_CALL(*this, MockHistogramsCallback()).Times(1); |
289 content::RunMessageLoop(); | 290 content::RunMessageLoop(); |
290 } | 291 } |
OLD | NEW |