diff options
author | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-05 07:15:39 +0000 |
---|---|---|
committer | erikwright@chromium.org <erikwright@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-04-05 07:15:39 +0000 |
commit | 5d36454f5026efa282a02ab18a2dc7a7c02379a9 (patch) | |
tree | 08b61b23c981c876d87658be3385c77c3a662e23 /chrome/browser/process_singleton_mac_unittest.cc | |
parent | fb4741491e10e74f658432a481f8fc0a0896447f (diff) | |
download | chromium_src-5d36454f5026efa282a02ab18a2dc7a7c02379a9.zip chromium_src-5d36454f5026efa282a02ab18a2dc7a7c02379a9.tar.gz chromium_src-5d36454f5026efa282a02ab18a2dc7a7c02379a9.tar.bz2 |
Refactor ProcessSingleton so that it may be used distinctly from a full browser process.
The main effect is that ProcessSingleton is much more restricted to its basic functionality, which is to ensure that a single instance of Chrome runs per profile directory and to pass messages from new Chrome invocations to the existing instance.
Exactly how those messages were handled has been moved from the implementations of ProcessSingleton into ChromeBrowserMain where (I think) it more rightly belongs.
This will allow the Chrome Frame net tests to use ProcessSingleton to implement a stub Chrome for the purpose of handling network-related IPC from Chrome Frame without having to launch the rest of Chrome, upon which ProcessSingleton previously depended directly.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/9968053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@130853 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/process_singleton_mac_unittest.cc')
-rw-r--r-- | chrome/browser/process_singleton_mac_unittest.cc | 30 |
1 files changed, 19 insertions, 11 deletions
diff --git a/chrome/browser/process_singleton_mac_unittest.cc b/chrome/browser/process_singleton_mac_unittest.cc index 41dbdf2..680b04c 100644 --- a/chrome/browser/process_singleton_mac_unittest.cc +++ b/chrome/browser/process_singleton_mac_unittest.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -69,7 +69,7 @@ class ProcessSingletonMacTest : public PlatformTest { TEST_F(ProcessSingletonMacTest, Basic) { ProcessSingleton ps(temp_dir_.path()); EXPECT_FALSE(IsLocked()); - EXPECT_TRUE(ps.Create()); + EXPECT_TRUE(ps.Create(ProcessSingleton::NotificationCallback())); EXPECT_TRUE(IsLocked()); ps.Cleanup(); EXPECT_FALSE(IsLocked()); @@ -80,7 +80,7 @@ TEST_F(ProcessSingletonMacTest, DestructorReleases) { EXPECT_FALSE(IsLocked()); { ProcessSingleton ps(temp_dir_.path()); - EXPECT_TRUE(ps.Create()); + EXPECT_TRUE(ps.Create(ProcessSingleton::NotificationCallback())); EXPECT_TRUE(IsLocked()); } EXPECT_FALSE(IsLocked()); @@ -99,16 +99,16 @@ TEST_F(ProcessSingletonMacTest, Interlock) { // When |ps1| has the lock, |ps2| cannot get it. EXPECT_FALSE(IsLocked()); - EXPECT_TRUE(ps1.Create()); + EXPECT_TRUE(ps1.Create(ProcessSingleton::NotificationCallback())); EXPECT_TRUE(IsLocked()); - EXPECT_FALSE(ps2.Create()); + EXPECT_FALSE(ps2.Create(ProcessSingleton::NotificationCallback())); ps1.Cleanup(); // And when |ps2| has the lock, |ps1| cannot get it. EXPECT_FALSE(IsLocked()); - EXPECT_TRUE(ps2.Create()); + EXPECT_TRUE(ps2.Create(ProcessSingleton::NotificationCallback())); EXPECT_TRUE(IsLocked()); - EXPECT_FALSE(ps1.Create()); + EXPECT_FALSE(ps1.Create(ProcessSingleton::NotificationCallback())); ps2.Cleanup(); EXPECT_FALSE(IsLocked()); } @@ -126,16 +126,24 @@ TEST_F(ProcessSingletonMacTest, NotifyOtherProcessOrCreate) { // When |ps1| has the lock, |ps2| cannot get it. EXPECT_FALSE(IsLocked()); - EXPECT_EQ(ProcessSingleton::PROCESS_NONE, ps1.NotifyOtherProcessOrCreate()); + EXPECT_EQ( + ProcessSingleton::PROCESS_NONE, + ps1.NotifyOtherProcessOrCreate(ProcessSingleton::NotificationCallback())); EXPECT_TRUE(IsLocked()); - EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, ps2.NotifyOtherProcessOrCreate()); + EXPECT_EQ( + ProcessSingleton::PROFILE_IN_USE, + ps2.NotifyOtherProcessOrCreate(ProcessSingleton::NotificationCallback())); ps1.Cleanup(); // And when |ps2| has the lock, |ps1| cannot get it. EXPECT_FALSE(IsLocked()); - EXPECT_EQ(ProcessSingleton::PROCESS_NONE, ps2.NotifyOtherProcessOrCreate()); + EXPECT_EQ( + ProcessSingleton::PROCESS_NONE, + ps2.NotifyOtherProcessOrCreate(ProcessSingleton::NotificationCallback())); EXPECT_TRUE(IsLocked()); - EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, ps1.NotifyOtherProcessOrCreate()); + EXPECT_EQ( + ProcessSingleton::PROFILE_IN_USE, + ps1.NotifyOtherProcessOrCreate(ProcessSingleton::NotificationCallback())); ps2.Cleanup(); EXPECT_FALSE(IsLocked()); } |