OLD | NEW |
---|---|
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 1353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1364 | 1364 |
1365 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame View()->layoutSize().width()); | 1365 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame View()->layoutSize().width()); |
1366 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); | 1366 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); |
1367 | 1367 |
1368 webViewHelper.webView()->setFixedLayoutSize(WebSize(2000, 1500)); | 1368 webViewHelper.webView()->setFixedLayoutSize(WebSize(2000, 1500)); |
1369 webViewHelper.webView()->layout(); | 1369 webViewHelper.webView()->layout(); |
1370 EXPECT_EQ(2000, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->l ayoutSize().width()); | 1370 EXPECT_EQ(2000, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->l ayoutSize().width()); |
1371 EXPECT_EQ(0.5f, webViewHelper.webView()->pageScaleFactor()); | 1371 EXPECT_EQ(0.5f, webViewHelper.webView()->pageScaleFactor()); |
1372 } | 1372 } |
1373 | 1373 |
1374 TEST_F(WebFrameTest, SetForceZeroLayoutHeight) | |
1375 { | |
1376 UseMockScrollbarSettings mockScrollbarSettings; | |
1377 registerMockedHttpURLLoad("200-by-300.html"); | |
1378 | |
1379 FixedLayoutTestWebViewClient client; | |
1380 client.m_screenInfo.deviceScaleFactor = 1; | |
1381 int viewportWidth = 640; | |
1382 int viewportHeight = 480; | |
1383 | |
1384 FrameTestHelpers::WebViewHelper webViewHelper; | |
1385 | |
1386 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli ent, enableViewportSettings); | |
1387 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | |
1388 webViewHelper.webView()->layout(); | |
1389 | |
1390 EXPECT_NE(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); | |
1391 webViewHelper.webViewImpl()->setForceZeroLayoutHeight(true); | |
1392 EXPECT_TRUE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needs Layout()); | |
1393 | |
1394 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); | |
1395 | |
1396 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight * 2)); | |
1397 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need sLayout()); | |
1398 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); | |
1399 | |
1400 webViewHelper.webView()->resize(WebSize(viewportWidth * 2, viewportHeight)); | |
1401 webViewHelper.webView()->layout(); | |
1402 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo utSize().height()); | |
mnaganov (inactive)
2014/07/09 16:13:11
Maybe it makes sense to disable the setting again
mkosiba (inactive)
2014/07/09 17:01:27
Done.
| |
1403 } | |
1404 | |
1374 TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) | 1405 TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) |
1375 { | 1406 { |
1376 UseMockScrollbarSettings mockScrollbarSettings; | 1407 UseMockScrollbarSettings mockScrollbarSettings; |
1377 registerMockedHttpURLLoad("wide_document_width_viewport.html"); | 1408 registerMockedHttpURLLoad("wide_document_width_viewport.html"); |
1378 | 1409 |
1379 FixedLayoutTestWebViewClient client; | 1410 FixedLayoutTestWebViewClient client; |
1380 client.m_screenInfo.deviceScaleFactor = 1; | 1411 client.m_screenInfo.deviceScaleFactor = 1; |
1381 int viewportWidth = 600; | 1412 int viewportWidth = 600; |
1382 int viewportHeight = 800; | 1413 int viewportHeight = 800; |
1383 | 1414 |
(...skipping 4355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5739 std::string content = localFrame->contentAsText(1024).utf8(); | 5770 std::string content = localFrame->contentAsText(1024).utf8(); |
5740 EXPECT_EQ("hello", content); | 5771 EXPECT_EQ("hello", content); |
5741 | 5772 |
5742 // Manually reset to break WebViewHelper's dependency on the stack allocated | 5773 // Manually reset to break WebViewHelper's dependency on the stack allocated |
5743 // TestWebFrameClient. | 5774 // TestWebFrameClient. |
5744 reset(); | 5775 reset(); |
5745 remoteFrame->close(); | 5776 remoteFrame->close(); |
5746 } | 5777 } |
5747 | 5778 |
5748 } // namespace | 5779 } // namespace |
OLD | NEW |