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

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

Issue 190723007: Fix tests to be compatible with Android scale initialization. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Reupload Created 6 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/tests/TouchActionTest.cpp ('k') | Source/web/tests/WebViewTest.cpp » ('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 1546 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); 1557 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight));
1558 webViewHelper.webView()->layout(); 1558 webViewHelper.webView()->layout();
1559 1559
1560 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie w()->layoutCount(); 1560 int prevLayoutCount = webViewHelper.webViewImpl()->mainFrameImpl()->frameVie w()->layoutCount();
1561 webViewHelper.webViewImpl()->setPageScaleFactor(30, WebPoint()); 1561 webViewHelper.webViewImpl()->setPageScaleFactor(30, WebPoint());
1562 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need sLayout()); 1562 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need sLayout());
1563 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra meView()->layoutCount()); 1563 EXPECT_EQ(prevLayoutCount, webViewHelper.webViewImpl()->mainFrameImpl()->fra meView()->layoutCount());
1564 1564
1565 } 1565 }
1566 1566
1567 TEST_F(WebFrameTest, setPageScaleFactorBeforeFrameHasView)
bokan 2014/03/10 14:21:18 Is the reason this doesn't make sense because page
aelias_OOO_until_Jul13 2014/03/10 21:43:42 Right. Early-ish in the load (after contents widt
1568 {
1569 registerMockedHttpURLLoad("fixed_layout.html");
1570
1571 float pageScaleFactor = 3;
1572 FrameTestHelpers::WebViewHelper webViewHelper;
1573 webViewHelper.initializeAndLoad("about:html", true, 0, 0);
1574 webViewHelper.webView()->setPageScaleFactor(pageScaleFactor, WebPoint());
1575
1576 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "fixed_layout.html");
1577 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
1578 WebCore::FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->fra meView();
1579 EXPECT_EQ(pageScaleFactor, view->visibleContentScaleFactor());
1580 }
1581
1582 TEST_F(WebFrameTest, pageScaleFactorWrittenToHistoryItem) 1567 TEST_F(WebFrameTest, pageScaleFactorWrittenToHistoryItem)
1583 { 1568 {
1584 UseMockScrollbarSettings mockScrollbarSettings; 1569 UseMockScrollbarSettings mockScrollbarSettings;
1585 registerMockedHttpURLLoad("fixed_layout.html"); 1570 registerMockedHttpURLLoad("fixed_layout.html");
1586 1571
1587 FixedLayoutTestWebViewClient client; 1572 FixedLayoutTestWebViewClient client;
1588 client.m_screenInfo.deviceScaleFactor = 1; 1573 client.m_screenInfo.deviceScaleFactor = 1;
1589 int viewportWidth = 640; 1574 int viewportWidth = 640;
1590 int viewportHeight = 480; 1575 int viewportHeight = 480;
1591 1576
(...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after
2137 2122
2138 registerMockedHttpURLLoad("large-div.html"); 2123 registerMockedHttpURLLoad("large-div.html");
2139 2124
2140 int viewWidth = 500; 2125 int viewWidth = 500;
2141 int viewHeight = 500; 2126 int viewHeight = 500;
2142 2127
2143 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr (new FakeCompositingWebViewClient()); 2128 OwnPtr<FakeCompositingWebViewClient> fakeCompositingWebViewClient = adoptPtr (new FakeCompositingWebViewClient());
2144 FrameTestHelpers::WebViewHelper webViewHelper; 2129 FrameTestHelpers::WebViewHelper webViewHelper;
2145 webViewHelper.initialize(true, 0, fakeCompositingWebViewClient.get(), &confi gueCompositingWebView); 2130 webViewHelper.initialize(true, 0, fakeCompositingWebViewClient.get(), &confi gueCompositingWebView);
2146 2131
2132 webViewHelper.webView()->setPageScaleFactorLimits(1, 1);
2147 webViewHelper.webView()->resize(WebSize(viewWidth, viewHeight)); 2133 webViewHelper.webView()->resize(WebSize(viewWidth, viewHeight));
2148 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "large-div.html"); 2134 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL + "large-div.html");
2149 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); 2135 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests();
2150 webViewHelper.webView()->layout(); 2136 webViewHelper.webView()->layout();
2151 2137
2152 WebCore::FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->fra meView(); 2138 WebCore::FrameView* view = webViewHelper.webViewImpl()->mainFrameImpl()->fra meView();
2153 EXPECT_TRUE(view->renderView()->compositor()->layerForHorizontalScrollbar()) ; 2139 EXPECT_TRUE(view->renderView()->compositor()->layerForHorizontalScrollbar()) ;
2154 EXPECT_TRUE(view->renderView()->compositor()->layerForVerticalScrollbar()); 2140 EXPECT_TRUE(view->renderView()->compositor()->layerForVerticalScrollbar());
2155 2141
2156 webViewHelper.webView()->resize(WebSize(viewWidth * 10, viewHeight * 10)); 2142 webViewHelper.webView()->resize(WebSize(viewWidth * 10, viewHeight * 10));
(...skipping 3081 matching lines...) Expand 10 before | Expand all | Expand 10 after
5238 webViewHelper.initializeAndLoad("about:blank"); 5224 webViewHelper.initializeAndLoad("about:blank");
5239 5225
5240 WebCore::FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView(); 5226 WebCore::FrameView* frameView = webViewHelper.webViewImpl()->mainFrameImpl() ->frameView();
5241 frameView->setFrameRect(WebCore::IntRect(0, 0, 200, 200)); 5227 frameView->setFrameRect(WebCore::IntRect(0, 0, 200, 200));
5242 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 200), frameView->frameRect()); 5228 EXPECT_EQ_RECT(WebCore::IntRect(0, 0, 200, 200), frameView->frameRect());
5243 frameView->setFrameRect(WebCore::IntRect(100, 100, 200, 200)); 5229 frameView->setFrameRect(WebCore::IntRect(100, 100, 200, 200));
5244 EXPECT_EQ_RECT(WebCore::IntRect(100, 100, 200, 200), frameView->frameRect()) ; 5230 EXPECT_EQ_RECT(WebCore::IntRect(100, 100, 200, 200), frameView->frameRect()) ;
5245 } 5231 }
5246 5232
5247 } // namespace 5233 } // namespace
OLDNEW
« no previous file with comments | « Source/web/tests/TouchActionTest.cpp ('k') | Source/web/tests/WebViewTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698