| 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 "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" | 5 #include "chrome/browser/apps/app_shim/extension_app_shim_handler_mac.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "chrome/browser/apps/app_shim/app_shim_host_mac.h" | 10 #include "chrome/browser/apps/app_shim/app_shim_host_mac.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 "content/public/test/test_browser_thread_bundle.h" |
| 14 #include "extensions/common/extension.h" | 15 #include "extensions/common/extension.h" |
| 15 #include "testing/gmock/include/gmock/gmock.h" | 16 #include "testing/gmock/include/gmock/gmock.h" |
| 16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
| 17 | 18 |
| 18 namespace apps { | 19 namespace apps { |
| 19 | 20 |
| 20 using extensions::Extension; | 21 using extensions::Extension; |
| 21 typedef extensions::AppWindowRegistry::AppWindowList AppWindowList; | 22 typedef extensions::AppWindowRegistry::AppWindowList AppWindowList; |
| 22 | 23 |
| 23 using ::testing::_; | 24 using ::testing::_; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 APP_SHIM_LAUNCH_NORMAL, | 194 APP_SHIM_LAUNCH_NORMAL, |
| 194 std::vector<base::FilePath>()); | 195 std::vector<base::FilePath>()); |
| 195 } | 196 } |
| 196 | 197 |
| 197 void RegisterOnlyLaunch(AppShimHandler::Host* host) { | 198 void RegisterOnlyLaunch(AppShimHandler::Host* host) { |
| 198 handler_->OnShimLaunch(host, | 199 handler_->OnShimLaunch(host, |
| 199 APP_SHIM_LAUNCH_REGISTER_ONLY, | 200 APP_SHIM_LAUNCH_REGISTER_ONLY, |
| 200 std::vector<base::FilePath>()); | 201 std::vector<base::FilePath>()); |
| 201 } | 202 } |
| 202 | 203 |
| 204 content::TestBrowserThreadBundle thread_bundle_; |
| 203 MockDelegate* delegate_; | 205 MockDelegate* delegate_; |
| 204 scoped_ptr<TestingExtensionAppShimHandler> handler_; | 206 scoped_ptr<TestingExtensionAppShimHandler> handler_; |
| 205 base::FilePath profile_path_a_; | 207 base::FilePath profile_path_a_; |
| 206 base::FilePath profile_path_b_; | 208 base::FilePath profile_path_b_; |
| 207 TestingProfile profile_a_; | 209 TestingProfile profile_a_; |
| 208 TestingProfile profile_b_; | 210 TestingProfile profile_b_; |
| 209 FakeHost host_aa_; | 211 FakeHost host_aa_; |
| 210 FakeHost host_ab_; | 212 FakeHost host_ab_; |
| 211 FakeHost host_bb_; | 213 FakeHost host_bb_; |
| 212 FakeHost host_aa_duplicate_; | 214 FakeHost host_aa_duplicate_; |
| (...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 .WillRepeatedly(Return(&profile_a_)); | 389 .WillRepeatedly(Return(&profile_a_)); |
| 388 EXPECT_CALL(*delegate_, LoadProfileAsync(profile_path_a_, _)) | 390 EXPECT_CALL(*delegate_, LoadProfileAsync(profile_path_a_, _)) |
| 389 .WillOnce(Invoke(delegate_, &MockDelegate::CaptureLoadProfileCallback)); | 391 .WillOnce(Invoke(delegate_, &MockDelegate::CaptureLoadProfileCallback)); |
| 390 NormalLaunch(&host_aa_); | 392 NormalLaunch(&host_aa_); |
| 391 EXPECT_FALSE(handler_->FindHost(&profile_a_, kTestAppIdA)); | 393 EXPECT_FALSE(handler_->FindHost(&profile_a_, kTestAppIdA)); |
| 392 delegate_->RunLoadProfileCallback(profile_path_a_, &profile_a_); | 394 delegate_->RunLoadProfileCallback(profile_path_a_, &profile_a_); |
| 393 EXPECT_TRUE(handler_->FindHost(&profile_a_, kTestAppIdA)); | 395 EXPECT_TRUE(handler_->FindHost(&profile_a_, kTestAppIdA)); |
| 394 } | 396 } |
| 395 | 397 |
| 396 } // namespace apps | 398 } // namespace apps |
| OLD | NEW |