| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/compiler_specific.h" | 5 #include "base/compiler_specific.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "chrome/browser/apps/app_browsertest_util.h" | 10 #include "chrome/browser/apps/app_browsertest_util.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 private: | 52 private: |
| 53 Profile* profile_; | 53 Profile* profile_; |
| 54 int icon_updates_; | 54 int icon_updates_; |
| 55 | 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(TestAppWindowRegistryObserver); | 56 DISALLOW_COPY_AND_ASSIGN(TestAppWindowRegistryObserver); |
| 57 }; | 57 }; |
| 58 | 58 |
| 59 } // namespace | 59 } // namespace |
| 60 | 60 |
| 61 using AppWindowApiTest = PlatformAppBrowserTest; |
| 62 using ExperimentalAppWindowApiTest = ExperimentalPlatformAppBrowserTest; |
| 63 |
| 61 // Tests chrome.app.window.setIcon. | 64 // Tests chrome.app.window.setIcon. |
| 62 IN_PROC_BROWSER_TEST_F(ExperimentalPlatformAppBrowserTest, WindowsApiSetIcon) { | 65 IN_PROC_BROWSER_TEST_F(ExperimentalAppWindowApiTest, SetIcon) { |
| 63 std::unique_ptr<TestAppWindowRegistryObserver> test_observer( | 66 std::unique_ptr<TestAppWindowRegistryObserver> test_observer( |
| 64 new TestAppWindowRegistryObserver(browser()->profile())); | 67 new TestAppWindowRegistryObserver(browser()->profile())); |
| 65 ExtensionTestMessageListener listener("ready", true); | 68 ExtensionTestMessageListener listener("ready", true); |
| 66 | 69 |
| 67 // Launch the app and wait for it to be ready. | 70 // Launch the app and wait for it to be ready. |
| 68 LoadAndLaunchPlatformApp("windows_api_set_icon", &listener); | 71 LoadAndLaunchPlatformApp("windows_api_set_icon", &listener); |
| 69 EXPECT_EQ(0, test_observer->icon_updates()); | 72 EXPECT_EQ(0, test_observer->icon_updates()); |
| 70 listener.Reply(""); | 73 listener.Reply(""); |
| 71 | 74 |
| 72 // Now wait until the WebContent has decoded the icon and chrome has | 75 // Now wait until the WebContent has decoded the icon and chrome has |
| (...skipping 10 matching lines...) Expand all Loading... |
| 83 EXPECT_EQ(1, test_observer->icon_updates()); | 86 EXPECT_EQ(1, test_observer->icon_updates()); |
| 84 } | 87 } |
| 85 | 88 |
| 86 // TODO(asargent) - Figure out what to do about the fact that minimize events | 89 // TODO(asargent) - Figure out what to do about the fact that minimize events |
| 87 // don't work under ubuntu unity. | 90 // don't work under ubuntu unity. |
| 88 // (crbug.com/162794 and https://bugs.launchpad.net/unity/+bug/998073). | 91 // (crbug.com/162794 and https://bugs.launchpad.net/unity/+bug/998073). |
| 89 // TODO(linux_aura) http://crbug.com/163931 | 92 // TODO(linux_aura) http://crbug.com/163931 |
| 90 // Flaky on Mac, http://crbug.com/232330 | 93 // Flaky on Mac, http://crbug.com/232330 |
| 91 #if defined(TOOLKIT_VIEWS) && !(defined(OS_LINUX) && !defined(OS_CHROMEOS) && de
fined(USE_AURA)) | 94 #if defined(TOOLKIT_VIEWS) && !(defined(OS_LINUX) && !defined(OS_CHROMEOS) && de
fined(USE_AURA)) |
| 92 | 95 |
| 93 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiProperties) { | 96 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, Properties) { |
| 94 #if defined(OS_MACOSX) | 97 #if defined(OS_MACOSX) |
| 95 if (base::mac::IsOS10_10()) | 98 if (base::mac::IsOS10_10()) |
| 96 return; // Fails when swarmed. http://crbug.com/660582 | 99 return; // Fails when swarmed. http://crbug.com/660582 |
| 97 #endif | 100 #endif |
| 98 EXPECT_TRUE( | 101 EXPECT_TRUE( |
| 99 RunExtensionTest("platform_apps/windows_api_properties")) << message_; | 102 RunExtensionTest("platform_apps/windows_api_properties")) << message_; |
| 100 } | 103 } |
| 101 | 104 |
| 102 #endif // defined(TOOLKIT_VIEWS) | 105 #endif // defined(TOOLKIT_VIEWS) |
| 103 | 106 |
| 104 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 107 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, AlwaysOnTopWithPermissions) { |
| 105 WindowsApiAlwaysOnTopWithPermissions) { | |
| 106 EXPECT_TRUE(RunPlatformAppTest( | 108 EXPECT_TRUE(RunPlatformAppTest( |
| 107 "platform_apps/windows_api_always_on_top/has_permissions")) << message_; | 109 "platform_apps/windows_api_always_on_top/has_permissions")) << message_; |
| 108 } | 110 } |
| 109 | 111 |
| 110 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 112 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, AlwaysOnTopWithOldPermissions) { |
| 111 WindowsApiAlwaysOnTopWithOldPermissions) { | |
| 112 EXPECT_TRUE(RunPlatformAppTest( | 113 EXPECT_TRUE(RunPlatformAppTest( |
| 113 "platform_apps/windows_api_always_on_top/has_old_permissions")) | 114 "platform_apps/windows_api_always_on_top/has_old_permissions")) |
| 114 << message_; | 115 << message_; |
| 115 } | 116 } |
| 116 | 117 |
| 117 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 118 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, AlwaysOnTopNoPermissions) { |
| 118 WindowsApiAlwaysOnTopNoPermissions) { | |
| 119 EXPECT_TRUE(RunPlatformAppTest( | 119 EXPECT_TRUE(RunPlatformAppTest( |
| 120 "platform_apps/windows_api_always_on_top/no_permissions")) << message_; | 120 "platform_apps/windows_api_always_on_top/no_permissions")) << message_; |
| 121 } | 121 } |
| 122 | 122 |
| 123 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiGet) { | 123 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, Get) { |
| 124 EXPECT_TRUE(RunPlatformAppTest("platform_apps/windows_api_get")) | 124 EXPECT_TRUE(RunPlatformAppTest("platform_apps/windows_api_get")) |
| 125 << message_; | 125 << message_; |
| 126 } | 126 } |
| 127 | 127 |
| 128 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiSetShapeHasPerm) { | 128 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, SetShapeHasPerm) { |
| 129 EXPECT_TRUE( | 129 EXPECT_TRUE( |
| 130 RunPlatformAppTest("platform_apps/windows_api_shape/has_permission")) | 130 RunPlatformAppTest("platform_apps/windows_api_shape/has_permission")) |
| 131 << message_; | 131 << message_; |
| 132 } | 132 } |
| 133 | 133 |
| 134 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiSetShapeNoPerm) { | 134 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, SetShapeNoPerm) { |
| 135 EXPECT_TRUE( | 135 EXPECT_TRUE( |
| 136 RunPlatformAppTest("platform_apps/windows_api_shape/no_permission")) | 136 RunPlatformAppTest("platform_apps/windows_api_shape/no_permission")) |
| 137 << message_; | 137 << message_; |
| 138 } | 138 } |
| 139 | 139 |
| 140 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 140 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, AlphaEnabledHasPermissions) { |
| 141 WindowsApiAlphaEnabledHasPermissions) { | |
| 142 const char kNoAlphaDir[] = | 141 const char kNoAlphaDir[] = |
| 143 "platform_apps/windows_api_alpha_enabled/has_permissions_no_alpha"; | 142 "platform_apps/windows_api_alpha_enabled/has_permissions_no_alpha"; |
| 144 const char kHasAlphaDir[] = | 143 const char kHasAlphaDir[] = |
| 145 "platform_apps/windows_api_alpha_enabled/has_permissions_has_alpha"; | 144 "platform_apps/windows_api_alpha_enabled/has_permissions_has_alpha"; |
| 146 ALLOW_UNUSED_LOCAL(kHasAlphaDir); | 145 ALLOW_UNUSED_LOCAL(kHasAlphaDir); |
| 147 const char* test_dir = kNoAlphaDir; | 146 const char* test_dir = kNoAlphaDir; |
| 148 | 147 |
| 149 #if defined(USE_AURA) && (defined(OS_CHROMEOS) || !defined(OS_LINUX)) | 148 #if defined(USE_AURA) && (defined(OS_CHROMEOS) || !defined(OS_LINUX)) |
| 150 test_dir = kHasAlphaDir; | 149 test_dir = kHasAlphaDir; |
| 151 | 150 |
| 152 #if defined(OS_WIN) | 151 #if defined(OS_WIN) |
| 153 if (!ui::win::IsAeroGlassEnabled()) { | 152 if (!ui::win::IsAeroGlassEnabled()) { |
| 154 test_dir = kNoAlphaDir; | 153 test_dir = kNoAlphaDir; |
| 155 } | 154 } |
| 156 #endif // OS_WIN | 155 #endif // OS_WIN |
| 157 #endif // USE_AURA && (OS_CHROMEOS || !OS_LINUX) | 156 #endif // USE_AURA && (OS_CHROMEOS || !OS_LINUX) |
| 158 | 157 |
| 159 EXPECT_TRUE(RunPlatformAppTest(test_dir)) << message_; | 158 EXPECT_TRUE(RunPlatformAppTest(test_dir)) << message_; |
| 160 } | 159 } |
| 161 | 160 |
| 162 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 161 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, AlphaEnabledNoPermissions) { |
| 163 WindowsApiAlphaEnabledNoPermissions) { | |
| 164 EXPECT_TRUE(RunPlatformAppTest( | 162 EXPECT_TRUE(RunPlatformAppTest( |
| 165 "platform_apps/windows_api_alpha_enabled/no_permissions")) | 163 "platform_apps/windows_api_alpha_enabled/no_permissions")) |
| 166 << message_; | 164 << message_; |
| 167 } | 165 } |
| 168 | 166 |
| 169 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, WindowsApiAlphaEnabledInStable) { | 167 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, AlphaEnabledInStable) { |
| 170 extensions::ScopedCurrentChannel channel(version_info::Channel::STABLE); | 168 extensions::ScopedCurrentChannel channel(version_info::Channel::STABLE); |
| 171 EXPECT_TRUE(RunPlatformAppTestWithFlags( | 169 EXPECT_TRUE(RunPlatformAppTestWithFlags( |
| 172 "platform_apps/windows_api_alpha_enabled/in_stable", | 170 "platform_apps/windows_api_alpha_enabled/in_stable", |
| 173 // Ignore manifest warnings because the extension will not load at all | 171 // Ignore manifest warnings because the extension will not load at all |
| 174 // in stable. | 172 // in stable. |
| 175 kFlagIgnoreManifestWarnings)) | 173 kFlagIgnoreManifestWarnings)) |
| 176 << message_; | 174 << message_; |
| 177 } | 175 } |
| 178 | 176 |
| 179 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 177 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, AlphaEnabledWrongFrameType) { |
| 180 WindowsApiAlphaEnabledWrongFrameType) { | |
| 181 EXPECT_TRUE(RunPlatformAppTest( | 178 EXPECT_TRUE(RunPlatformAppTest( |
| 182 "platform_apps/windows_api_alpha_enabled/wrong_frame_type")) | 179 "platform_apps/windows_api_alpha_enabled/wrong_frame_type")) |
| 183 << message_; | 180 << message_; |
| 184 } | 181 } |
| 185 | 182 |
| 186 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 183 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, VisibleOnAllWorkspacesInStable) { |
| 187 WindowsApiVisibleOnAllWorkspacesInStable) { | |
| 188 extensions::ScopedCurrentChannel channel(version_info::Channel::STABLE); | 184 extensions::ScopedCurrentChannel channel(version_info::Channel::STABLE); |
| 189 EXPECT_TRUE(RunPlatformAppTest( | 185 EXPECT_TRUE(RunPlatformAppTest( |
| 190 "platform_apps/windows_api_visible_on_all_workspaces/in_stable")) | 186 "platform_apps/windows_api_visible_on_all_workspaces/in_stable")) |
| 191 << message_; | 187 << message_; |
| 192 } | 188 } |
| 193 | 189 |
| 194 #if defined(OS_CHROMEOS) | 190 #if defined(OS_CHROMEOS) |
| 195 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 191 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, ImeWindowHasPermissions) { |
| 196 WindowsApiImeWindowHasPermissions) { | |
| 197 EXPECT_TRUE(RunComponentExtensionTest( | 192 EXPECT_TRUE(RunComponentExtensionTest( |
| 198 "platform_apps/windows_api_ime/has_permissions_whitelisted")) | 193 "platform_apps/windows_api_ime/has_permissions_whitelisted")) |
| 199 << message_; | 194 << message_; |
| 200 | 195 |
| 201 EXPECT_TRUE(RunPlatformAppTestWithFlags( | 196 EXPECT_TRUE(RunPlatformAppTestWithFlags( |
| 202 "platform_apps/windows_api_ime/has_permissions_platform_app", | 197 "platform_apps/windows_api_ime/has_permissions_platform_app", |
| 203 kFlagIgnoreManifestWarnings)) | 198 kFlagIgnoreManifestWarnings)) |
| 204 << message_; | 199 << message_; |
| 205 } | 200 } |
| 206 | 201 |
| 207 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 202 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, ImeWindowNoPermissions) { |
| 208 WindowsApiImeWindowNoPermissions) { | |
| 209 EXPECT_TRUE(RunComponentExtensionTest( | 203 EXPECT_TRUE(RunComponentExtensionTest( |
| 210 "platform_apps/windows_api_ime/no_permissions_whitelisted")) | 204 "platform_apps/windows_api_ime/no_permissions_whitelisted")) |
| 211 << message_; | 205 << message_; |
| 212 | 206 |
| 213 EXPECT_TRUE(RunPlatformAppTest( | 207 EXPECT_TRUE(RunPlatformAppTest( |
| 214 "platform_apps/windows_api_ime/no_permissions_platform_app")) | 208 "platform_apps/windows_api_ime/no_permissions_platform_app")) |
| 215 << message_; | 209 << message_; |
| 216 } | 210 } |
| 217 | 211 |
| 218 IN_PROC_BROWSER_TEST_F(PlatformAppBrowserTest, | 212 IN_PROC_BROWSER_TEST_F(AppWindowApiTest, ImeWindowNotFullscreen) { |
| 219 WindowsApiImeWindowNotFullscreen) { | |
| 220 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 213 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 221 command_line->AppendSwitch(switches::kForceAppMode); | 214 command_line->AppendSwitch(switches::kForceAppMode); |
| 222 command_line->AppendSwitchASCII(switches::kAppId, | 215 command_line->AppendSwitchASCII(switches::kAppId, |
| 223 "jkghodnilhceideoidjikpgommlajknk"); | 216 "jkghodnilhceideoidjikpgommlajknk"); |
| 224 | 217 |
| 225 EXPECT_TRUE(RunComponentExtensionTest( | 218 EXPECT_TRUE(RunComponentExtensionTest( |
| 226 "platform_apps/windows_api_ime/forced_app_mode_not_fullscreen")) | 219 "platform_apps/windows_api_ime/forced_app_mode_not_fullscreen")) |
| 227 << message_; | 220 << message_; |
| 228 } | 221 } |
| 229 #endif // OS_CHROMEOS | 222 #endif // OS_CHROMEOS |
| 230 | 223 |
| 231 } // namespace extensions | 224 } // namespace extensions |
| OLD | NEW |