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 <limits.h> | 8 #include <limits.h> |
9 #include <signal.h> | 9 #include <signal.h> |
10 #include <stddef.h> | 10 #include <stddef.h> |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 bool NotificationCallback(const base::CommandLine& command_line, | 62 bool NotificationCallback(const base::CommandLine& command_line, |
63 const base::FilePath& current_directory) { | 63 const base::FilePath& current_directory) { |
64 callback_command_lines_.push_back(command_line.argv()); | 64 callback_command_lines_.push_back(command_line.argv()); |
65 return true; | 65 return true; |
66 } | 66 } |
67 }; | 67 }; |
68 | 68 |
69 ProcessSingletonPosixTest() | 69 ProcessSingletonPosixTest() |
70 : kill_callbacks_(0), | 70 : kill_callbacks_(0), |
71 io_thread_(BrowserThread::IO), | 71 io_thread_(BrowserThread::IO), |
72 wait_event_(true, false), | 72 wait_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
73 signal_event_(true, false), | 73 base::WaitableEvent::InitialState::NOT_SIGNALED), |
| 74 signal_event_(base::WaitableEvent::ResetPolicy::MANUAL, |
| 75 base::WaitableEvent::InitialState::NOT_SIGNALED), |
74 process_singleton_on_thread_(NULL) { | 76 process_singleton_on_thread_(NULL) { |
75 io_thread_.StartIOThread(); | 77 io_thread_.StartIOThread(); |
76 } | 78 } |
77 | 79 |
78 void SetUp() override { | 80 void SetUp() override { |
79 testing::Test::SetUp(); | 81 testing::Test::SetUp(); |
80 | 82 |
81 ProcessSingleton::DisablePromptForTesting(); | 83 ProcessSingleton::DisablePromptForTesting(); |
82 // Put the lock in a temporary directory. Doesn't need to be a | 84 // Put the lock in a temporary directory. Doesn't need to be a |
83 // full profile to test this code. | 85 // full profile to test this code. |
(...skipping 341 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
425 // Test that if there is an existing lock file, and it's not locked, we replace | 427 // Test that if there is an existing lock file, and it's not locked, we replace |
426 // it. | 428 // it. |
427 TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) { | 429 TEST_F(ProcessSingletonPosixTest, CreateReplacesOldMacLock) { |
428 std::unique_ptr<TestableProcessSingleton> process_singleton( | 430 std::unique_ptr<TestableProcessSingleton> process_singleton( |
429 CreateProcessSingleton()); | 431 CreateProcessSingleton()); |
430 EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0)); | 432 EXPECT_EQ(0, base::WriteFile(lock_path_, "", 0)); |
431 EXPECT_TRUE(process_singleton->Create()); | 433 EXPECT_TRUE(process_singleton->Create()); |
432 VerifyFiles(); | 434 VerifyFiles(); |
433 } | 435 } |
434 #endif // defined(OS_MACOSX) | 436 #endif // defined(OS_MACOSX) |
OLD | NEW |