OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 "apps/app_shim/extension_app_shim_handler_mac.h" | 5 #include "apps/app_shim/extension_app_shim_handler_mac.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "apps/app_shim/app_shim_host_mac.h" | 9 #include "apps/app_shim/app_shim_host_mac.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
11 #include "chrome/browser/chrome_notification_types.h" | 11 #include "chrome/browser/chrome_notification_types.h" |
12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
13 #include "content/public/browser/notification_service.h" | 13 #include "content/public/browser/notification_service.h" |
14 #include "extensions/common/extension.h" | 14 #include "extensions/common/extension.h" |
15 #include "testing/gmock/include/gmock/gmock.h" | 15 #include "testing/gmock/include/gmock/gmock.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
17 | 17 |
18 namespace apps { | 18 namespace apps { |
19 | 19 |
20 using extensions::Extension; | 20 using extensions::Extension; |
21 typedef AppWindowRegistry::AppWindowList AppWindowList; | 21 typedef extensions::AppWindowRegistry::AppWindowList AppWindowList; |
22 | 22 |
23 using ::testing::_; | 23 using ::testing::_; |
24 using ::testing::Invoke; | 24 using ::testing::Invoke; |
25 using ::testing::Return; | 25 using ::testing::Return; |
26 using ::testing::WithArgs; | 26 using ::testing::WithArgs; |
27 | 27 |
28 class MockDelegate : public ExtensionAppShimHandler::Delegate { | 28 class MockDelegate : public ExtensionAppShimHandler::Delegate { |
29 public: | 29 public: |
30 virtual ~MockDelegate() {} | 30 virtual ~MockDelegate() {} |
31 | 31 |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 EXPECT_CALL(*delegate_, ProfileForPath(profile_path_a_)) | 169 EXPECT_CALL(*delegate_, ProfileForPath(profile_path_a_)) |
170 .WillRepeatedly(Return(&profile_a_)); | 170 .WillRepeatedly(Return(&profile_a_)); |
171 EXPECT_CALL(*delegate_, ProfileExistsForPath(profile_path_b_)) | 171 EXPECT_CALL(*delegate_, ProfileExistsForPath(profile_path_b_)) |
172 .WillRepeatedly(Return(true)); | 172 .WillRepeatedly(Return(true)); |
173 EXPECT_CALL(*delegate_, ProfileForPath(profile_path_b_)) | 173 EXPECT_CALL(*delegate_, ProfileForPath(profile_path_b_)) |
174 .WillRepeatedly(Return(&profile_b_)); | 174 .WillRepeatedly(Return(&profile_b_)); |
175 | 175 |
176 // In most tests, we don't care about the result of GetWindows, it just | 176 // In most tests, we don't care about the result of GetWindows, it just |
177 // needs to be non-empty. | 177 // needs to be non-empty. |
178 AppWindowList app_window_list; | 178 AppWindowList app_window_list; |
179 app_window_list.push_back(static_cast<AppWindow*>(NULL)); | 179 app_window_list.push_back(static_cast<extensions::AppWindow*>(NULL)); |
180 EXPECT_CALL(*delegate_, GetWindows(_, _)) | 180 EXPECT_CALL(*delegate_, GetWindows(_, _)) |
181 .WillRepeatedly(Return(app_window_list)); | 181 .WillRepeatedly(Return(app_window_list)); |
182 | 182 |
183 EXPECT_CALL(*delegate_, GetAppExtension(_, kTestAppIdA)) | 183 EXPECT_CALL(*delegate_, GetAppExtension(_, kTestAppIdA)) |
184 .WillRepeatedly(Return(extension_a_.get())); | 184 .WillRepeatedly(Return(extension_a_.get())); |
185 EXPECT_CALL(*delegate_, GetAppExtension(_, kTestAppIdB)) | 185 EXPECT_CALL(*delegate_, GetAppExtension(_, kTestAppIdB)) |
186 .WillRepeatedly(Return(extension_b_.get())); | 186 .WillRepeatedly(Return(extension_b_.get())); |
187 EXPECT_CALL(*delegate_, LaunchApp(_, _, _)) | 187 EXPECT_CALL(*delegate_, LaunchApp(_, _, _)) |
188 .WillRepeatedly(Return()); | 188 .WillRepeatedly(Return()); |
189 } | 189 } |
(...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 .WillRepeatedly(Return(&profile_a_)); | 387 .WillRepeatedly(Return(&profile_a_)); |
388 EXPECT_CALL(*delegate_, LoadProfileAsync(profile_path_a_, _)) | 388 EXPECT_CALL(*delegate_, LoadProfileAsync(profile_path_a_, _)) |
389 .WillOnce(Invoke(delegate_, &MockDelegate::CaptureLoadProfileCallback)); | 389 .WillOnce(Invoke(delegate_, &MockDelegate::CaptureLoadProfileCallback)); |
390 NormalLaunch(&host_aa_); | 390 NormalLaunch(&host_aa_); |
391 EXPECT_FALSE(handler_->FindHost(&profile_a_, kTestAppIdA)); | 391 EXPECT_FALSE(handler_->FindHost(&profile_a_, kTestAppIdA)); |
392 delegate_->RunLoadProfileCallback(profile_path_a_, &profile_a_); | 392 delegate_->RunLoadProfileCallback(profile_path_a_, &profile_a_); |
393 EXPECT_TRUE(handler_->FindHost(&profile_a_, kTestAppIdA)); | 393 EXPECT_TRUE(handler_->FindHost(&profile_a_, kTestAppIdA)); |
394 } | 394 } |
395 | 395 |
396 } // namespace apps | 396 } // namespace apps |
OLD | NEW |