| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <fcntl.h> | 7 #include <fcntl.h> |
| 8 #include <signal.h> | 8 #include <signal.h> |
| 9 #include <stddef.h> |
| 9 #include <sys/types.h> | 10 #include <sys/types.h> |
| 10 #include <sys/un.h> | 11 #include <sys/un.h> |
| 11 #include <sys/wait.h> | 12 #include <sys/wait.h> |
| 12 #include <unistd.h> | 13 #include <unistd.h> |
| 13 | 14 |
| 14 #include <string> | 15 #include <string> |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 #include "base/bind.h" | 18 #include "base/bind.h" |
| 18 #include "base/command_line.h" | 19 #include "base/command_line.h" |
| 19 #include "base/files/file_path.h" | 20 #include "base/files/file_path.h" |
| 20 #include "base/files/file_util.h" | 21 #include "base/files/file_util.h" |
| 21 #include "base/files/scoped_temp_dir.h" | 22 #include "base/files/scoped_temp_dir.h" |
| 22 #include "base/location.h" | 23 #include "base/location.h" |
| 23 #include "base/posix/eintr_wrapper.h" | 24 #include "base/posix/eintr_wrapper.h" |
| 24 #include "base/single_thread_task_runner.h" | 25 #include "base/single_thread_task_runner.h" |
| 25 #include "base/strings/stringprintf.h" | 26 #include "base/strings/stringprintf.h" |
| 26 #include "base/synchronization/waitable_event.h" | 27 #include "base/synchronization/waitable_event.h" |
| 27 #include "base/test/test_timeouts.h" | 28 #include "base/test/test_timeouts.h" |
| 28 #include "base/test/thread_test_helper.h" | 29 #include "base/test/thread_test_helper.h" |
| 29 #include "base/threading/thread.h" | 30 #include "base/threading/thread.h" |
| 31 #include "build/build_config.h" |
| 30 #include "chrome/common/chrome_constants.h" | 32 #include "chrome/common/chrome_constants.h" |
| 31 #include "content/public/test/test_browser_thread.h" | 33 #include "content/public/test/test_browser_thread.h" |
| 32 #include "net/base/net_util.h" | 34 #include "net/base/net_util.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 36 |
| 35 using content::BrowserThread; | 37 using content::BrowserThread; |
| 36 | 38 |
| 37 namespace { | 39 namespace { |
| 38 | 40 |
| 39 class ProcessSingletonPosixTest : public testing::Test { | 41 class ProcessSingletonPosixTest : public testing::Test { |
| (...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 // Test that if there is an existing lock file, and it's not locked, we replace | 423 // Test that if there is an existing lock file, and it's not locked, we replace |
| 422 // it. | 424 // it. |
| 423 TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) { | 425 TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) { |
| 424 scoped_ptr<TestableProcessSingleton> process_singleton( | 426 scoped_ptr<TestableProcessSingleton> process_singleton( |
| 425 CreateProcessSingleton()); | 427 CreateProcessSingleton()); |
| 426 EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0)); | 428 EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0)); |
| 427 EXPECT_TRUE(process_singleton->Create()); | 429 EXPECT_TRUE(process_singleton->Create()); |
| 428 VerifyFiles(); | 430 VerifyFiles(); |
| 429 } | 431 } |
| 430 #endif // defined(OS_MACOSX) | 432 #endif // defined(OS_MACOSX) |
| OLD | NEW |