| Index: chrome/browser/process_singleton_posix_unittest.cc
|
| diff --git a/chrome/browser/process_singleton_posix_unittest.cc b/chrome/browser/process_singleton_posix_unittest.cc
|
| index 0558d0a21f7d96edd877fb728c3d3302651d587d..9153c1f0e0f11d9b17818d6887cad52743cf8a65 100644
|
| --- a/chrome/browser/process_singleton_posix_unittest.cc
|
| +++ b/chrome/browser/process_singleton_posix_unittest.cc
|
| @@ -160,9 +160,7 @@ class ProcessSingletonPosixTest : public testing::Test {
|
| EXPECT_EQ(cookie, std::string(buf, len));
|
| }
|
|
|
| - ProcessSingleton::NotifyResult NotifyOtherProcess(
|
| - bool override_kill,
|
| - base::TimeDelta timeout) {
|
| + ProcessSingleton::NotifyResult NotifyOtherProcess(bool override_kill) {
|
| scoped_ptr<TestableProcessSingleton> process_singleton(
|
| CreateProcessSingleton());
|
| CommandLine command_line(CommandLine::ForCurrentProcess()->GetProgram());
|
| @@ -176,19 +174,18 @@ class ProcessSingletonPosixTest : public testing::Test {
|
| }
|
|
|
| return process_singleton->NotifyOtherProcessWithTimeout(
|
| - command_line, timeout.InSeconds(), true);
|
| + command_line, kRetryAttempts, timeout(), true);
|
| }
|
|
|
| // A helper method to call ProcessSingleton::NotifyOtherProcessOrCreate().
|
| ProcessSingleton::NotifyResult NotifyOtherProcessOrCreate(
|
| - const std::string& url,
|
| - base::TimeDelta timeout) {
|
| + const std::string& url) {
|
| scoped_ptr<TestableProcessSingleton> process_singleton(
|
| CreateProcessSingleton());
|
| CommandLine command_line(CommandLine::ForCurrentProcess()->GetProgram());
|
| command_line.AppendArg(url);
|
| return process_singleton->NotifyOtherProcessWithTimeoutOrCreate(
|
| - command_line, timeout.InSeconds());
|
| + command_line, kRetryAttempts, timeout());
|
| }
|
|
|
| void CheckNotified() {
|
| @@ -232,6 +229,12 @@ class ProcessSingletonPosixTest : public testing::Test {
|
| int kill_callbacks_;
|
|
|
| private:
|
| + static const int kRetryAttempts = 2;
|
| +
|
| + base::TimeDelta timeout() const {
|
| + return TestTimeouts::tiny_timeout() * kRetryAttempts;
|
| + }
|
| +
|
| void CreateProcessSingletonInternal() {
|
| ASSERT_TRUE(!process_singleton_on_thread_);
|
| process_singleton_on_thread_ = CreateProcessSingleton();
|
| @@ -271,20 +274,16 @@ TEST_F(ProcessSingletonPosixTest, CheckSocketFile) {
|
| // Test success case of NotifyOtherProcess().
|
| TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessSuccess) {
|
| CreateProcessSingletonOnThread();
|
| - EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED,
|
| - NotifyOtherProcess(true, TestTimeouts::action_timeout()));
|
| + EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED, NotifyOtherProcess(true));
|
| CheckNotified();
|
| }
|
|
|
| // Test failure case of NotifyOtherProcess().
|
| -// Disabled, http://crbug.com/407065 .
|
| -TEST_F(ProcessSingletonPosixTest, DISABLED_NotifyOtherProcessFailure) {
|
| +TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessFailure) {
|
| CreateProcessSingletonOnThread();
|
|
|
| BlockWorkerThread();
|
| - EXPECT_EQ(ProcessSingleton::PROCESS_NONE,
|
| - NotifyOtherProcess(true, TestTimeouts::action_timeout()));
|
| -
|
| + EXPECT_EQ(ProcessSingleton::PROCESS_NONE, NotifyOtherProcess(true));
|
| ASSERT_EQ(1, kill_callbacks_);
|
| UnblockWorkerThread();
|
| }
|
| @@ -305,8 +304,7 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessNoSuicide) {
|
| // Remove socket so that we will not be able to notify the existing browser.
|
| EXPECT_EQ(0, unlink(socket_path_.value().c_str()));
|
|
|
| - EXPECT_EQ(ProcessSingleton::PROCESS_NONE,
|
| - NotifyOtherProcess(false, TestTimeouts::action_timeout()));
|
| + EXPECT_EQ(ProcessSingleton::PROCESS_NONE, NotifyOtherProcess(false));
|
| // If we've gotten to this point without killing ourself, the test succeeded.
|
| }
|
|
|
| @@ -317,15 +315,13 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessHostChanged) {
|
| EXPECT_EQ(0, unlink(lock_path_.value().c_str()));
|
| EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str()));
|
|
|
| - EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED,
|
| - NotifyOtherProcess(false, TestTimeouts::action_timeout()));
|
| + EXPECT_EQ(ProcessSingleton::PROCESS_NOTIFIED, NotifyOtherProcess(false));
|
| CheckNotified();
|
| }
|
|
|
| // Test that we fail when lock says process is on another host and we can't
|
| // notify it over the socket.
|
| -// Disabled, http://crbug.com/407065 .
|
| -TEST_F(ProcessSingletonPosixTest, DISABLED_NotifyOtherProcessDifferingHost) {
|
| +TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessDifferingHost) {
|
| CreateProcessSingletonOnThread();
|
|
|
| BlockWorkerThread();
|
| @@ -333,8 +329,7 @@ TEST_F(ProcessSingletonPosixTest, DISABLED_NotifyOtherProcessDifferingHost) {
|
| EXPECT_EQ(0, unlink(lock_path_.value().c_str()));
|
| EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str()));
|
|
|
| - EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE,
|
| - NotifyOtherProcess(false, TestTimeouts::action_timeout()));
|
| + EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, NotifyOtherProcess(false));
|
|
|
| ASSERT_EQ(0, unlink(lock_path_.value().c_str()));
|
|
|
| @@ -343,9 +338,7 @@ TEST_F(ProcessSingletonPosixTest, DISABLED_NotifyOtherProcessDifferingHost) {
|
|
|
| // Test that we fail when lock says process is on another host and we can't
|
| // notify it over the socket.
|
| -// Disabled, http://crbug.com/407065 .
|
| -TEST_F(ProcessSingletonPosixTest,
|
| - DISABLED_NotifyOtherProcessOrCreate_DifferingHost) {
|
| +TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessOrCreate_DifferingHost) {
|
| CreateProcessSingletonOnThread();
|
|
|
| BlockWorkerThread();
|
| @@ -354,8 +347,7 @@ TEST_F(ProcessSingletonPosixTest,
|
| EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str()));
|
|
|
| std::string url("about:blank");
|
| - EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE,
|
| - NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout()));
|
| + EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, NotifyOtherProcessOrCreate(url));
|
|
|
| ASSERT_EQ(0, unlink(lock_path_.value().c_str()));
|
|
|
| @@ -406,8 +398,7 @@ TEST_F(ProcessSingletonPosixTest, NotifyOtherProcessOrCreate_BadCookie) {
|
| EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str()));
|
|
|
| std::string url("about:blank");
|
| - EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE,
|
| - NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout()));
|
| + EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, NotifyOtherProcessOrCreate(url));
|
| }
|
|
|
| #if defined(OS_MACOSX)
|
|
|