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 <sys/types.h> | 8 #include <sys/types.h> |
8 #include <sys/wait.h> | 9 #include <sys/wait.h> |
9 #include <signal.h> | |
10 #include <unistd.h> | 10 #include <unistd.h> |
| 11 |
| 12 #include <string> |
11 #include <vector> | 13 #include <vector> |
12 #include <string> | |
13 | 14 |
14 #include "base/bind.h" | 15 #include "base/bind.h" |
15 #include "base/command_line.h" | 16 #include "base/command_line.h" |
16 #include "base/file_path.h" | 17 #include "base/file_path.h" |
| 18 #include "base/files/scoped_temp_dir.h" |
17 #include "base/message_loop.h" | 19 #include "base/message_loop.h" |
18 #include "base/process_util.h" | 20 #include "base/process_util.h" |
19 #include "base/scoped_temp_dir.h" | |
20 #include "base/stringprintf.h" | 21 #include "base/stringprintf.h" |
21 #include "base/synchronization/waitable_event.h" | 22 #include "base/synchronization/waitable_event.h" |
22 #include "base/test/test_timeouts.h" | 23 #include "base/test/test_timeouts.h" |
23 #include "base/test/thread_test_helper.h" | 24 #include "base/test/thread_test_helper.h" |
24 #include "base/threading/thread.h" | 25 #include "base/threading/thread.h" |
25 #include "chrome/common/chrome_constants.h" | 26 #include "chrome/common/chrome_constants.h" |
26 #include "content/public/test/test_browser_thread.h" | 27 #include "content/public/test/test_browser_thread.h" |
27 #include "net/base/net_util.h" | 28 #include "net/base/net_util.h" |
28 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
29 | 30 |
(...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 const FilePath& current_directory) { | 185 const FilePath& current_directory) { |
185 callback_command_lines_.push_back(command_line.argv()); | 186 callback_command_lines_.push_back(command_line.argv()); |
186 return true; | 187 return true; |
187 } | 188 } |
188 | 189 |
189 void KillCallback(int pid) { | 190 void KillCallback(int pid) { |
190 kill_callbacks_++; | 191 kill_callbacks_++; |
191 } | 192 } |
192 | 193 |
193 content::TestBrowserThread io_thread_; | 194 content::TestBrowserThread io_thread_; |
194 ScopedTempDir temp_dir_; | 195 base::ScopedTempDir temp_dir_; |
195 base::WaitableEvent wait_event_; | 196 base::WaitableEvent wait_event_; |
196 base::WaitableEvent signal_event_; | 197 base::WaitableEvent signal_event_; |
197 | 198 |
198 scoped_ptr<base::Thread> worker_thread_; | 199 scoped_ptr<base::Thread> worker_thread_; |
199 ProcessSingleton* process_singleton_on_thread_; | 200 ProcessSingleton* process_singleton_on_thread_; |
200 | 201 |
201 std::vector<CommandLine::StringVector> callback_command_lines_; | 202 std::vector<CommandLine::StringVector> callback_command_lines_; |
202 }; | 203 }; |
203 | 204 |
204 } // namespace | 205 } // namespace |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 | 368 |
368 // Also change the hostname, so the remote does not retry. | 369 // Also change the hostname, so the remote does not retry. |
369 EXPECT_EQ(0, unlink(lock_path_.value().c_str())); | 370 EXPECT_EQ(0, unlink(lock_path_.value().c_str())); |
370 EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str())); | 371 EXPECT_EQ(0, symlink("FAKEFOOHOST-1234", lock_path_.value().c_str())); |
371 | 372 |
372 std::string url("about:blank"); | 373 std::string url("about:blank"); |
373 EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, | 374 EXPECT_EQ(ProcessSingleton::PROFILE_IN_USE, |
374 NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout())); | 375 NotifyOtherProcessOrCreate(url, TestTimeouts::action_timeout())); |
375 } | 376 } |
376 | 377 |
OLD | NEW |