| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/strings/string_number_conversions.h" | 6 #include "base/strings/string_number_conversions.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.h" |
| 8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
| 9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" | 9 #include "chrome/browser/ui/exclusive_access/fullscreen_controller_test.h" |
| 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 10 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 381 } // namespace | 381 } // namespace |
| 382 | 382 |
| 383 // Check that an element in a cross-process subframe can enter and exit | 383 // Check that an element in a cross-process subframe can enter and exit |
| 384 // fullscreen. The test will verify that: | 384 // fullscreen. The test will verify that: |
| 385 // - the subframe is properly resized | 385 // - the subframe is properly resized |
| 386 // - the WebContents properly enters/exits fullscreen. | 386 // - the WebContents properly enters/exits fullscreen. |
| 387 // - document.webkitFullscreenElement is correctly updated in both frames. | 387 // - document.webkitFullscreenElement is correctly updated in both frames. |
| 388 // - fullscreenchange events fire in both frames. | 388 // - fullscreenchange events fire in both frames. |
| 389 // - fullscreen CSS is applied correctly in both frames. | 389 // - fullscreen CSS is applied correctly in both frames. |
| 390 // | 390 // |
| 391 // Flaky on Windows: https://crbug.com/647311 | |
| 392 #if defined(OS_WIN) | |
| 393 #define MAYBE_FullscreenElementInSubframe DISABLED_FullscreenElementInSubframe | |
| 394 #else | |
| 395 #define MAYBE_FullscreenElementInSubframe FullscreenElementInSubframe | |
| 396 #endif | |
| 397 IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, | 391 IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, |
| 398 MAYBE_FullscreenElementInSubframe) { | 392 FullscreenElementInSubframe) { |
| 399 // Start on a page with one subframe (id "child-0") that has | 393 // Start on a page with one subframe (id "child-0") that has |
| 400 // "allowfullscreen" enabled. | 394 // "allowfullscreen" enabled. |
| 401 GURL main_url(embedded_test_server()->GetURL( | 395 GURL main_url(embedded_test_server()->GetURL( |
| 402 "a.com", "/page_with_allowfullscreen_frame.html")); | 396 "a.com", "/page_with_allowfullscreen_frame.html")); |
| 403 ui_test_utils::NavigateToURL(browser(), main_url); | 397 ui_test_utils::NavigateToURL(browser(), main_url); |
| 404 content::WebContents* web_contents = | 398 content::WebContents* web_contents = |
| 405 browser()->tab_strip_model()->GetActiveWebContents(); | 399 browser()->tab_strip_model()->GetActiveWebContents(); |
| 406 | 400 |
| 407 // Navigate the subframe cross-site to a page with a fullscreenable <div>. | 401 // Navigate the subframe cross-site to a page with a fullscreenable <div>. |
| 408 GURL frame_url( | 402 GURL frame_url( |
| (...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 581 EXPECT_FALSE(ElementHasFullscreenStyle(main_frame, "child-0")); | 575 EXPECT_FALSE(ElementHasFullscreenStyle(main_frame, "child-0")); |
| 582 EXPECT_FALSE(ElementHasFullscreenAncestorStyle(main_frame, "child-0")); | 576 EXPECT_FALSE(ElementHasFullscreenAncestorStyle(main_frame, "child-0")); |
| 583 | 577 |
| 584 // Check that document.webkitFullscreenElement was cleared in all three | 578 // Check that document.webkitFullscreenElement was cleared in all three |
| 585 // frames. | 579 // frames. |
| 586 EXPECT_EQ("none", GetFullscreenElementId(main_frame)); | 580 EXPECT_EQ("none", GetFullscreenElementId(main_frame)); |
| 587 EXPECT_EQ("none", GetFullscreenElementId(child)); | 581 EXPECT_EQ("none", GetFullscreenElementId(child)); |
| 588 EXPECT_EQ("none", GetFullscreenElementId(grandchild)); | 582 EXPECT_EQ("none", GetFullscreenElementId(grandchild)); |
| 589 } | 583 } |
| 590 | 584 |
| 591 // Flaky on Windows: https://crbug.com/647311 | |
| 592 #if defined(OS_WIN) | |
| 593 #define MAYBE_FullscreenElementInABAAndExitViaEscapeKey DISABLED_FullscreenEleme
ntInABAAndExitViaEscapeKey | |
| 594 #else | |
| 595 #define MAYBE_FullscreenElementInABAAndExitViaEscapeKey FullscreenElementInABAAn
dExitViaEscapeKey | |
| 596 #endif | |
| 597 IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, | 585 IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, |
| 598 MAYBE_FullscreenElementInABAAndExitViaEscapeKey) { | 586 FullscreenElementInABAAndExitViaEscapeKey) { |
| 599 FullscreenElementInABA(FullscreenExitMethod::ESC_PRESS); | 587 FullscreenElementInABA(FullscreenExitMethod::ESC_PRESS); |
| 600 } | 588 } |
| 601 | 589 |
| 602 IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, | 590 IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest, |
| 603 FullscreenElementInABAAndExitViaJS) { | 591 FullscreenElementInABAAndExitViaJS) { |
| 604 FullscreenElementInABA(FullscreenExitMethod::JS_CALL); | 592 FullscreenElementInABA(FullscreenExitMethod::JS_CALL); |
| 605 } | 593 } |
| 606 | 594 |
| 607 // Check that fullscreen works on a more complex page hierarchy with multiple | 595 // Check that fullscreen works on a more complex page hierarchy with multiple |
| 608 // local and remote ancestors. The test uses this frame tree: | 596 // local and remote ancestors. The test uses this frame tree: |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 776 "document.pointerLockElement)", | 764 "document.pointerLockElement)", |
| 777 &mouse_locked)); | 765 &mouse_locked)); |
| 778 EXPECT_TRUE(mouse_locked); | 766 EXPECT_TRUE(mouse_locked); |
| 779 EXPECT_TRUE(main_frame->GetView()->IsMouseLocked()); | 767 EXPECT_TRUE(main_frame->GetView()->IsMouseLocked()); |
| 780 | 768 |
| 781 EXPECT_TRUE(ExecuteScript(main_frame, | 769 EXPECT_TRUE(ExecuteScript(main_frame, |
| 782 "document.querySelector('iframe').parentNode." | 770 "document.querySelector('iframe').parentNode." |
| 783 "removeChild(document.querySelector('iframe'))")); | 771 "removeChild(document.querySelector('iframe'))")); |
| 784 EXPECT_FALSE(main_frame->GetView()->IsMouseLocked()); | 772 EXPECT_FALSE(main_frame->GetView()->IsMouseLocked()); |
| 785 } | 773 } |
| OLD | NEW |