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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #if defined(OS_MACOSX) | 6 #if defined(OS_MACOSX) |
7 #include "base/mac/mac_util.h" | 7 #include "base/mac/mac_util.h" |
8 #endif | 8 #endif |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
11 #include "chrome/browser/extensions/extension_apitest.h" | 11 #include "chrome/browser/extensions/extension_apitest.h" |
12 #include "chrome/browser/extensions/extension_service.h" | 12 #include "chrome/browser/extensions/extension_service.h" |
13 #include "chrome/browser/extensions/extension_test_message_listener.h" | 13 #include "chrome/browser/extensions/extension_test_message_listener.h" |
14 #include "chrome/browser/extensions/tab_helper.h" | 14 #include "chrome/browser/extensions/tab_helper.h" |
15 #include "chrome/browser/profiles/profile.h" | 15 #include "chrome/browser/profiles/profile.h" |
| 16 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/chrome_version_info.h" | 18 #include "chrome/common/chrome_version_info.h" |
18 #include "chrome/common/extensions/feature_switch.h" | 19 #include "chrome/common/extensions/feature_switch.h" |
19 #include "chrome/common/extensions/features/base_feature_provider.h" | 20 #include "chrome/common/extensions/features/base_feature_provider.h" |
20 #include "chrome/common/extensions/features/complex_feature.h" | 21 #include "chrome/common/extensions/features/complex_feature.h" |
21 #include "chrome/common/extensions/features/feature.h" | 22 #include "chrome/common/extensions/features/feature.h" |
22 #include "chrome/common/extensions/features/simple_feature.h" | 23 #include "chrome/common/extensions/features/simple_feature.h" |
23 #include "content/public/browser/render_process_host.h" | 24 #include "content/public/browser/render_process_host.h" |
24 #include "content/public/browser/render_view_host.h" | 25 #include "content/public/browser/render_view_host.h" |
25 #include "content/public/common/content_switches.h" | 26 #include "content/public/common/content_switches.h" |
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
181 // Add extension to whitelist and make sure capture succeeds. | 182 // Add extension to whitelist and make sure capture succeeds. |
182 EXPECT_TRUE(before_whitelist_extension.WaitUntilSatisfied()); | 183 EXPECT_TRUE(before_whitelist_extension.WaitUntilSatisfied()); |
183 AddExtensionToCommandLineWhitelist(); | 184 AddExtensionToCommandLineWhitelist(); |
184 before_whitelist_extension.Reply(""); | 185 before_whitelist_extension.Reply(""); |
185 | 186 |
186 ResultCatcher catcher; | 187 ResultCatcher catcher; |
187 catcher.RestrictToProfile(browser()->profile()); | 188 catcher.RestrictToProfile(browser()->profile()); |
188 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 189 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
189 } | 190 } |
190 | 191 |
| 192 // http://crbug.com/177163 |
| 193 #if defined(OS_WIN) && !defined(NDEBUG) |
| 194 #define MAYBE_FullscreenEvents DISABLED_FullscreenEvents |
| 195 #elif defined(USE_AURA) || defined(OS_MACOSX) |
| 196 // These don't always fire fullscreen events when run in tests. Tested manually. |
| 197 #define MAYBE_FullscreenEvents DISABLED_FullscreenEvents |
| 198 #elif defined(OS_LINUX) && defined(NDEBUG) |
| 199 // Flaky to get out of fullscreen in tests. Tested manually. |
| 200 #define MAYBE_FullscreenEvents DISABLED_FullscreenEvents |
| 201 #else |
| 202 #define MAYBE_FullscreenEvents FullscreenEvents |
| 203 #endif |
| 204 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_FullscreenEvents) { |
| 205 #if defined(OS_WIN) |
| 206 // TODO(justinlin): Disabled for WinXP due to timeout issues. |
| 207 if (base::win::GetVersion() < base::win::VERSION_VISTA) { |
| 208 return; |
| 209 } |
| 210 #endif |
| 211 |
| 212 AddExtensionToCommandLineWhitelist(); |
| 213 |
| 214 content::OpenURLParams params(GURL("chrome://version"), |
| 215 content::Referrer(), |
| 216 CURRENT_TAB, |
| 217 content::PAGE_TRANSITION_LINK, false); |
| 218 content::WebContents* web_contents = browser()->OpenURL(params); |
| 219 |
| 220 ExtensionTestMessageListener listeners_setup("ready1", true); |
| 221 ExtensionTestMessageListener fullscreen_entered("ready2", true); |
| 222 |
| 223 ASSERT_TRUE(RunExtensionSubtest("tab_capture/experimental", |
| 224 "fullscreen_test.html")) << message_; |
| 225 EXPECT_TRUE(listeners_setup.WaitUntilSatisfied()); |
| 226 |
| 227 // Toggle fullscreen after setting up listeners. |
| 228 browser()->fullscreen_controller()->ToggleFullscreenModeForTab(web_contents, |
| 229 true); |
| 230 listeners_setup.Reply(""); |
| 231 |
| 232 // Toggle again after JS should have the event. |
| 233 EXPECT_TRUE(fullscreen_entered.WaitUntilSatisfied()); |
| 234 browser()->fullscreen_controller()->ToggleFullscreenModeForTab(web_contents, |
| 235 false); |
| 236 fullscreen_entered.Reply(""); |
| 237 |
| 238 ResultCatcher catcher; |
| 239 catcher.RestrictToProfile(browser()->profile()); |
| 240 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 241 } |
| 242 |
191 } // namespace chrome | 243 } // namespace chrome |
OLD | NEW |