| 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/process_singleton.h" | 5 #include "chrome/browser/process_singleton.h" |
| 6 | 6 |
| 7 #include <signal.h> | 7 #include <signal.h> |
| 8 #include <sys/types.h> | 8 #include <sys/types.h> |
| 9 #include <sys/wait.h> | 9 #include <sys/wait.h> |
| 10 #include <unistd.h> | 10 #include <unistd.h> |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 #include "base/threading/thread.h" | 24 #include "base/threading/thread.h" |
| 25 #include "chrome/common/chrome_constants.h" | 25 #include "chrome/common/chrome_constants.h" |
| 26 #include "content/public/test/test_browser_thread.h" | 26 #include "content/public/test/test_browser_thread.h" |
| 27 #include "net/base/net_util.h" | 27 #include "net/base/net_util.h" |
| 28 #include "testing/gtest/include/gtest/gtest.h" | 28 #include "testing/gtest/include/gtest/gtest.h" |
| 29 | 29 |
| 30 using content::BrowserThread; | 30 using content::BrowserThread; |
| 31 | 31 |
| 32 namespace { | 32 namespace { |
| 33 | 33 |
| 34 bool NotificationCallback(const CommandLine& command_line, | |
| 35 const base::FilePath& current_directory) { | |
| 36 return true; | |
| 37 } | |
| 38 | |
| 39 class ProcessSingletonLinuxTest : public testing::Test { | 34 class ProcessSingletonLinuxTest : public testing::Test { |
| 40 public: | 35 public: |
| 41 // A ProcessSingleton exposing some protected methods for testing. | 36 // A ProcessSingleton exposing some protected methods for testing. |
| 42 class TestableProcessSingleton : public ProcessSingleton { | 37 class TestableProcessSingleton : public ProcessSingleton { |
| 43 public: | 38 public: |
| 44 explicit TestableProcessSingleton(const base::FilePath& user_data_dir) | 39 explicit TestableProcessSingleton(const base::FilePath& user_data_dir) |
| 45 : ProcessSingleton( | 40 : ProcessSingleton( |
| 46 user_data_dir, | 41 user_data_dir, |
| 47 base::Bind(&TestableProcessSingleton::NotificationCallback, | 42 base::Bind(&TestableProcessSingleton::NotificationCallback, |
| 48 base::Unretained(this))) {} | 43 base::Unretained(this))) {} |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 389 | 384 |
| 390 // Also change the hostname, so the remote does not retry. | 385 // Also change the hostname, so the remote does not retry. |
| 391 EXPECT_EQ(0, unlink(lock_path_.value().c_str())); | 386 EXPECT_EQ(0, unlink(lock_path_.value().c_str())); |
| 392 EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str())); | 387 EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str())); |
| 393 | 388 |
| 394 std::string url("about:blank"); | 389 std::string url("about:blank"); |
| 395 EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, | 390 EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, |
| 396 NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout())); | 391 NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout())); |
| 397 } | 392 } |
| 398 | 393 |
| OLD | NEW |