| Index: chrome/browser/site_per_process_interactive_browsertest.cc
|
| diff --git a/chrome/browser/site_per_process_interactive_browsertest.cc b/chrome/browser/site_per_process_interactive_browsertest.cc
|
| index cc07a494c58115b47ba41e69e668c47475e8496d..17fdbe539cda066e20a09ac4add980c8cb00a292 100644
|
| --- a/chrome/browser/site_per_process_interactive_browsertest.cc
|
| +++ b/chrome/browser/site_per_process_interactive_browsertest.cc
|
| @@ -3,24 +3,17 @@
|
| // found in the LICENSE file.
|
|
|
| #include "base/command_line.h"
|
| -#include "base/strings/string_number_conversions.h"
|
| #include "chrome/browser/ui/browser.h"
|
| -#include "chrome/browser/ui/browser_window.h"
|
| #include "chrome/browser/ui/tabs/tab_strip_model.h"
|
| #include "chrome/test/base/in_process_browser_test.h"
|
| -#include "chrome/test/base/interactive_test_utils.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "content/public/browser/render_frame_host.h"
|
| -#include "content/public/browser/render_widget_host_view.h"
|
| #include "content/public/browser/web_contents.h"
|
| #include "content/public/test/browser_test_utils.h"
|
| #include "content/public/test/content_browser_test_utils.h"
|
| -#include "content/public/test/test_navigation_observer.h"
|
| #include "content/public/test/test_utils.h"
|
| #include "net/dns/mock_host_resolver.h"
|
| #include "net/test/embedded_test_server/embedded_test_server.h"
|
| -#include "ui/display/display.h"
|
| -#include "ui/display/screen.h"
|
| #include "url/gurl.h"
|
|
|
| class SitePerProcessInteractiveBrowserTest : public InProcessBrowserTest {
|
| @@ -39,15 +32,6 @@
|
| embedded_test_server()->ServeFilesFromSourceDirectory("content/test/data");
|
|
|
| ASSERT_TRUE(embedded_test_server()->Start());
|
| - }
|
| -
|
| - gfx::Size GetScreenSize() {
|
| - content::WebContents* web_contents =
|
| - browser()->tab_strip_model()->GetActiveWebContents();
|
| - const display::Display display =
|
| - display::Screen::GetScreen()->GetDisplayNearestWindow(
|
| - web_contents->GetRenderWidgetHostView()->GetNativeView());
|
| - return display.bounds().size();
|
| }
|
|
|
| private:
|
| @@ -248,452 +232,3 @@
|
| EXPECT_EQ(main_frame, web_contents->GetFocusedFrame());
|
| }
|
|
|
| -namespace {
|
| -
|
| -// Helper to retrieve the frame's (window.innerWidth, window.innerHeight).
|
| -gfx::Size GetFrameSize(content::RenderFrameHost* frame) {
|
| - int width = 0;
|
| - EXPECT_TRUE(ExecuteScriptAndExtractInt(
|
| - frame, "domAutomationController.send(window.innerWidth);", &width));
|
| -
|
| - int height = 0;
|
| - EXPECT_TRUE(ExecuteScriptAndExtractInt(
|
| - frame, "domAutomationController.send(window.innerHeight);", &height));
|
| -
|
| - return gfx::Size(width, height);
|
| -}
|
| -
|
| -// Helper to check |frame|'s document.webkitFullscreenElement and return its ID
|
| -// if it's defined (which is the case when |frame| is in fullscreen mode), or
|
| -// "none" otherwise.
|
| -std::string GetFullscreenElementId(content::RenderFrameHost* frame) {
|
| - std::string fullscreen_element;
|
| - EXPECT_TRUE(ExecuteScriptAndExtractString(
|
| - frame,
|
| - "domAutomationController.send("
|
| - " document.webkitFullscreenElement ? "
|
| - " document.webkitFullscreenElement.id : 'none')",
|
| - &fullscreen_element));
|
| - return fullscreen_element;
|
| -}
|
| -
|
| -// Helper to check if an element with ID |element_id| has the
|
| -// :-webkit-full-screen style.
|
| -bool ElementHasFullscreenStyle(content::RenderFrameHost* frame,
|
| - const std::string& element_id) {
|
| - bool has_style = false;
|
| - std::string script = base::StringPrintf(
|
| - "domAutomationController.send("
|
| - " document.querySelectorAll('#%s:-webkit-full-screen').length == 1)",
|
| - element_id.c_str());
|
| - EXPECT_TRUE(ExecuteScriptAndExtractBool(frame, script, &has_style));
|
| - return has_style;
|
| -}
|
| -
|
| -// Helper to check if an element with ID |element_id| has the
|
| -// :-webkit-full-screen-ancestor style.
|
| -bool ElementHasFullscreenAncestorStyle(content::RenderFrameHost* host,
|
| - const std::string& element_id) {
|
| - bool has_style = false;
|
| - std::string script = base::StringPrintf(
|
| - "domAutomationController.send("
|
| - " document.querySelectorAll("
|
| - " '#%s:-webkit-full-screen-ancestor').length == 1)",
|
| - element_id.c_str());
|
| - EXPECT_TRUE(ExecuteScriptAndExtractBool(host, script, &has_style));
|
| - return has_style;
|
| -}
|
| -
|
| -// Set the allowFullscreen attribute on the <iframe> element identified by
|
| -// |frame_id|.
|
| -void SetAllowFullscreenForFrame(content::RenderFrameHost* host,
|
| - const std::string& frame_id) {
|
| - EXPECT_TRUE(ExecuteScript(
|
| - host, base::StringPrintf(
|
| - "document.getElementById('%s').allowFullscreen = true;",
|
| - frame_id.c_str())));
|
| -}
|
| -
|
| -// Add a listener that will send back a message whenever the (prefixed)
|
| -// fullscreenchange event fires. The message will be "fullscreenchange",
|
| -// followed by a space and the provided |id|.
|
| -void AddFullscreenChangeListener(content::RenderFrameHost* frame,
|
| - const std::string& id) {
|
| - std::string script = base::StringPrintf(
|
| - "document.addEventListener('webkitfullscreenchange', function() {"
|
| - " domAutomationController.setAutomationId(0);"
|
| - " domAutomationController.send('fullscreenchange %s');});",
|
| - id.c_str());
|
| - EXPECT_TRUE(ExecuteScript(frame, script));
|
| -}
|
| -
|
| -// Helper to add a listener that will send back a "resize" message when the
|
| -// target |frame| is resized to |expected_size|.
|
| -void AddResizeListener(content::RenderFrameHost* frame,
|
| - const gfx::Size& expected_size) {
|
| - std::string script =
|
| - base::StringPrintf("addResizeListener(%d, %d);",
|
| - expected_size.width(), expected_size.height());
|
| - EXPECT_TRUE(ExecuteScript(frame, script));
|
| -}
|
| -
|
| -// Helper to wait for a toggle fullscreen operation to complete in all affected
|
| -// frames. This means waiting for:
|
| -// 1. All fullscreenchange events with id's matching the list in
|
| -// |expected_fullscreen_event_ids|. Typically the list will correspond to
|
| -// events from the actual fullscreen element and all of its ancestor
|
| -// <iframe> elements.
|
| -// 2. A resize event. This will verify that the frame containing the
|
| -// fullscreen element is properly resized. This assumes that the expected
|
| -// size is already registered via AddResizeListener().
|
| -void WaitForMultipleFullscreenEvents(
|
| - const std::set<std::string>& expected_fullscreen_event_ids,
|
| - content::DOMMessageQueue& queue) {
|
| - std::set<std::string> remaining_events(expected_fullscreen_event_ids);
|
| - bool resize_validated = false;
|
| - std::string response;
|
| - while (queue.WaitForMessage(&response)) {
|
| - base::TrimString(response, "\"", &response);
|
| - std::vector<std::string> response_params = base::SplitString(
|
| - response, " ", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
|
| - if (response_params[0] == "fullscreenchange") {
|
| - EXPECT_TRUE(ContainsKey(remaining_events, response_params[1]));
|
| - remaining_events.erase(response_params[1]);
|
| - } else if (response_params[0] == "resize") {
|
| - resize_validated = true;
|
| - }
|
| - if (remaining_events.empty() && resize_validated)
|
| - break;
|
| - }
|
| -}
|
| -
|
| -} // namespace
|
| -
|
| -// Check that an element in a cross-process subframe can enter and exit
|
| -// fullscreen. The test will verify that:
|
| -// - the subframe is properly resized
|
| -// - the WebContents properly enters/exits fullscreen.
|
| -// - document.webkitFullscreenElement is correctly updated in both frames.
|
| -// - fullscreenchange events fire in both frames.
|
| -// - fullscreen CSS is applied correctly in both frames.
|
| -IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
|
| - FullscreenElementInSubframe) {
|
| - // Start on a page with one subframe (id "child-0") that has
|
| - // "allowfullscreen" enabled.
|
| - GURL main_url(embedded_test_server()->GetURL(
|
| - "a.com", "/page_with_allowfullscreen_frame.html"));
|
| - ui_test_utils::NavigateToURL(browser(), main_url);
|
| - content::WebContents* web_contents =
|
| - browser()->tab_strip_model()->GetActiveWebContents();
|
| -
|
| - // Navigate the subframe cross-site to a page with a fullscreenable <div>.
|
| - GURL frame_url(
|
| - embedded_test_server()->GetURL("b.com", "/fullscreen_frame.html"));
|
| - EXPECT_TRUE(NavigateIframeToURL(web_contents, "child-0", frame_url));
|
| -
|
| - content::RenderFrameHost* main_frame = web_contents->GetMainFrame();
|
| - content::RenderFrameHost* child = ChildFrameAt(main_frame, 0);
|
| - gfx::Size original_child_size = GetFrameSize(child);
|
| -
|
| - // Fullscreen the <div> inside the cross-site child frame. Wait until:
|
| - // (1) the fullscreenchange events in main frame and child send a response,
|
| - // (2) the child frame is resized to fill the whole screen.
|
| - AddFullscreenChangeListener(main_frame, "main_frame");
|
| - AddFullscreenChangeListener(child, "child");
|
| - std::set<std::string> expected_events = {"main_frame", "child"};
|
| - AddResizeListener(child, GetScreenSize());
|
| - {
|
| - content::DOMMessageQueue queue;
|
| - EXPECT_TRUE(ExecuteScript(child, "activateFullscreen()"));
|
| - WaitForMultipleFullscreenEvents(expected_events, queue);
|
| - }
|
| -
|
| - // Verify that the browser has entered fullscreen for the current tab.
|
| - EXPECT_TRUE(browser()->window()->IsFullscreen());
|
| - EXPECT_TRUE(browser()->exclusive_access_manager()
|
| - ->fullscreen_controller()
|
| - ->IsFullscreenForTabOrPending(web_contents));
|
| -
|
| - // Verify that the <div> has fullscreen style (:-webkit-full-screen) in the
|
| - // subframe.
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(child, "fullscreen-div"));
|
| -
|
| - // Verify that the main frame has applied proper fullscreen styles to the
|
| - // <iframe> element (:-webkit-full-screen and :-webkit-full-screen-ancestor).
|
| - // This is what causes the <iframe> to stretch and fill the whole viewport.
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(main_frame, "child-0"));
|
| - EXPECT_TRUE(ElementHasFullscreenAncestorStyle(main_frame, "child-0"));
|
| -
|
| - // Check document.webkitFullscreenElement. For main frame, it should point
|
| - // to the subframe, and for subframe, it should point to the fullscreened
|
| - // <div>.
|
| - EXPECT_EQ("child-0", GetFullscreenElementId(main_frame));
|
| - EXPECT_EQ("fullscreen-div", GetFullscreenElementId(child));
|
| -
|
| - // Now exit fullscreen from the subframe. Wait for two fullscreenchange
|
| - // events from both frames, and also for the child to be resized to its
|
| - // original size.
|
| - AddResizeListener(child, original_child_size);
|
| - {
|
| - content::DOMMessageQueue queue;
|
| - EXPECT_TRUE(ExecuteScript(child, "exitFullscreen()"));
|
| - WaitForMultipleFullscreenEvents(expected_events, queue);
|
| - }
|
| -
|
| - EXPECT_FALSE(browser()->window()->IsFullscreen());
|
| -
|
| - // Verify that the fullscreen styles were removed from the <div> and its
|
| - // container <iframe>.
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(child, "fullscreen-div"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(main_frame, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenAncestorStyle(main_frame, "child-0"));
|
| -
|
| - // Check that both frames cleared their document.webkitFullscreenElement.
|
| - EXPECT_EQ("none", GetFullscreenElementId(main_frame));
|
| - EXPECT_EQ("none", GetFullscreenElementId(child));
|
| -}
|
| -
|
| -// Check that on a page with A-embed-B-embed-A frame hierarchy, an element in
|
| -// the bottom frame can enter and exit fullscreen.
|
| -//
|
| -// TODO(alexmos): For now, the test will verify sizing and fullscreen CSS
|
| -// styles, but additional refactoring of Blink's Fullscreen class is required
|
| -// to fully handle fullscreenchange events and webkitFullscreenElement in the
|
| -// main frame.
|
| -IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
|
| - FullscreenElementInABA) {
|
| - GURL main_url(embedded_test_server()->GetURL(
|
| - "a.com", "/cross_site_iframe_factory.html?a(b(a))"));
|
| - ui_test_utils::NavigateToURL(browser(), main_url);
|
| - content::WebContents* web_contents =
|
| - browser()->tab_strip_model()->GetActiveWebContents();
|
| -
|
| - content::RenderFrameHost* main_frame = web_contents->GetMainFrame();
|
| - content::RenderFrameHost* child = ChildFrameAt(main_frame, 0);
|
| - content::RenderFrameHost* grandchild = ChildFrameAt(child, 0);
|
| -
|
| - // Navigate the bottom frame to a page that has a fullscreenable <div>.
|
| - content::TestNavigationObserver observer(web_contents);
|
| - EXPECT_TRUE(
|
| - ExecuteScript(grandchild, "location.href = '/fullscreen_frame.html'"));
|
| - observer.Wait();
|
| - EXPECT_EQ(embedded_test_server()->GetURL("a.com", "/fullscreen_frame.html"),
|
| - grandchild->GetLastCommittedURL());
|
| -
|
| - // Add allowFullscreen attribute to both <iframe> elements.
|
| - SetAllowFullscreenForFrame(main_frame, "child-0");
|
| - SetAllowFullscreenForFrame(child, "child-0");
|
| -
|
| - // Make fullscreenchange events in all three frames send a message.
|
| - AddFullscreenChangeListener(main_frame, "main_frame");
|
| - AddFullscreenChangeListener(child, "child");
|
| - AddFullscreenChangeListener(grandchild, "grandchild");
|
| -
|
| - // Add a resize event handler that will send a message when the grandchild
|
| - // frame is resized to the screen size. Also save its original size.
|
| - AddResizeListener(grandchild, GetScreenSize());
|
| - gfx::Size original_grandchild_size = GetFrameSize(grandchild);
|
| -
|
| - // Fullscreen a <div> inside the bottom subframe. This will block until
|
| - // (1) the fullscreenchange events in all frames send a response, and
|
| - // (2) the frame is resized to fill the whole screen.
|
| - //
|
| - // TODO(alexmos): Also wait for "main_frame" once
|
| - // blink::Fullscreen::requestFullscreen() and exitFullscreen() are fixed to
|
| - // process all local ancestors.
|
| - std::set<std::string> expected_events = {"child", "grandchild"};
|
| - {
|
| - content::DOMMessageQueue queue;
|
| - EXPECT_TRUE(ExecuteScript(grandchild, "activateFullscreen()"));
|
| - WaitForMultipleFullscreenEvents(expected_events, queue);
|
| - }
|
| -
|
| - // Verify that the browser has entered fullscreen for the current tab.
|
| - EXPECT_TRUE(browser()->window()->IsFullscreen());
|
| - EXPECT_TRUE(browser()->exclusive_access_manager()
|
| - ->fullscreen_controller()
|
| - ->IsFullscreenForTabOrPending(web_contents));
|
| -
|
| - // Verify that the <div> has fullscreen style in the bottom frame, and that
|
| - // the proper <iframe> elements have fullscreen style in its ancestor frames.
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(grandchild, "fullscreen-div"));
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(child, "child-0"));
|
| - EXPECT_TRUE(ElementHasFullscreenAncestorStyle(child, "child-0"));
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(main_frame, "child-0"));
|
| - EXPECT_TRUE(ElementHasFullscreenAncestorStyle(main_frame, "child-0"));
|
| -
|
| - // Check document.webkitFullscreenElement in all frames.
|
| - EXPECT_EQ("child-0", GetFullscreenElementId(child));
|
| - EXPECT_EQ("fullscreen-div", GetFullscreenElementId(grandchild));
|
| - // TODO(alexmos): Also check that |main_frame|'s webkitFullscreenElement is
|
| - // "child-0" once blink::Fullscreen::requestFullscreen() is fixed to handle
|
| - // all local ancestors.
|
| -
|
| - // Now exit fullscreen from the subframe.
|
| - AddResizeListener(grandchild, original_grandchild_size);
|
| - {
|
| - content::DOMMessageQueue queue;
|
| - EXPECT_TRUE(ExecuteScript(grandchild, "exitFullscreen()"));
|
| - WaitForMultipleFullscreenEvents(expected_events, queue);
|
| - }
|
| -
|
| - EXPECT_FALSE(browser()->window()->IsFullscreen());
|
| -
|
| - // Verify that the fullscreen styles were removed from the <div> and its
|
| - // container <iframe>'s.
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(grandchild, "fullscreen-div"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(child, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenAncestorStyle(child, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(main_frame, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenAncestorStyle(main_frame, "child-0"));
|
| -
|
| - // Check that document.webkitFullscreenElement was cleared in all three
|
| - // frames.
|
| - EXPECT_EQ("none", GetFullscreenElementId(main_frame));
|
| - EXPECT_EQ("none", GetFullscreenElementId(child));
|
| - EXPECT_EQ("none", GetFullscreenElementId(grandchild));
|
| -}
|
| -
|
| -// Check that fullscreen works on a more complex page hierarchy with multiple
|
| -// local and remote ancestors. The test uses this frame tree:
|
| -//
|
| -// A (a_top)
|
| -// |
|
| -// A (a_bottom)
|
| -// / \ .
|
| -// (b_first) B B (b_second)
|
| -// |
|
| -// C (c_top)
|
| -// |
|
| -// C (c_middle) <- fullscreen target
|
| -// |
|
| -// C (c_bottom)
|
| -//
|
| -// The c_middle frame will trigger fullscreen for its <div> element. The test
|
| -// verifies that its ancestor chain is properly updated for fullscreen, and
|
| -// that the b_first node that's not on the chain is not affected.
|
| -//
|
| -// The test also exits fullscreen by simulating pressing ESC rather than using
|
| -// document.webkitExitFullscreen(), which tests the browser-initiated
|
| -// fullscreen exit path.
|
| -IN_PROC_BROWSER_TEST_F(SitePerProcessInteractiveBrowserTest,
|
| - FullscreenElementInMultipleSubframes) {
|
| - GURL main_url(embedded_test_server()->GetURL(
|
| - "a.com", "/cross_site_iframe_factory.html?a(a(b,b(c(c))))"));
|
| - ui_test_utils::NavigateToURL(browser(), main_url);
|
| - content::WebContents* web_contents =
|
| - browser()->tab_strip_model()->GetActiveWebContents();
|
| -
|
| - content::RenderFrameHost* a_top = web_contents->GetMainFrame();
|
| - content::RenderFrameHost* a_bottom = ChildFrameAt(a_top, 0);
|
| - content::RenderFrameHost* b_first = ChildFrameAt(a_bottom, 0);
|
| - content::RenderFrameHost* b_second = ChildFrameAt(a_bottom, 1);
|
| - content::RenderFrameHost* c_top = ChildFrameAt(b_second, 0);
|
| - content::RenderFrameHost* c_middle = ChildFrameAt(c_top, 0);
|
| -
|
| - // Allow fullscreen in all iframes descending to |c_middle|. This relies on
|
| - // IDs that cross_site_iframe_factory assigns to child frames.
|
| - SetAllowFullscreenForFrame(a_top, "child-0");
|
| - SetAllowFullscreenForFrame(a_bottom, "child-1");
|
| - SetAllowFullscreenForFrame(b_second, "child-0");
|
| - SetAllowFullscreenForFrame(c_top, "child-0");
|
| -
|
| - // Navigate |c_middle| to a page that has a fullscreenable <div> and another
|
| - // frame.
|
| - content::TestNavigationObserver observer(web_contents);
|
| - EXPECT_TRUE(
|
| - ExecuteScript(c_middle, "location.href = '/fullscreen_frame.html'"));
|
| - observer.Wait();
|
| - EXPECT_EQ(embedded_test_server()->GetURL("c.com", "/fullscreen_frame.html"),
|
| - c_middle->GetLastCommittedURL());
|
| - content::RenderFrameHost* c_bottom = ChildFrameAt(c_middle, 0);
|
| -
|
| - // Save the size of the frame to be fullscreened.
|
| - gfx::Size c_middle_original_size = GetFrameSize(c_middle);
|
| -
|
| - // Add fullscreenchange and resize event handlers to all frames.
|
| - AddFullscreenChangeListener(a_top, "a_top");
|
| - AddFullscreenChangeListener(a_bottom, "a_bottom");
|
| - AddFullscreenChangeListener(b_first, "b_first");
|
| - AddFullscreenChangeListener(b_second, "b_second");
|
| - AddFullscreenChangeListener(c_top, "c_top");
|
| - AddFullscreenChangeListener(c_middle, "c_middle");
|
| - AddFullscreenChangeListener(c_bottom, "c_bottom");
|
| - AddResizeListener(c_middle, GetScreenSize());
|
| -
|
| - // Note that expected fullscreenchange events do NOT include |b_first| and
|
| - // |c_bottom|, which aren't on the ancestor chain of |c_middle|.
|
| - // WaitForMultipleFullscreenEvents() below will fail if it hears an
|
| - // unexpected fullscreenchange from one of these frames.
|
| - std::set<std::string> expected_events = {"a_top", "a_bottom", "b_second",
|
| - "c_top", "c_middle"};
|
| -
|
| - // Fullscreen a <div> inside |c_middle|. Block until (1) the
|
| - // fullscreenchange events in |c_middle| and all its ancestors send a
|
| - // response, and (2) |c_middle| is resized to fill the whole screen.
|
| - {
|
| - content::DOMMessageQueue queue;
|
| - EXPECT_TRUE(ExecuteScript(c_middle, "activateFullscreen()"));
|
| - WaitForMultipleFullscreenEvents(expected_events, queue);
|
| - }
|
| -
|
| - // Verify that the browser has entered fullscreen for the current tab.
|
| - EXPECT_TRUE(browser()->window()->IsFullscreen());
|
| - EXPECT_TRUE(browser()->exclusive_access_manager()
|
| - ->fullscreen_controller()
|
| - ->IsFullscreenForTabOrPending(web_contents));
|
| -
|
| - // Check document.webkitFullscreenElement. It should point to corresponding
|
| - // <iframe> element IDs on |c_middle|'s ancestor chain, and it should be null
|
| - // in b_first and c_bottom.
|
| - EXPECT_EQ("child-0", GetFullscreenElementId(a_top));
|
| - EXPECT_EQ("child-1", GetFullscreenElementId(a_bottom));
|
| - EXPECT_EQ("child-0", GetFullscreenElementId(b_second));
|
| - EXPECT_EQ("child-0", GetFullscreenElementId(c_top));
|
| - EXPECT_EQ("fullscreen-div", GetFullscreenElementId(c_middle));
|
| - EXPECT_EQ("none", GetFullscreenElementId(b_first));
|
| - EXPECT_EQ("none", GetFullscreenElementId(c_bottom));
|
| -
|
| - // Verify that the fullscreen element and all <iframe> elements on its
|
| - // ancestor chain have fullscreen style, but other frames do not.
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(a_top, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(a_bottom, "child-0"));
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(a_bottom, "child-1"));
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(b_second, "child-0"));
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(c_top, "child-0"));
|
| - EXPECT_TRUE(ElementHasFullscreenStyle(c_middle, "fullscreen-div"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(c_middle, "child-0"));
|
| -
|
| - // Now exit fullscreen by pressing escape. Wait for all fullscreenchange
|
| - // events fired for fullscreen exit and verify that the bottom frame was
|
| - // resized back to its original size.
|
| - AddResizeListener(c_middle, c_middle_original_size);
|
| - {
|
| - content::DOMMessageQueue queue;
|
| - ASSERT_TRUE(ui_test_utils::SendKeyPressSync(browser(), ui::VKEY_ESCAPE,
|
| - false, false, false, false));
|
| - WaitForMultipleFullscreenEvents(expected_events, queue);
|
| - }
|
| -
|
| - EXPECT_FALSE(browser()->window()->IsFullscreen());
|
| -
|
| - // Check that document.webkitFullscreenElement has been cleared in all
|
| - // frames.
|
| - EXPECT_EQ("none", GetFullscreenElementId(a_top));
|
| - EXPECT_EQ("none", GetFullscreenElementId(a_bottom));
|
| - EXPECT_EQ("none", GetFullscreenElementId(b_first));
|
| - EXPECT_EQ("none", GetFullscreenElementId(b_second));
|
| - EXPECT_EQ("none", GetFullscreenElementId(c_top));
|
| - EXPECT_EQ("none", GetFullscreenElementId(c_middle));
|
| - EXPECT_EQ("none", GetFullscreenElementId(c_bottom));
|
| -
|
| - // Verify that all fullscreen styles have been cleared.
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(a_top, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(a_bottom, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(a_bottom, "child-1"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(b_second, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(c_top, "child-0"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(c_middle, "fullscreen-div"));
|
| - EXPECT_FALSE(ElementHasFullscreenStyle(c_middle, "child-0"));
|
| -}
|
| -
|
|
|