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 "apps/app_shim/app_shim_host_mac.h" | 7 #include "apps/app_shim/app_shim_host_mac.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
10 #include "chrome/common/extensions/extension.h" | 10 #include "chrome/common/extensions/extension.h" |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
207 // Normal startup. | 207 // Normal startup. |
208 handler_->OnShimLaunch(&host_aa_, normal_launch); | 208 handler_->OnShimLaunch(&host_aa_, normal_launch); |
209 EXPECT_EQ(&host_aa_, handler_->FindHost(&profile_a_, kTestAppIdA)); | 209 EXPECT_EQ(&host_aa_, handler_->FindHost(&profile_a_, kTestAppIdA)); |
210 | 210 |
211 handler_->OnShimLaunch(&host_ab_, normal_launch); | 211 handler_->OnShimLaunch(&host_ab_, normal_launch); |
212 EXPECT_EQ(&host_ab_, handler_->FindHost(&profile_a_, kTestAppIdB)); | 212 EXPECT_EQ(&host_ab_, handler_->FindHost(&profile_a_, kTestAppIdB)); |
213 | 213 |
214 handler_->OnShimLaunch(&host_bb_, normal_launch); | 214 handler_->OnShimLaunch(&host_bb_, normal_launch); |
215 EXPECT_EQ(&host_bb_, handler_->FindHost(&profile_b_, kTestAppIdB)); | 215 EXPECT_EQ(&host_bb_, handler_->FindHost(&profile_b_, kTestAppIdB)); |
216 | 216 |
217 // Activation when there is a registered shim finishes launch with success. | 217 // Activation when there is a registered shim finishes launch with success and |
| 218 // focuses the app. |
218 EXPECT_CALL(host_aa_, OnAppLaunchComplete(APP_SHIM_LAUNCH_SUCCESS)); | 219 EXPECT_CALL(host_aa_, OnAppLaunchComplete(APP_SHIM_LAUNCH_SUCCESS)); |
| 220 EXPECT_CALL(*handler_, OnShimFocus(&host_aa_, APP_SHIM_FOCUS_NORMAL)); |
219 handler_->OnAppActivated(&profile_a_, kTestAppIdA); | 221 handler_->OnAppActivated(&profile_a_, kTestAppIdA); |
220 | 222 |
221 // Starting and closing a second host just focuses the app. | 223 // Starting and closing a second host just focuses the app. |
222 EXPECT_CALL(*handler_, OnShimFocus(&host_aa_duplicate_, | 224 EXPECT_CALL(*handler_, OnShimFocus(&host_aa_duplicate_, |
223 APP_SHIM_FOCUS_REOPEN)); | 225 APP_SHIM_FOCUS_REOPEN)); |
224 EXPECT_CALL(host_aa_duplicate_, | 226 EXPECT_CALL(host_aa_duplicate_, |
225 OnAppLaunchComplete(APP_SHIM_LAUNCH_DUPLICATE_HOST)); | 227 OnAppLaunchComplete(APP_SHIM_LAUNCH_DUPLICATE_HOST)); |
226 handler_->OnShimLaunch(&host_aa_duplicate_, normal_launch); | 228 handler_->OnShimLaunch(&host_aa_duplicate_, normal_launch); |
227 EXPECT_EQ(&host_aa_, handler_->FindHost(&profile_a_, kTestAppIdA)); | 229 EXPECT_EQ(&host_aa_, handler_->FindHost(&profile_a_, kTestAppIdA)); |
228 handler_->OnShimClose(&host_aa_duplicate_); | 230 handler_->OnShimClose(&host_aa_duplicate_); |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 .WillRepeatedly(Return(&profile_a_)); | 334 .WillRepeatedly(Return(&profile_a_)); |
333 EXPECT_CALL(*delegate_, LoadProfileAsync(profile_path_a_, _)) | 335 EXPECT_CALL(*delegate_, LoadProfileAsync(profile_path_a_, _)) |
334 .WillOnce(Invoke(delegate_, &MockDelegate::CaptureLoadProfileCallback)); | 336 .WillOnce(Invoke(delegate_, &MockDelegate::CaptureLoadProfileCallback)); |
335 handler_->OnShimLaunch(&host_aa_, APP_SHIM_LAUNCH_NORMAL); | 337 handler_->OnShimLaunch(&host_aa_, APP_SHIM_LAUNCH_NORMAL); |
336 EXPECT_FALSE(handler_->FindHost(&profile_a_, kTestAppIdA)); | 338 EXPECT_FALSE(handler_->FindHost(&profile_a_, kTestAppIdA)); |
337 delegate_->RunLoadProfileCallback(profile_path_a_, &profile_a_); | 339 delegate_->RunLoadProfileCallback(profile_path_a_, &profile_a_); |
338 EXPECT_TRUE(handler_->FindHost(&profile_a_, kTestAppIdA)); | 340 EXPECT_TRUE(handler_->FindHost(&profile_a_, kTestAppIdA)); |
339 } | 341 } |
340 | 342 |
341 } // namespace apps | 343 } // namespace apps |
OLD | NEW |