Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(116)

Side by Side Diff: chrome/browser/service/service_process_control_browsertest.cc

Issue 6349029: Get service processes working on Mac and Linux. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix up small typo in comment Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/service/service_process_control.cc ('k') | chrome/common/service_process_util.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 process_ = NULL; 64 process_ = NULL;
65 } 65 }
66 66
67 void WaitForShutdown() { 67 void WaitForShutdown() {
68 EXPECT_TRUE(base::WaitForSingleProcess( 68 EXPECT_TRUE(base::WaitForSingleProcess(
69 service_process_handle_, 69 service_process_handle_,
70 TestTimeouts::wait_for_terminate_timeout_ms())); 70 TestTimeouts::wait_for_terminate_timeout_ms()));
71 } 71 }
72 72
73 void ProcessControlLaunched() { 73 void ProcessControlLaunched() {
74 base::ProcessId service_pid = GetServiceProcessPid(); 74 base::ProcessId service_pid;
75 EXPECT_TRUE(GetServiceProcessSharedData(NULL, &service_pid));
75 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid); 76 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid);
76 EXPECT_TRUE(base::OpenProcessHandleWithAccess( 77 EXPECT_TRUE(base::OpenProcessHandleWithAccess(
77 service_pid, 78 service_pid,
78 base::kProcessAccessWaitForTermination, 79 base::kProcessAccessWaitForTermination,
79 &service_process_handle_)); 80 &service_process_handle_));
80 // Quit the current message. Post a QuitTask instead of just calling Quit() 81 // Quit the current message. Post a QuitTask instead of just calling Quit()
81 // because this can get invoked in the context of a Launch() call and we 82 // because this can get invoked in the context of a Launch() call and we
82 // may not be in Run() yet. 83 // may not be in Run() yet.
83 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 84 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
84 } 85 }
85 86
86 void ProcessControlLaunchFailed() { 87 void ProcessControlLaunchFailed() {
87 ADD_FAILURE(); 88 ADD_FAILURE();
88 // Quit the current message. 89 // Quit the current message.
89 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask()); 90 MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
90 } 91 }
91 92
92 ServiceProcessControl* process() { return process_; } 93 ServiceProcessControl* process() { return process_; }
93 94
94 private: 95 private:
95 ServiceProcessControl* process_; 96 ServiceProcessControl* process_;
96 base::ProcessHandle service_process_handle_; 97 base::ProcessHandle service_process_handle_;
97 }; 98 };
98 99
99 #if defined(OS_WIN)
100 // They way that the IPC is implemented only works on windows. This has to 100 // They way that the IPC is implemented only works on windows. This has to
101 // change when we implement a different scheme for IPC. 101 // change when we implement a different scheme for IPC.
102 // Times out flakily, http://crbug.com/70076. 102 // Times out flakily, http://crbug.com/70076.
103 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, 103 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest,
104 DISABLED_LaunchAndIPC) { 104 DISABLED_LaunchAndIPC) {
105 LaunchServiceProcessControl(); 105 LaunchServiceProcessControl();
106 106
107 // Make sure we are connected to the service process. 107 // Make sure we are connected to the service process.
108 EXPECT_TRUE(process()->is_connected()); 108 EXPECT_TRUE(process()->is_connected());
109 SendRequestAndWait(); 109 SendRequestAndWait();
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
186 WaitForShutdown(); 186 WaitForShutdown();
187 } 187 }
188 188
189 //http://code.google.com/p/chromium/issues/detail?id=70793 189 //http://code.google.com/p/chromium/issues/detail?id=70793
190 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, 190 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest,
191 DISABLED_ForceShutdown) { 191 DISABLED_ForceShutdown) {
192 // Launch the service process. 192 // Launch the service process.
193 LaunchServiceProcessControl(); 193 LaunchServiceProcessControl();
194 // Make sure we are connected to the service process. 194 // Make sure we are connected to the service process.
195 EXPECT_TRUE(process()->is_connected()); 195 EXPECT_TRUE(process()->is_connected());
196 base::ProcessId service_pid;
197 EXPECT_TRUE(GetServiceProcessSharedData(NULL, &service_pid));
198 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid);
196 chrome::VersionInfo version_info; 199 chrome::VersionInfo version_info;
197 ForceServiceProcessShutdown(version_info.Version()); 200 ForceServiceProcessShutdown(version_info.Version(), service_pid);
198 WaitForShutdown(); 201 WaitForShutdown();
199 } 202 }
200 203
201 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, CheckPid) { 204 IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, CheckPid) {
202 EXPECT_EQ(0, GetServiceProcessPid()); 205 base::ProcessId service_pid;
206 EXPECT_FALSE(GetServiceProcessSharedData(NULL, &service_pid));
203 // Launch the service process. 207 // Launch the service process.
204 LaunchServiceProcessControl(); 208 LaunchServiceProcessControl();
205 EXPECT_NE(static_cast<base::ProcessId>(0), GetServiceProcessPid()); 209 EXPECT_TRUE(GetServiceProcessSharedData(NULL, &service_pid));
210 EXPECT_NE(static_cast<base::ProcessId>(0), service_pid);
206 } 211 }
207 212
208 #endif
209
210 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControlBrowserTest); 213 DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControlBrowserTest);
OLDNEW
« no previous file with comments | « chrome/browser/service/service_process_control.cc ('k') | chrome/common/service_process_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698