| 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 // Tests behavior when quitting apps with app shims. | 5 // Tests behavior when quitting apps with app shims. |
| 6 | 6 |
| 7 #import <Cocoa/Cocoa.h> | 7 #import <Cocoa/Cocoa.h> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "apps/switches.h" | 10 #include "apps/switches.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 63 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
| 64 ASSERT_EQ(1u, [[NSApp windows] count]); | 64 ASSERT_EQ(1u, [[NSApp windows] count]); |
| 65 | 65 |
| 66 handler_ = g_browser_process->platform_part()->app_shim_host_manager()-> | 66 handler_ = g_browser_process->platform_part()->app_shim_host_manager()-> |
| 67 extension_app_shim_handler(); | 67 extension_app_shim_handler(); |
| 68 | 68 |
| 69 // Attach a host for the app. | 69 // Attach a host for the app. |
| 70 extensions::ExtensionRegistry* registry = | 70 extensions::ExtensionRegistry* registry = |
| 71 extensions::ExtensionRegistry::Get(profile()); | 71 extensions::ExtensionRegistry::Get(profile()); |
| 72 extension_id_ = | 72 extension_id_ = |
| 73 GetExtensionByPath(®istry->enabled_extensions(), app_path_)->id(); | 73 GetExtensionByPath(registry->enabled_extensions(), app_path_)->id(); |
| 74 host_.reset(new FakeHost(profile()->GetPath().BaseName(), | 74 host_.reset(new FakeHost(profile()->GetPath().BaseName(), |
| 75 extension_id_, | 75 extension_id_, |
| 76 handler_)); | 76 handler_)); |
| 77 handler_->OnShimLaunch(host_.get(), | 77 handler_->OnShimLaunch(host_.get(), |
| 78 APP_SHIM_LAUNCH_REGISTER_ONLY, | 78 APP_SHIM_LAUNCH_REGISTER_ONLY, |
| 79 std::vector<base::FilePath>()); | 79 std::vector<base::FilePath>()); |
| 80 EXPECT_EQ(host_.get(), handler_->FindHost(profile(), extension_id_)); | 80 EXPECT_EQ(host_.get(), handler_->FindHost(profile(), extension_id_)); |
| 81 | 81 |
| 82 // Focus the app window. | 82 // Focus the app window. |
| 83 NSWindow* window = [[NSApp windows] objectAtIndex:0]; | 83 NSWindow* window = [[NSApp windows] objectAtIndex:0]; |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 119 atStart:NO]; | 119 atStart:NO]; |
| 120 | 120 |
| 121 // This will time out if the event above does not terminate Chrome. | 121 // This will time out if the event above does not terminate Chrome. |
| 122 content::RunMessageLoop(); | 122 content::RunMessageLoop(); |
| 123 | 123 |
| 124 EXPECT_FALSE(handler_->FindHost(profile(), extension_id_)); | 124 EXPECT_FALSE(handler_->FindHost(profile(), extension_id_)); |
| 125 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); | 125 EXPECT_TRUE(browser_shutdown::IsTryingToQuit()); |
| 126 } | 126 } |
| 127 | 127 |
| 128 } // namespace apps | 128 } // namespace apps |
| OLD | NEW |