OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/chrome_process_singleton.h" | 5 #include "chrome/browser/chrome_process_singleton.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
11 #include "base/files/scoped_temp_dir.h" | 11 #include "base/files/scoped_temp_dir.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 bool ServerCallback(int* callback_count, | 16 bool ServerCallback(int* callback_count, |
17 const CommandLine& command_line, | 17 const base::CommandLine& command_line, |
18 const base::FilePath& current_directory) { | 18 const base::FilePath& current_directory) { |
19 ++(*callback_count); | 19 ++(*callback_count); |
20 return true; | 20 return true; |
21 } | 21 } |
22 | 22 |
23 bool ClientCallback(const CommandLine& command_line, | 23 bool ClientCallback(const base::CommandLine& command_line, |
24 const base::FilePath& current_directory) { | 24 const base::FilePath& current_directory) { |
25 ADD_FAILURE(); | 25 ADD_FAILURE(); |
26 return false; | 26 return false; |
27 } | 27 } |
28 | 28 |
29 } // namespace | 29 } // namespace |
30 | 30 |
31 TEST(ChromeProcessSingletonTest, Basic) { | 31 TEST(ChromeProcessSingletonTest, Basic) { |
32 base::ScopedTempDir profile_dir; | 32 base::ScopedTempDir profile_dir; |
33 ASSERT_TRUE(profile_dir.CreateUniqueTempDir()); | 33 ASSERT_TRUE(profile_dir.CreateUniqueTempDir()); |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // The notification sent while a modal dialog was present was silently | 122 // The notification sent while a modal dialog was present was silently |
123 // dropped. | 123 // dropped. |
124 ASSERT_EQ(0, callback_count); | 124 ASSERT_EQ(0, callback_count); |
125 | 125 |
126 // But now that the active modal dialog is NULL notifications will be handled. | 126 // But now that the active modal dialog is NULL notifications will be handled. |
127 result = ps2.NotifyOtherProcessOrCreate(); | 127 result = ps2.NotifyOtherProcessOrCreate(); |
128 ASSERT_EQ(ProcessSingleton::PROCESS_NOTIFIED, result); | 128 ASSERT_EQ(ProcessSingleton::PROCESS_NOTIFIED, result); |
129 ASSERT_EQ(1, callback_count); | 129 ASSERT_EQ(1, callback_count); |
130 } | 130 } |
131 #endif // defined(OS_WIN) && !defined(USE_AURA) | 131 #endif // defined(OS_WIN) && !defined(USE_AURA) |
OLD | NEW |