| Index: Source/web/tests/WebFrameTest.cpp
|
| diff --git a/Source/web/tests/WebFrameTest.cpp b/Source/web/tests/WebFrameTest.cpp
|
| index 2b0965ea90adf4a8d217361aa30c9f75d9ffc256..d90a7bba9292f24d46f7001edecea1ec9ad17e29 100644
|
| --- a/Source/web/tests/WebFrameTest.cpp
|
| +++ b/Source/web/tests/WebFrameTest.cpp
|
| @@ -66,6 +66,7 @@
|
| #include "core/page/EventHandler.h"
|
| #include "core/page/Page.h"
|
| #include "core/rendering/HitTestResult.h"
|
| +#include "core/rendering/RenderFullScreen.h"
|
| #include "core/rendering/RenderView.h"
|
| #include "core/rendering/compositing/RenderLayerCompositor.h"
|
| #include "core/testing/URLTestHelpers.h"
|
| @@ -142,11 +143,6 @@ const int touchPointPadding = 32;
|
| } while (false)
|
|
|
|
|
| -class FakeCompositingWebViewClient : public FrameTestHelpers::TestWebViewClient {
|
| -public:
|
| - virtual bool enterFullScreen() override { return true; }
|
| -};
|
| -
|
| class WebFrameTest : public testing::Test {
|
| protected:
|
| WebFrameTest()
|
| @@ -702,6 +698,11 @@ class FixedLayoutTestWebViewClient : public FrameTestHelpers::TestWebViewClient
|
| WebScreenInfo m_screenInfo;
|
| };
|
|
|
| +class FakeCompositingWebViewClient : public FixedLayoutTestWebViewClient {
|
| +public:
|
| + virtual bool enterFullScreen() override { return true; }
|
| +};
|
| +
|
| // Viewport settings need to be set before the page gets loaded
|
| static void enableViewportSettings(WebSettings* settings)
|
| {
|
| @@ -6115,6 +6116,41 @@ TEST_F(WebFrameTest, DISABLED_FrameViewScrollAccountsForTopControls)
|
| EXPECT_POINT_EQ(IntPoint(50, 51), frameView->maximumScrollPosition());
|
| }
|
|
|
| +TEST_F(WebFrameTest, FullscreenLayerSize)
|
| +{
|
| + FakeCompositingWebViewClient client;
|
| + registerMockedHttpURLLoad("fullscreen_div.html");
|
| + FrameTestHelpers::WebViewHelper webViewHelper;
|
| + int viewportWidth = 640;
|
| + int viewportHeight = 480;
|
| + client.m_screenInfo.rect.width = viewportWidth;
|
| + client.m_screenInfo.rect.height = viewportHeight;
|
| + WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_div.html", true, 0, &client, configurePinchVirtualViewport);
|
| + webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
|
| + webViewImpl->layout();
|
| +
|
| + Document* document = toWebLocalFrameImpl(webViewImpl->mainFrame())->frame()->document();
|
| + UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
|
| + Element* divFullscreen = document->getElementById("div1");
|
| + Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest);
|
| + webViewImpl->didEnterFullScreen();
|
| + webViewImpl->layout();
|
| + ASSERT_TRUE(Fullscreen::isFullScreen(*document));
|
| +
|
| + // Verify that the element is sized to the viewport.
|
| + RenderFullScreen* fullscreenRenderer = Fullscreen::from(*document).fullScreenRenderer();
|
| + EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalWidth().toInt());
|
| + EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalHeight().toInt());
|
| +
|
| + // Verify it's updated after a device rotation.
|
| + client.m_screenInfo.rect.width = viewportHeight;
|
| + client.m_screenInfo.rect.height = viewportWidth;
|
| + webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
|
| + webViewImpl->layout();
|
| + EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalWidth().toInt());
|
| + EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalHeight().toInt());
|
| +}
|
| +
|
| TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
|
| {
|
| FakeCompositingWebViewClient client;
|
| @@ -6122,7 +6158,7 @@ TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| int viewportWidth = 640;
|
| int viewportHeight = 480;
|
| - WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_div.html", true, 0, &client, &configueCompositingWebView);
|
| + WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_div.html", true, 0, &client, configurePinchVirtualViewport);
|
| webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
|
| webViewImpl->layout();
|
|
|
| @@ -6133,17 +6169,19 @@ TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
|
| webViewImpl->didEnterFullScreen();
|
| webViewImpl->layout();
|
|
|
| - // Verify that the main frame bounds are empty.
|
| + // Verify that the main frame is nonscrollable.
|
| ASSERT_TRUE(Fullscreen::isFullScreen(*document));
|
| WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platformLayer();
|
| - ASSERT_EQ(WebSize(), webScrollLayer->bounds());
|
| + ASSERT_FALSE(webScrollLayer->userScrollableHorizontal());
|
| + ASSERT_FALSE(webScrollLayer->userScrollableVertical());
|
|
|
| // Verify that the main frame is scrollable upon exiting fullscreen.
|
| webViewImpl->didExitFullScreen();
|
| webViewImpl->layout();
|
| ASSERT_FALSE(Fullscreen::isFullScreen(*document));
|
| webScrollLayer = webViewImpl->compositor()->scrollLayer()->platformLayer();
|
| - ASSERT_NE(WebSize(), webScrollLayer->bounds());
|
| + ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
|
| + ASSERT_TRUE(webScrollLayer->userScrollableVertical());
|
| }
|
|
|
| TEST_F(WebFrameTest, FullscreenMainFrameScrollable)
|
| @@ -6153,7 +6191,7 @@ TEST_F(WebFrameTest, FullscreenMainFrameScrollable)
|
| FrameTestHelpers::WebViewHelper webViewHelper;
|
| int viewportWidth = 640;
|
| int viewportHeight = 480;
|
| - WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_div.html", true, 0, &client, &configueCompositingWebView);
|
| + WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_div.html", true, 0, &client, configurePinchVirtualViewport);
|
| webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
|
| webViewImpl->layout();
|
|
|
| @@ -6167,6 +6205,43 @@ TEST_F(WebFrameTest, FullscreenMainFrameScrollable)
|
| ASSERT_TRUE(Fullscreen::isFullScreen(*document));
|
| WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platformLayer();
|
| ASSERT_TRUE(webScrollLayer->scrollable());
|
| + ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
|
| + ASSERT_TRUE(webScrollLayer->userScrollableVertical());
|
| +}
|
| +
|
| +TEST_F(WebFrameTest, FullscreenSubframe)
|
| +{
|
| + FakeCompositingWebViewClient client;
|
| + registerMockedHttpURLLoad("fullscreen_iframe.html");
|
| + registerMockedHttpURLLoad("fullscreen_div.html");
|
| + FrameTestHelpers::WebViewHelper webViewHelper;
|
| + WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "fullscreen_iframe.html", true, 0, &client, configurePinchVirtualViewport);
|
| + int viewportWidth = 640;
|
| + int viewportHeight = 480;
|
| + client.m_screenInfo.rect.width = viewportWidth;
|
| + client.m_screenInfo.rect.height = viewportHeight;
|
| + webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
|
| + webViewImpl->layout();
|
| +
|
| + Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame()->firstChild())->frame()->document();
|
| + UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
|
| + Element* divFullscreen = document->getElementById("div1");
|
| + Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::PrefixedRequest);
|
| + webViewImpl->didEnterFullScreen();
|
| + webViewImpl->layout();
|
| +
|
| + // Verify that the element is sized to the viewport.
|
| + RenderFullScreen* fullscreenRenderer = Fullscreen::from(*document).fullScreenRenderer();
|
| + EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalWidth().toInt());
|
| + EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalHeight().toInt());
|
| +
|
| + // Verify it's updated after a device rotation.
|
| + client.m_screenInfo.rect.width = viewportHeight;
|
| + client.m_screenInfo.rect.height = viewportWidth;
|
| + webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
|
| + webViewImpl->layout();
|
| + EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalWidth().toInt());
|
| + EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalHeight().toInt());
|
| }
|
|
|
| TEST_F(WebFrameTest, RenderBlockPercentHeightDescendants)
|
|
|