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 1359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1370 | 1370 |
1371 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); | 1371 EXPECT_EQ(viewportWidth, webViewHelper.webViewImpl()->mainFrameImpl()->frame
View()->layoutSize().width()); |
1372 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); | 1372 EXPECT_EQ(1, webViewHelper.webView()->pageScaleFactor()); |
1373 | 1373 |
1374 webViewHelper.webView()->setFixedLayoutSize(WebSize(2000, 1500)); | 1374 webViewHelper.webView()->setFixedLayoutSize(WebSize(2000, 1500)); |
1375 webViewHelper.webView()->layout(); | 1375 webViewHelper.webView()->layout(); |
1376 EXPECT_EQ(2000, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->l
ayoutSize().width()); | 1376 EXPECT_EQ(2000, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->l
ayoutSize().width()); |
1377 EXPECT_EQ(0.5f, webViewHelper.webView()->pageScaleFactor()); | 1377 EXPECT_EQ(0.5f, webViewHelper.webView()->pageScaleFactor()); |
1378 } | 1378 } |
1379 | 1379 |
1380 TEST_F(WebFrameTest, SetForceZeroLayoutHeight) | |
1381 { | |
1382 UseMockScrollbarSettings mockScrollbarSettings; | |
1383 registerMockedHttpURLLoad("200-by-300.html"); | |
1384 | |
1385 FixedLayoutTestWebViewClient client; | |
1386 client.m_screenInfo.deviceScaleFactor = 1; | |
1387 int viewportWidth = 640; | |
1388 int viewportHeight = 480; | |
1389 | |
1390 FrameTestHelpers::WebViewHelper webViewHelper; | |
1391 | |
1392 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); | |
1393 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | |
1394 webViewHelper.webView()->layout(); | |
1395 | |
1396 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); | |
1397 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | |
1398 EXPECT_TRUE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->needs
Layout()); | |
1399 | |
1400 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | |
1401 | |
1402 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight * 2)); | |
1403 EXPECT_FALSE(webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->need
sLayout()); | |
1404 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | |
1405 | |
1406 webViewHelper.webView()->resize(WebSize(viewportWidth * 2, viewportHeight)); | |
1407 webViewHelper.webView()->layout(); | |
1408 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | |
1409 | |
1410 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(false); | |
1411 EXPECT_EQ(viewportHeight, webViewHelper.webViewImpl()->mainFrameImpl()->fram
eView()->layoutSize().height()); | |
1412 } | |
1413 | |
1414 TEST_F(WebFrameTest, SetForceZeroLayoutHeightWorksAcrossNavigations) | |
1415 { | |
1416 UseMockScrollbarSettings mockScrollbarSettings; | |
1417 registerMockedHttpURLLoad("200-by-300.html"); | |
1418 registerMockedHttpURLLoad("large-div.html"); | |
1419 | |
1420 FixedLayoutTestWebViewClient client; | |
1421 client.m_screenInfo.deviceScaleFactor = 1; | |
1422 int viewportWidth = 640; | |
1423 int viewportHeight = 480; | |
1424 | |
1425 FrameTestHelpers::WebViewHelper webViewHelper; | |
1426 | |
1427 webViewHelper.initializeAndLoad(m_baseURL + "200-by-300.html", true, 0, &cli
ent, enableViewportSettings); | |
1428 webViewHelper.webView()->settings()->setForceZeroLayoutHeight(true); | |
1429 webViewHelper.webView()->resize(WebSize(viewportWidth, viewportHeight)); | |
1430 webViewHelper.webView()->layout(); | |
1431 | |
1432 FrameTestHelpers::loadFrame(webViewHelper.webView()->mainFrame(), m_baseURL
+ "large-div.html"); | |
1433 webViewHelper.webView()->layout(); | |
1434 | |
1435 EXPECT_EQ(0, webViewHelper.webViewImpl()->mainFrameImpl()->frameView()->layo
utSize().height()); | |
1436 } | |
1437 | |
1438 TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) | 1380 TEST_F(WebFrameTest, WideViewportAndWideContentWithInitialScale) |
1439 { | 1381 { |
1440 UseMockScrollbarSettings mockScrollbarSettings; | 1382 UseMockScrollbarSettings mockScrollbarSettings; |
1441 registerMockedHttpURLLoad("wide_document_width_viewport.html"); | 1383 registerMockedHttpURLLoad("wide_document_width_viewport.html"); |
1442 | 1384 |
1443 FixedLayoutTestWebViewClient client; | 1385 FixedLayoutTestWebViewClient client; |
1444 client.m_screenInfo.deviceScaleFactor = 1; | 1386 client.m_screenInfo.deviceScaleFactor = 1; |
1445 int viewportWidth = 600; | 1387 int viewportWidth = 600; |
1446 int viewportHeight = 800; | 1388 int viewportHeight = 800; |
1447 | 1389 |
(...skipping 4553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6001 | 5943 |
6002 client.reset(); | 5944 client.reset(); |
6003 // Try to load the request with cross origin access. Should succeed. | 5945 // Try to load the request with cross origin access. Should succeed. |
6004 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; | 5946 options.crossOriginRequestPolicy = blink::AllowCrossOriginRequests; |
6005 blink::DocumentThreadableLoader::loadResourceSynchronously( | 5947 blink::DocumentThreadableLoader::loadResourceSynchronously( |
6006 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); | 5948 *frame->document(), blink::ResourceRequest(resourceUrl), client, options
, resourceLoaderOptions); |
6007 EXPECT_FALSE(client.failed()); | 5949 EXPECT_FALSE(client.failed()); |
6008 } | 5950 } |
6009 | 5951 |
6010 } // namespace | 5952 } // namespace |
OLD | NEW |