OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/bind.h" | 5 #include "base/bind.h" |
6 #include "base/bind_helpers.h" | 6 #include "base/bind_helpers.h" |
7 #include "base/location.h" | 7 #include "base/location.h" |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 ADD_FAILURE() << ("Failed to launch simulated fullscreen Flash plugin. " | 82 ADD_FAILURE() << ("Failed to launch simulated fullscreen Flash plugin. " |
83 "Interactive UI testing cannot proceed."); | 83 "Interactive UI testing cannot proceed."); |
84 return false; | 84 return false; |
85 } | 85 } |
86 | 86 |
87 EXPECT_TRUE(ObserveTabIsInFullscreen(true)); | 87 EXPECT_TRUE(ObserveTabIsInFullscreen(true)); |
88 | 88 |
89 return !::testing::Test::HasFailure(); | 89 return !::testing::Test::HasFailure(); |
90 } | 90 } |
91 | 91 |
| 92 bool LaunchFlashFullscreenInSubframe() { |
| 93 // Start the embedded test server and set it up to serve PPAPI test case |
| 94 // URLs. |
| 95 base::FilePath document_root; |
| 96 EXPECT_TRUE(ui_test_utils::GetRelativeBuildDirectory(&document_root)); |
| 97 embedded_test_server()->AddDefaultHandlers(document_root); |
| 98 if (!embedded_test_server()->Start()) { |
| 99 ADD_FAILURE() << "Failed to launch embedded test server."; |
| 100 return false; |
| 101 } |
| 102 |
| 103 // Load a page with an <iframe> that points to the test case URL, which |
| 104 // runs the simulated fullscreen Flash plugin. In OOPIF modes, the frame |
| 105 // will render in a separate process. Block until the plugin has completed |
| 106 // an attempt to enter Flash fullscreen mode. |
| 107 GURL test_url = GetTestURL(*embedded_test_server(), |
| 108 "FlashFullscreenForBrowserUI", std::string()); |
| 109 GURL main_url("data:text/html,<iframe src='" + test_url.spec() + |
| 110 "'></iframe>"); |
| 111 OutOfProcessPPAPITest::RunTestURL(main_url); |
| 112 |
| 113 if (::testing::Test::HasFailure()) { |
| 114 ADD_FAILURE() << ("Failed to launch simulated fullscreen Flash plugin. " |
| 115 "Interactive UI testing cannot proceed."); |
| 116 return false; |
| 117 } |
| 118 |
| 119 EXPECT_TRUE(ObserveTabIsInFullscreen(true)); |
| 120 |
| 121 return !::testing::Test::HasFailure(); |
| 122 } |
| 123 |
92 void UseAcceleratorToOpenNewTab() { | 124 void UseAcceleratorToOpenNewTab() { |
93 content::WebContents* const old_tab_contents = GetActiveWebContents(); | 125 content::WebContents* const old_tab_contents = GetActiveWebContents(); |
94 EXPECT_TRUE(ui_test_utils::SendKeyPressSync( | 126 EXPECT_TRUE(ui_test_utils::SendKeyPressSync( |
95 browser(), ui::VKEY_T, !kIsMacUI, false, false, kIsMacUI)); | 127 browser(), ui::VKEY_T, !kIsMacUI, false, false, kIsMacUI)); |
96 EXPECT_TRUE(RunLoopUntil(base::Bind( | 128 EXPECT_TRUE(RunLoopUntil(base::Bind( |
97 &FlashFullscreenInteractiveBrowserTest::IsObservingActiveWebContents, | 129 &FlashFullscreenInteractiveBrowserTest::IsObservingActiveWebContents, |
98 base::Unretained(this), | 130 base::Unretained(this), |
99 old_tab_contents, | 131 old_tab_contents, |
100 false))); | 132 false))); |
101 } | 133 } |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 FullscreenWithinTab_EscapeKeyExitsFullscreen) { | 297 FullscreenWithinTab_EscapeKeyExitsFullscreen) { |
266 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 298 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
267 StartFakingTabCapture(); | 299 StartFakingTabCapture(); |
268 ASSERT_TRUE(LaunchFlashFullscreen()); | 300 ASSERT_TRUE(LaunchFlashFullscreen()); |
269 content::WebContents* const first_tab_contents = GetActiveWebContents(); | 301 content::WebContents* const first_tab_contents = GetActiveWebContents(); |
270 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); | 302 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); |
271 PressEscape(); | 303 PressEscape(); |
272 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); | 304 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); |
273 } | 305 } |
274 | 306 |
| 307 IN_PROC_BROWSER_TEST_F(FlashFullscreenInteractiveBrowserTest, |
| 308 FullscreenFromSubframe) { |
| 309 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
| 310 StartFakingTabCapture(); |
| 311 ASSERT_TRUE(LaunchFlashFullscreenInSubframe()); |
| 312 content::WebContents* const first_tab_contents = GetActiveWebContents(); |
| 313 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); |
| 314 PressEscape(); |
| 315 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); |
| 316 } |
| 317 |
275 // This tests that browser UI focus behavior is correct when switching between | 318 // This tests that browser UI focus behavior is correct when switching between |
276 // tabs; particularly, that that focus between the omnibox and tab contents is | 319 // tabs; particularly, that that focus between the omnibox and tab contents is |
277 // stored/restored correctly. Mouse and keyboard events are used to confirm | 320 // stored/restored correctly. Mouse and keyboard events are used to confirm |
278 // that the widget the UI thinks is focused is the one that responds to these | 321 // that the widget the UI thinks is focused is the one that responds to these |
279 // input events. | 322 // input events. |
280 // | 323 // |
281 // Flaky, see http://crbug.com/444476 | 324 // Flaky, see http://crbug.com/444476 |
282 IN_PROC_BROWSER_TEST_F(FlashFullscreenInteractiveBrowserTest, | 325 IN_PROC_BROWSER_TEST_F(FlashFullscreenInteractiveBrowserTest, |
283 DISABLED_FullscreenWithinTab_FocusWhenSwitchingTabs) { | 326 DISABLED_FullscreenWithinTab_FocusWhenSwitchingTabs) { |
284 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); | 327 ASSERT_TRUE(ui_test_utils::BringBrowserWindowToFront(browser())); |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
348 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorRED)); | 391 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorRED)); |
349 PressSpacebar(); | 392 PressSpacebar(); |
350 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorBLUE)); | 393 ASSERT_TRUE(ObserveFlashFillColor(SK_ColorBLUE)); |
351 | 394 |
352 // Test that the Escape key is handled as an exit fullscreen command while the | 395 // Test that the Escape key is handled as an exit fullscreen command while the |
353 // Flash widget has the focus. | 396 // Flash widget has the focus. |
354 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); | 397 EXPECT_TRUE(ObserveFlashHasFocus(first_tab_contents, true)); |
355 PressEscape(); | 398 PressEscape(); |
356 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); | 399 EXPECT_TRUE(ObserveTabIsInFullscreen(false)); |
357 } | 400 } |
OLD | NEW |