| 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 <sys/types.h> | 9 #include <sys/types.h> |
| 10 #include <sys/un.h> | 10 #include <sys/un.h> |
| 11 #include <sys/wait.h> | 11 #include <sys/wait.h> |
| 12 #include <unistd.h> | 12 #include <unistd.h> |
| 13 | 13 |
| 14 #include <string> | 14 #include <string> |
| 15 #include <vector> | 15 #include <vector> |
| 16 | 16 |
| 17 #include "base/bind.h" | 17 #include "base/bind.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/file_util.h" | |
| 20 #include "base/files/file_path.h" | 19 #include "base/files/file_path.h" |
| 20 #include "base/files/file_util.h" |
| 21 #include "base/files/scoped_temp_dir.h" | 21 #include "base/files/scoped_temp_dir.h" |
| 22 #include "base/message_loop/message_loop.h" | 22 #include "base/message_loop/message_loop.h" |
| 23 #include "base/posix/eintr_wrapper.h" | 23 #include "base/posix/eintr_wrapper.h" |
| 24 #include "base/strings/stringprintf.h" | 24 #include "base/strings/stringprintf.h" |
| 25 #include "base/synchronization/waitable_event.h" | 25 #include "base/synchronization/waitable_event.h" |
| 26 #include "base/test/test_timeouts.h" | 26 #include "base/test/test_timeouts.h" |
| 27 #include "base/test/thread_test_helper.h" | 27 #include "base/test/thread_test_helper.h" |
| 28 #include "base/threading/thread.h" | 28 #include "base/threading/thread.h" |
| 29 #include "chrome/common/chrome_constants.h" | 29 #include "chrome/common/chrome_constants.h" |
| 30 #include "content/public/test/test_browser_thread.h" | 30 #include "content/public/test/test_browser_thread.h" |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 429 // Test that if there is an existing lock file, and it's not locked, we replace | 429 // Test that if there is an existing lock file, and it's not locked, we replace |
| 430 // it. | 430 // it. |
| 431 TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) { | 431 TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) { |
| 432 scoped_ptr<TestableProcessSingleton> process_singleton( | 432 scoped_ptr<TestableProcessSingleton> process_singleton( |
| 433 CreateProcessSingleton()); | 433 CreateProcessSingleton()); |
| 434 EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0)); | 434 EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0)); |
| 435 EXPECT_TRUE(process_singleton->Create()); | 435 EXPECT_TRUE(process_singleton->Create()); |
| 436 VerifyFiles(); | 436 VerifyFiles(); |
| 437 } | 437 } |
| 438 #endif // defined(OS_MACOSX) | 438 #endif // defined(OS_MACOSX) |
| OLD | NEW |