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

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

Issue 2573773002: Sync requestFullscreen() and exitFullscreen() algorithms with the spec (Closed)
Patch Set: address feedback 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
« no previous file with comments | « third_party/WebKit/Source/web/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 a20e959b933697c19f39d76ae2efc2cc8df78857..43bbff29561d985bececbf0a8ebc781b1b5cf857 100644
--- a/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
+++ b/third_party/WebKit/Source/web/tests/WebFrameTest.cpp
@@ -7698,14 +7698,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 =
@@ -7738,14 +7735,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();
@@ -7762,14 +7756,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());
@@ -7791,20 +7782,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 =
@@ -7843,6 +7826,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.
@@ -7884,6 +7868,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();
{
@@ -7891,23 +7880,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) {
@@ -7936,6 +7927,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());
@@ -7944,6 +7936,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());
@@ -7972,6 +7965,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());
@@ -7992,6 +7986,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());
@@ -8035,6 +8030,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;
@@ -8049,6 +8045,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;
@@ -8094,6 +8091,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
@@ -8111,6 +8109,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
@@ -8158,19 +8157,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/WebViewImpl.h ('k') | third_party/WebKit/Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698