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_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); |
| 1391 webViewHelper.webView()->settings()->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()); |
| 1403 |
| 1404 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(false); |
| 1405 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); |
| 1406 } |
| 1407 |
1374 TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) | 1408 TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) |
1375 { | 1409 { |
1376 UseMockScrollbarSettings mockScrollbarSettings; | 1410 UseMockScrollbarSettings mockScrollbarSettings; |
1377 registerMockedHttpURLLoad("wide_document_width_viewport.html"); | 1411 registerMockedHttpURLLoad("wide_document_width_viewport.html"); |
1378 | 1412 |
1379 FixedLayoutTestWebViewClient client; | 1413 FixedLayoutTestWebViewClient client; |
1380 client.m_screenInfo.deviceScaleFactor = 1; | 1414 client.m_screenInfo.deviceScaleFactor = 1; |
1381 int viewportWidth = 600; | 1415 int viewportWidth = 600; |
1382 int viewportHeight = 800; | 1416 int viewportHeight = 800; |
1383 | 1417 |
(...skipping 4355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5739 std::string content = localFrame->contentAsText(1024).utf8(); | 5773 std::string content = localFrame->contentAsText(1024).utf8(); |
5740 EXPECT_EQ("hello", content); | 5774 EXPECT_EQ("hello", content); |
5741 | 5775 |
5742 // Manually reset to break WebViewHelper's dependency on the stack allocated | 5776 // Manually reset to break WebViewHelper's dependency on the stack allocated |
5743 // TestWebFrameClient. | 5777 // TestWebFrameClient. |
5744 reset(); | 5778 reset(); |
5745 remoteFrame->close(); | 5779 remoteFrame->close(); |
5746 } | 5780 } |
5747 | 5781 |
5748 } // namespace | 5782 } // namespace |
OLD | NEW |