Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1446)

Unified Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2557943002: Sync requestFullscreen() and exitFullscreen() algorithms with the spec (Closed)
Patch Set: rebase Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/web/tests/WebFrameTest.cpp
diff --git a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
index bdcc8024b1c131dc5e4a7e8e0874b676aed113f0..258fe2cf201eb86c67bf0f7c79f562d947126eb4 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -7696,14 +7696,11 @@ TEST_P(ParameterizedWebFrameTest, FullscreenLayerSize) {
UserGestureIndicator gesture(DocumentUserGestureToken::create(document));
Element* divFullscreen = document->getElementById("div1");
Fullscreen::requestFullscreen(*divFullscreen);
- EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*document));
- EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document));
webViewImpl->didEnterFullscreen();
- EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document));
+ EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*document));
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document));
webViewImpl->updateAllLifecyclePhases();
- EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document));
- EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document));
// Verify that the element is sized to the viewport.
LayoutFullScreen* fullscreenLayoutObject =
@@ -7736,14 +7733,11 @@ TEST_F(WebFrameTest, FullscreenLayerNonScrollable) {
UserGestureIndicator gesture(DocumentUserGestureToken::create(document));
Element* divFullscreen = document->getElementById("div1");
Fullscreen::requestFullscreen(*divFullscreen);
- EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*document));
- EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document));
webViewImpl->didEnterFullscreen();
- EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document));
+ EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*document));
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document));
webViewImpl->updateAllLifecyclePhases();
- EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document));
- EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document));
// Verify that the viewports are nonscrollable.
FrameView* frameView = webViewHelper.webView()->mainFrameImpl()->frameView();
@@ -7760,14 +7754,11 @@ TEST_F(WebFrameTest, FullscreenLayerNonScrollable) {
ASSERT_FALSE(visualViewportScrollLayer->userScrollableVertical());
// Verify that the viewports are scrollable upon exiting fullscreen.
- EXPECT_EQ(divFullscreen, Fullscreen::currentFullScreenElementFrom(*document));
- EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document));
webViewImpl->didExitFullscreen();
- EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*document));
+ EXPECT_EQ(divFullscreen, Fullscreen::fullscreenElementFrom(*document));
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*document));
webViewImpl->updateAllLifecyclePhases();
- EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*document));
- EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*document));
ASSERT_TRUE(layoutViewportScrollLayer->userScrollableHorizontal());
ASSERT_TRUE(layoutViewportScrollLayer->userScrollableVertical());
ASSERT_TRUE(visualViewportScrollLayer->userScrollableHorizontal());
@@ -7789,20 +7780,12 @@ TEST_P(ParameterizedWebFrameTest, FullscreenMainFrame) {
Document* document = webViewImpl->mainFrameImpl()->frame()->document();
UserGestureIndicator gesture(DocumentUserGestureToken::create(document));
Fullscreen::requestFullscreen(*document->documentElement());
- EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*document));
- EXPECT_EQ(document->documentElement(),
- Fullscreen::fullscreenElementFrom(*document));
webViewImpl->didEnterFullscreen();
- EXPECT_EQ(document->documentElement(),
- Fullscreen::currentFullScreenElementFrom(*document));
+ EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*document));
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
EXPECT_EQ(document->documentElement(),
Fullscreen::fullscreenElementFrom(*document));
-
webViewImpl->updateAllLifecyclePhases();
- EXPECT_EQ(document->documentElement(),
- Fullscreen::currentFullScreenElementFrom(*document));
- EXPECT_EQ(document->documentElement(),
- Fullscreen::fullscreenElementFrom(*document));
// Verify that the main frame is still scrollable.
WebLayer* webScrollLayer =
@@ -7841,6 +7824,7 @@ TEST_P(ParameterizedWebFrameTest, FullscreenSubframe) {
Element* divFullscreen = document->getElementById("div1");
Fullscreen::requestFullscreen(*divFullscreen);
webViewImpl->didEnterFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
// Verify that the element is sized to the viewport.
@@ -7882,6 +7866,11 @@ TEST_P(ParameterizedWebFrameTest, FullscreenNestedExit) {
Fullscreen::requestFullscreen(*topBody);
}
webViewImpl->didEnterFullscreen();
+ EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*topDoc));
+ EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*iframeDoc));
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
+ EXPECT_EQ(topBody, Fullscreen::fullscreenElementFrom(*topDoc));
+ EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*iframeDoc));
webViewImpl->updateAllLifecyclePhases();
{
@@ -7889,23 +7878,25 @@ TEST_P(ParameterizedWebFrameTest, FullscreenNestedExit) {
Fullscreen::requestFullscreen(*iframeBody);
}
webViewImpl->didEnterFullscreen();
+ EXPECT_EQ(topBody, Fullscreen::fullscreenElementFrom(*topDoc));
+ EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*iframeDoc));
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
+ EXPECT_EQ(iframe, Fullscreen::fullscreenElementFrom(*topDoc));
+ EXPECT_EQ(iframeBody, Fullscreen::fullscreenElementFrom(*iframeDoc));
webViewImpl->updateAllLifecyclePhases();
// We are now in nested fullscreen, with both documents having a non-empty
// fullscreen element stack.
- EXPECT_EQ(topBody, Fullscreen::currentFullScreenElementFrom(*topDoc));
- EXPECT_EQ(iframe, Fullscreen::fullscreenElementFrom(*topDoc));
- EXPECT_EQ(iframeBody, Fullscreen::currentFullScreenElementFrom(*iframeDoc));
- EXPECT_EQ(iframeBody, Fullscreen::fullscreenElementFrom(*iframeDoc));
webViewImpl->didExitFullscreen();
- webViewImpl->updateAllLifecyclePhases();
-
- // We should now have fully exited fullscreen.
- EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*topDoc));
+ EXPECT_EQ(iframe, Fullscreen::fullscreenElementFrom(*topDoc));
+ EXPECT_EQ(iframeBody, Fullscreen::fullscreenElementFrom(*iframeDoc));
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*topDoc));
- EXPECT_EQ(nullptr, Fullscreen::currentFullScreenElementFrom(*iframeDoc));
EXPECT_EQ(nullptr, Fullscreen::fullscreenElementFrom(*iframeDoc));
+ webViewImpl->updateAllLifecyclePhases();
+
+ // We have now fully exited fullscreen.
}
TEST_P(ParameterizedWebFrameTest, FullscreenWithTinyViewport) {
@@ -7934,6 +7925,7 @@ TEST_P(ParameterizedWebFrameTest, FullscreenWithTinyViewport) {
UserGestureIndicator gesture(DocumentUserGestureToken::create(document));
Fullscreen::requestFullscreen(*document->documentElement());
webViewImpl->didEnterFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
EXPECT_EQ(384, layoutViewItem.logicalWidth().floor());
EXPECT_EQ(640, layoutViewItem.logicalHeight().floor());
@@ -7942,6 +7934,7 @@ TEST_P(ParameterizedWebFrameTest, FullscreenWithTinyViewport) {
EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor());
webViewImpl->didExitFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
EXPECT_EQ(320, layoutViewItem.logicalWidth().floor());
EXPECT_EQ(533, layoutViewItem.logicalHeight().floor());
@@ -7970,6 +7963,7 @@ TEST_P(ParameterizedWebFrameTest, FullscreenResizeWithTinyViewport) {
UserGestureIndicator gesture(DocumentUserGestureToken::create(document));
Fullscreen::requestFullscreen(*document->documentElement());
webViewImpl->didEnterFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
EXPECT_EQ(384, layoutViewItem.logicalWidth().floor());
EXPECT_EQ(640, layoutViewItem.logicalHeight().floor());
@@ -7990,6 +7984,7 @@ TEST_P(ParameterizedWebFrameTest, FullscreenResizeWithTinyViewport) {
EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor());
webViewImpl->didExitFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
EXPECT_EQ(320, layoutViewItem.logicalWidth().floor());
EXPECT_EQ(192, layoutViewItem.logicalHeight().floor());
@@ -8033,6 +8028,7 @@ TEST_P(ParameterizedWebFrameTest, FullscreenRestoreScaleFactorUponExiting) {
}
webViewImpl->didEnterFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
client.m_screenInfo.rect.width = screenSizeMinusStatusBars.width;
client.m_screenInfo.rect.height = screenSizeMinusStatusBars.height;
@@ -8047,6 +8043,7 @@ TEST_P(ParameterizedWebFrameTest, FullscreenRestoreScaleFactorUponExiting) {
EXPECT_FLOAT_EQ(1.0, webViewImpl->maximumPageScaleFactor());
webViewImpl->didExitFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
client.m_screenInfo.rect.width = screenSizeMinusStatusBars.width;
client.m_screenInfo.rect.height = screenSizeMinusStatusBars.height;
@@ -8092,6 +8089,7 @@ TEST_P(ParameterizedWebFrameTest, ClearFullscreenConstraintsOnNavigation) {
DocumentUserGestureToken::create(document, UserGestureToken::NewGesture));
Fullscreen::requestFullscreen(*document->documentElement());
webViewImpl->didEnterFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
// Entering fullscreen causes layout size and page scale limits to be
@@ -8109,6 +8107,7 @@ TEST_P(ParameterizedWebFrameTest, ClearFullscreenConstraintsOnNavigation) {
WebFrame* frame = webViewHelper.webView()->mainFrame();
FrameTestHelpers::loadHTMLString(frame, source, testURL);
webViewImpl->didExitFullscreen();
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
webViewImpl->updateAllLifecyclePhases();
// Make sure the new page's layout size and scale factor limits aren't
@@ -8156,19 +8155,23 @@ TEST_P(ParameterizedWebFrameTest, OverlayFullscreenVideo) {
HTMLVideoElement* video =
toHTMLVideoElement(document->getElementById("video"));
EXPECT_TRUE(video->usesOverlayFullscreenVideo());
- EXPECT_FALSE(video->isFullscreen());
- EXPECT_FALSE(layerTreeView.hasTransparentBackground);
video->webkitEnterFullscreen();
webViewImpl->didEnterFullscreen();
- webViewImpl->updateAllLifecyclePhases();
+ EXPECT_FALSE(video->isFullscreen());
+ EXPECT_FALSE(layerTreeView.hasTransparentBackground);
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
EXPECT_TRUE(video->isFullscreen());
EXPECT_TRUE(layerTreeView.hasTransparentBackground);
+ webViewImpl->updateAllLifecyclePhases();
webViewImpl->didExitFullscreen();
- webViewImpl->updateAllLifecyclePhases();
+ EXPECT_TRUE(video->isFullscreen());
+ EXPECT_TRUE(layerTreeView.hasTransparentBackground);
+ webViewImpl->beginFrame(WTF::monotonicallyIncreasingTime());
EXPECT_FALSE(video->isFullscreen());
EXPECT_FALSE(layerTreeView.hasTransparentBackground);
+ webViewImpl->updateAllLifecyclePhases();
}
TEST_P(ParameterizedWebFrameTest, LayoutBlockPercentHeightDescendants) {
« no previous file with comments | « third_party/WebKit/Source/web/WebRemoteFrameImpl.cpp ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698