From b35ca29a5cd2faee6395a5fc14779ccc01bd3b47 Mon Sep 17 00:00:00 2001 From: "sanjeevr@chromium.org" <sanjeevr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> Date: Tue, 12 Oct 2010 01:44:25 +0000 Subject: Added the service process pid to the shared memory data. This will be used for tests. Also cleaned up some of the method names in service_process_utils.cc to make them clearer. BUG=None. TEST=Browser tests. Review URL: http://codereview.chromium.org/3727002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@62223 0039d316-1c4b-4281-b951-d872f2087c98 --- chrome/browser/service/service_process_control.cc | 4 ++-- chrome/browser/service/service_process_control_browsertest.cc | 11 ++++++++++- 2 files changed, 12 insertions(+), 3 deletions(-) (limited to 'chrome/browser/service') diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc index acccbda..ad3c326 100644 --- a/chrome/browser/service/service_process_control.cc +++ b/chrome/browser/service/service_process_control.cc @@ -54,7 +54,7 @@ class ServiceProcessControl::Launcher void DoDetectLaunched(Task* task) { const uint32 kMaxLaunchDetectRetries = 10; - launched_ = CheckServiceProcessRunning(); + launched_ = CheckServiceProcessReady(); if (launched_ || (retry_count_ >= kMaxLaunchDetectRetries)) { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, NewRunnableMethod(this, &Launcher::Notify, task)); @@ -130,7 +130,7 @@ void ServiceProcessControl::Launch(Task* task) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); // If the service process is already running then connects to it. - if (CheckServiceProcessRunning()) { + if (CheckServiceProcessReady()) { ConnectInternal(task); return; } diff --git a/chrome/browser/service/service_process_control_browsertest.cc b/chrome/browser/service/service_process_control_browsertest.cc index 5c59e87..c9038e6 100644 --- a/chrome/browser/service/service_process_control_browsertest.cc +++ b/chrome/browser/service/service_process_control_browsertest.cc @@ -47,6 +47,8 @@ class ServiceProcessControlBrowserTest void WaitForShutdown() { // We will keep trying every second till we hit the terminate timeout. + // TODO(sanjeevr): Use GetServiceProcessPid() to wait for termination. + // Will do this in a separate CL. int retries_left = TestTimeouts::wait_for_terminate_timeout_ms()/1000; MessageLoop::current()->PostDelayedTask( FROM_HERE, @@ -58,7 +60,7 @@ class ServiceProcessControlBrowserTest } void DoDetectShutdown(int retries_left) { - bool service_is_running = CheckServiceProcessRunning(); + bool service_is_running = CheckServiceProcessReady(); if (!retries_left) EXPECT_FALSE(service_is_running); if (retries_left && service_is_running) { @@ -148,6 +150,13 @@ IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, ForceShutdown) { WaitForShutdown(); } +IN_PROC_BROWSER_TEST_F(ServiceProcessControlBrowserTest, CheckPid) { + EXPECT_EQ(0, GetServiceProcessPid()); + // Launch the service process. + LaunchServiceProcessControl(); + EXPECT_NE(static_cast<base::ProcessId>(0), GetServiceProcessPid()); +} + #endif DISABLE_RUNNABLE_METHOD_REFCOUNT(ServiceProcessControlBrowserTest); -- cgit v1.1