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