| 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 1191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1202 EXPECT_FALSE(isAnchor); | 1202 EXPECT_FALSE(isAnchor); |
| 1203 | 1203 |
| 1204 // Test for Non-doubletap scaling | 1204 // Test for Non-doubletap scaling |
| 1205 // Test zooming into div. | 1205 // Test zooming into div. |
| 1206 webViewImpl->computeScaleAndScrollForHitRect(WebRect(250, 250, 10, 10), WebV
iewImpl::FindInPage, scale, scroll, isAnchor); | 1206 webViewImpl->computeScaleAndScrollForHitRect(WebRect(250, 250, 10, 10), WebV
iewImpl::FindInPage, scale, scroll, isAnchor); |
| 1207 EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1); | 1207 EXPECT_NEAR(viewportWidth / (float) wideDiv.width, scale, 0.1); |
| 1208 } | 1208 } |
| 1209 | 1209 |
| 1210 void simulateDoubleTap(WebViewImpl* webViewImpl, WebPoint& point, float& scale) | 1210 void simulateDoubleTap(WebViewImpl* webViewImpl, WebPoint& point, float& scale) |
| 1211 { | 1211 { |
| 1212 webViewImpl->animateZoomAroundPoint(point, WebViewImpl::DoubleTap); | 1212 webViewImpl->animateZoomToRect(WebCore::IntRect(point.x, point.y, 0, 0), Web
ViewImpl::DoubleTap); |
| 1213 EXPECT_TRUE(webViewImpl->fakeDoubleTapAnimationPendingForTesting()); | 1213 EXPECT_TRUE(webViewImpl->fakeDoubleTapAnimationPendingForTesting()); |
| 1214 WebCore::IntSize scrollDelta = webViewImpl->fakeDoubleTapTargetPositionForTe
sting() - webViewImpl->mainFrameImpl()->frameView()->scrollPosition(); | 1214 WebCore::IntSize scrollDelta = webViewImpl->fakeDoubleTapTargetPositionForTe
sting() - webViewImpl->mainFrameImpl()->frameView()->scrollPosition(); |
| 1215 float scaleDelta = webViewImpl->fakeDoubleTapPageScaleFactorForTesting() / w
ebViewImpl->pageScaleFactor(); | 1215 float scaleDelta = webViewImpl->fakeDoubleTapPageScaleFactorForTesting() / w
ebViewImpl->pageScaleFactor(); |
| 1216 webViewImpl->applyScrollAndScale(scrollDelta, scaleDelta); | 1216 webViewImpl->applyScrollAndScale(scrollDelta, scaleDelta); |
| 1217 scale = webViewImpl->pageScaleFactor(); | 1217 scale = webViewImpl->pageScaleFactor(); |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 TEST_F(WebFrameTest, DivAutoZoomMultipleDivsTest) | 1220 TEST_F(WebFrameTest, DivAutoZoomMultipleDivsTest) |
| 1221 { | 1221 { |
| 1222 registerMockedHttpURLLoad("get_multiple_divs_for_auto_zoom_test.html"); | 1222 registerMockedHttpURLLoad("get_multiple_divs_for_auto_zoom_test.html"); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1254 simulateDoubleTap(webViewImpl, topPoint, scale); | 1254 simulateDoubleTap(webViewImpl, topPoint, scale); |
| 1255 EXPECT_FLOAT_EQ(1, scale); | 1255 EXPECT_FLOAT_EQ(1, scale); |
| 1256 webViewImpl->applyScrollAndScale(WebSize(), 0.6f); | 1256 webViewImpl->applyScrollAndScale(WebSize(), 0.6f); |
| 1257 simulateDoubleTap(webViewImpl, bottomPoint, scale); | 1257 simulateDoubleTap(webViewImpl, bottomPoint, scale); |
| 1258 EXPECT_FLOAT_EQ(1, scale); | 1258 EXPECT_FLOAT_EQ(1, scale); |
| 1259 simulateDoubleTap(webViewImpl, bottomPoint, scale); | 1259 simulateDoubleTap(webViewImpl, bottomPoint, scale); |
| 1260 EXPECT_FLOAT_EQ(webViewImpl->minimumPageScaleFactor(), scale); | 1260 EXPECT_FLOAT_EQ(webViewImpl->minimumPageScaleFactor(), scale); |
| 1261 | 1261 |
| 1262 // If we didn't yet get an auto-zoom update and a second double-tap arrives,
should go back to minimum scale. | 1262 // If we didn't yet get an auto-zoom update and a second double-tap arrives,
should go back to minimum scale. |
| 1263 webViewImpl->applyScrollAndScale(WebSize(), 1.1f); | 1263 webViewImpl->applyScrollAndScale(WebSize(), 1.1f); |
| 1264 webViewImpl->animateZoomAroundPoint(topPoint, WebViewImpl::DoubleTap); | 1264 webViewImpl->animateZoomToRect(WebCore::IntRect(topPoint.x, topPoint.y, 0, 0
), WebViewImpl::DoubleTap); |
| 1265 EXPECT_TRUE(webViewImpl->fakeDoubleTapAnimationPendingForTesting()); | 1265 EXPECT_TRUE(webViewImpl->fakeDoubleTapAnimationPendingForTesting()); |
| 1266 simulateDoubleTap(webViewImpl, bottomPoint, scale); | 1266 simulateDoubleTap(webViewImpl, bottomPoint, scale); |
| 1267 EXPECT_FLOAT_EQ(webViewImpl->minimumPageScaleFactor(), scale); | 1267 EXPECT_FLOAT_EQ(webViewImpl->minimumPageScaleFactor(), scale); |
| 1268 } | 1268 } |
| 1269 | 1269 |
| 1270 TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTest) | 1270 TEST_F(WebFrameTest, DivAutoZoomScaleBoundsTest) |
| 1271 { | 1271 { |
| 1272 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); | 1272 registerMockedHttpURLLoad("get_scale_bounds_check_for_auto_zoom_test.html"); |
| 1273 | 1273 |
| 1274 int viewportWidth = 320; | 1274 int viewportWidth = 320; |
| (...skipping 2133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3408 frame->reload(); | 3408 frame->reload(); |
| 3409 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); | 3409 Platform::current()->unitTestSupport()->serveAsynchronousMockedRequests(); |
| 3410 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().cachePolicy()); | 3410 EXPECT_EQ(WebURLRequest::ReloadIgnoringCacheData, frame->dataSource()->reque
st().cachePolicy()); |
| 3411 | 3411 |
| 3412 m_webView->close(); | 3412 m_webView->close(); |
| 3413 m_webView = 0; | 3413 m_webView = 0; |
| 3414 } | 3414 } |
| 3415 | 3415 |
| 3416 | 3416 |
| 3417 } // namespace | 3417 } // namespace |
| OLD | NEW |