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

Side by Side Diff: Source/web/tests/WebFrameTest.cpp

Issue 647343003: Fix crash with fullscreen elements inside frames. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add assertion Created 6 years, 2 months 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 unified diff | Download patch
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/fullscreen_iframe.html » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Google Inc. All rights reserved. 2 * Copyright (C) 2010 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 6131 matching lines...) Expand 10 before | Expand all | Expand 10 after
6142 EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalWidth().toInt()); 6142 EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalWidth().toInt());
6143 EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalHeight().toInt()); 6143 EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalHeight().toInt());
6144 6144
6145 // Verify it's updated after a device rotation. 6145 // Verify it's updated after a device rotation.
6146 client.m_screenInfo.rect.width = viewportHeight; 6146 client.m_screenInfo.rect.width = viewportHeight;
6147 client.m_screenInfo.rect.height = viewportWidth; 6147 client.m_screenInfo.rect.height = viewportWidth;
6148 webViewImpl->resize(WebSize(viewportHeight, viewportWidth)); 6148 webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
6149 webViewImpl->layout(); 6149 webViewImpl->layout();
6150 EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalWidth().toInt()); 6150 EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalWidth().toInt());
6151 EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalHeight().toInt()); 6151 EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalHeight().toInt());
6152
6153 } 6152 }
6154 6153
6155 TEST_F(WebFrameTest, FullscreenLayerNonScrollable) 6154 TEST_F(WebFrameTest, FullscreenLayerNonScrollable)
6156 { 6155 {
6157 FakeCompositingWebViewClient client; 6156 FakeCompositingWebViewClient client;
6158 registerMockedHttpURLLoad("fullscreen_div.html"); 6157 registerMockedHttpURLLoad("fullscreen_div.html");
6159 FrameTestHelpers::WebViewHelper webViewHelper; 6158 FrameTestHelpers::WebViewHelper webViewHelper;
6160 int viewportWidth = 640; 6159 int viewportWidth = 640;
6161 int viewportHeight = 480; 6160 int viewportHeight = 480;
6162 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, 0, &client, configurePinchVirtualViewport); 6161 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_div.html", true, 0, &client, configurePinchVirtualViewport);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
6203 webViewImpl->layout(); 6202 webViewImpl->layout();
6204 6203
6205 // Verify that the main frame is still scrollable. 6204 // Verify that the main frame is still scrollable.
6206 ASSERT_TRUE(Fullscreen::isFullScreen(*document)); 6205 ASSERT_TRUE(Fullscreen::isFullScreen(*document));
6207 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor mLayer(); 6206 WebLayer* webScrollLayer = webViewImpl->compositor()->scrollLayer()->platfor mLayer();
6208 ASSERT_TRUE(webScrollLayer->scrollable()); 6207 ASSERT_TRUE(webScrollLayer->scrollable());
6209 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal()); 6208 ASSERT_TRUE(webScrollLayer->userScrollableHorizontal());
6210 ASSERT_TRUE(webScrollLayer->userScrollableVertical()); 6209 ASSERT_TRUE(webScrollLayer->userScrollableVertical());
6211 } 6210 }
6212 6211
6212 TEST_F(WebFrameTest, FullscreenSubframe)
6213 {
6214 FakeCompositingWebViewClient client;
6215 registerMockedHttpURLLoad("fullscreen_iframe.html");
6216 registerMockedHttpURLLoad("fullscreen_div.html");
6217 FrameTestHelpers::WebViewHelper webViewHelper;
6218 WebViewImpl* webViewImpl = webViewHelper.initializeAndLoad(m_baseURL + "full screen_iframe.html", true, 0, &client, configurePinchVirtualViewport);
6219 int viewportWidth = 640;
6220 int viewportHeight = 480;
6221 client.m_screenInfo.rect.width = viewportWidth;
6222 client.m_screenInfo.rect.height = viewportHeight;
6223 webViewImpl->resize(WebSize(viewportWidth, viewportHeight));
6224 webViewImpl->layout();
6225
6226 Document* document = toWebLocalFrameImpl(webViewHelper.webView()->mainFrame( )->firstChild())->frame()->document();
6227 UserGestureIndicator gesture(DefinitelyProcessingUserGesture);
6228 Element* divFullscreen = document->getElementById("div1");
6229 Fullscreen::from(*document).requestFullscreen(*divFullscreen, Fullscreen::Pr efixedRequest);
6230 webViewImpl->didEnterFullScreen();
6231 webViewImpl->layout();
6232
6233 // Verify that the element is sized to the viewport.
6234 RenderFullScreen* fullscreenRenderer = Fullscreen::from(*document).fullScree nRenderer();
6235 EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalWidth().toInt());
6236 EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalHeight().toInt());
6237
6238 // Verify it's updated after a device rotation.
6239 client.m_screenInfo.rect.width = viewportHeight;
6240 client.m_screenInfo.rect.height = viewportWidth;
6241 webViewImpl->resize(WebSize(viewportHeight, viewportWidth));
6242 webViewImpl->layout();
6243 EXPECT_EQ(viewportHeight, fullscreenRenderer->logicalWidth().toInt());
6244 EXPECT_EQ(viewportWidth, fullscreenRenderer->logicalHeight().toInt());
6245 }
6246
6213 TEST_F(WebFrameTest, RenderBlockPercentHeightDescendants) 6247 TEST_F(WebFrameTest, RenderBlockPercentHeightDescendants)
6214 { 6248 {
6215 registerMockedHttpURLLoad("percent-height-descendants.html"); 6249 registerMockedHttpURLLoad("percent-height-descendants.html");
6216 FrameTestHelpers::WebViewHelper webViewHelper; 6250 FrameTestHelpers::WebViewHelper webViewHelper;
6217 webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html "); 6251 webViewHelper.initializeAndLoad(m_baseURL + "percent-height-descendants.html ");
6218 6252
6219 WebView* webView = webViewHelper.webView(); 6253 WebView* webView = webViewHelper.webView();
6220 webView->resize(WebSize(800, 800)); 6254 webView->resize(WebSize(800, 800));
6221 webView->layout(); 6255 webView->layout();
6222 6256
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
6763 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); 6797 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount());
6764 6798
6765 // Neither should a page reload. 6799 // Neither should a page reload.
6766 localFrame->reload(); 6800 localFrame->reload();
6767 EXPECT_EQ(4u, frameClient.provisionalLoadCount()); 6801 EXPECT_EQ(4u, frameClient.provisionalLoadCount());
6768 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition()); 6802 EXPECT_FALSE(frameClient.wasLastProvisionalLoadATransition());
6769 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount()); 6803 EXPECT_EQ(1u, frameClient.navigationalDataReceivedCount());
6770 } 6804 }
6771 6805
6772 } // namespace 6806 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | Source/web/tests/data/fullscreen_iframe.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698