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

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

Issue 1071383002: Round when calculating minimum height of WebViews (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 5 years, 8 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') | no next file » | 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) 2011, 2012 Google Inc. All rights reserved. 2 * Copyright (C) 2011, 2012 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 2331 matching lines...) Expand 10 before | Expand all | Expand 10 after
2342 2342
2343 WebSize size = webView->contentsPreferredMinimumSize(); 2343 WebSize size = webView->contentsPreferredMinimumSize();
2344 EXPECT_EQ(100, size.width); 2344 EXPECT_EQ(100, size.width);
2345 EXPECT_EQ(100, size.height); 2345 EXPECT_EQ(100, size.height);
2346 2346
2347 webView->setZoomLevel(WebView::zoomFactorToZoomLevel(2.0)); 2347 webView->setZoomLevel(WebView::zoomFactorToZoomLevel(2.0));
2348 size = webView->contentsPreferredMinimumSize(); 2348 size = webView->contentsPreferredMinimumSize();
2349 EXPECT_EQ(200, size.width); 2349 EXPECT_EQ(200, size.width);
2350 EXPECT_EQ(200, size.height); 2350 EXPECT_EQ(200, size.height);
2351 2351
2352 // Verify that both width and height are rounded
2353 webView->setZoomLevel(WebView::zoomFactorToZoomLevel(0.9995));
leviw_travelin_and_unemployed 2015/05/20 22:05:06 Can we get some more test cases? 1.0005 maybe?
2354 size = webView->contentsPreferredMinimumSize();
2355 EXPECT_EQ(100, size.width);
2356 EXPECT_EQ(100, size.height);
2357
2352 url = m_baseURL + "specify_size.html?1.5px:1.5px"; 2358 url = m_baseURL + "specify_size.html?1.5px:1.5px";
2353 URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html"); 2359 URLTestHelpers::registerMockedURLLoad(toKURL(url), "specify_size.html");
2354 webView = m_webViewHelper.initializeAndLoad(url, true); 2360 webView = m_webViewHelper.initializeAndLoad(url, true);
2355 2361
2356 webView->setZoomLevel(WebView::zoomFactorToZoomLevel(1)); 2362 webView->setZoomLevel(WebView::zoomFactorToZoomLevel(1));
2357 size = webView->contentsPreferredMinimumSize(); 2363 size = webView->contentsPreferredMinimumSize();
2358 EXPECT_EQ(2, size.width); 2364 EXPECT_EQ(2, size.width);
2359 EXPECT_EQ(2, size.height); 2365 EXPECT_EQ(2, size.height);
2360 } 2366 }
2361 2367
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
2521 // Test without any preventDefault. 2527 // Test without any preventDefault.
2522 client.reset(); 2528 client.reset();
2523 frame->executeScript(WebScriptSource("setTest('none');")); 2529 frame->executeScript(WebScriptSource("setTest('none');"));
2524 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target"))); 2530 EXPECT_TRUE(tapElementById(webView, WebInputEvent::GestureTap, WebString::fr omUTF8("target")));
2525 EXPECT_TRUE(client.getWasCalled()); 2531 EXPECT_TRUE(client.getWasCalled());
2526 2532
2527 m_webViewHelper.reset(); // Remove dependency on locally scoped client. 2533 m_webViewHelper.reset(); // Remove dependency on locally scoped client.
2528 } 2534 }
2529 2535
2530 } // namespace 2536 } // namespace
OLDNEW
« no previous file with comments | « Source/web/WebViewImpl.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698