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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 static void CloudPrintInfoCallback( | 58 static void CloudPrintInfoCallback( |
59 const cloud_print::CloudPrintProxyInfo& proxy_info) { | 59 const cloud_print::CloudPrintProxyInfo& proxy_info) { |
60 QuitMessageLoop(); | 60 QuitMessageLoop(); |
61 } | 61 } |
62 | 62 |
63 void Disconnect() { | 63 void Disconnect() { |
64 // This will close the IPC connection. | 64 // This will close the IPC connection. |
65 ServiceProcessControl::GetInstance()->Disconnect(); | 65 ServiceProcessControl::GetInstance()->Disconnect(); |
66 } | 66 } |
67 | 67 |
68 virtual void SetUp() override { | 68 void SetUp() override { |
69 // This should not be needed because TearDown() ends with a closed | 69 // This should not be needed because TearDown() ends with a closed |
70 // service_process_, but HistogramsTimeout and Histograms fail without this | 70 // service_process_, but HistogramsTimeout and Histograms fail without this |
71 // on Mac. | 71 // on Mac. |
72 service_process_.Close(); | 72 service_process_.Close(); |
73 } | 73 } |
74 | 74 |
75 virtual void TearDown() override { | 75 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 int exit_code; | 83 int exit_code; |
84 EXPECT_TRUE(service_process_.WaitForExitWithTimeout( | 84 EXPECT_TRUE(service_process_.WaitForExitWithTimeout( |
85 TestTimeouts::action_max_timeout(), &exit_code)); | 85 TestTimeouts::action_max_timeout(), &exit_code)); |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 // Callback should not be called during GetHistograms call. | 282 // Callback should not be called during GetHistograms call. |
283 EXPECT_CALL(*this, MockHistogramsCallback()).Times(0); | 283 EXPECT_CALL(*this, MockHistogramsCallback()).Times(0); |
284 // Wait for real callback by providing large timeout value. | 284 // Wait for real callback by providing large timeout value. |
285 EXPECT_TRUE(ServiceProcessControl::GetInstance()->GetHistograms( | 285 EXPECT_TRUE(ServiceProcessControl::GetInstance()->GetHistograms( |
286 base::Bind(&ServiceProcessControlBrowserTest::HistogramsCallback, | 286 base::Bind(&ServiceProcessControlBrowserTest::HistogramsCallback, |
287 base::Unretained(this)), | 287 base::Unretained(this)), |
288 base::TimeDelta::FromHours(1))); | 288 base::TimeDelta::FromHours(1))); |
289 EXPECT_CALL(*this, MockHistogramsCallback()).Times(1); | 289 EXPECT_CALL(*this, MockHistogramsCallback()).Times(1); |
290 content::RunMessageLoop(); | 290 content::RunMessageLoop(); |
291 } | 291 } |
OLD | NEW |