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

Side by Side Diff: third_party/WebKit/Source/web/tests/WebFrameTest.cpp

Issue 2884423003: Use scroll-boundary-behavior to control overscroll-refresh/glow on android. (Closed)
Patch Set: Update the test Created 3 years, 6 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
OLDNEW
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 10123 matching lines...) Expand 10 before | Expand all | Expand 10 after
10134 } 10134 }
10135 EXPECT_FALSE(page->Suspended()); 10135 EXPECT_FALSE(page->Suspended());
10136 EXPECT_FALSE( 10136 EXPECT_FALSE(
10137 local_child->GetDocument()->Fetcher()->Context().DefersLoading()); 10137 local_child->GetDocument()->Fetcher()->Context().DefersLoading());
10138 10138
10139 view->Close(); 10139 view->Close();
10140 } 10140 }
10141 10141
10142 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient { 10142 class OverscrollWebViewClient : public FrameTestHelpers::TestWebViewClient {
10143 public: 10143 public:
10144 MOCK_METHOD4(DidOverscroll, 10144 MOCK_METHOD5(DidOverscroll,
10145 void(const WebFloatSize&, 10145 void(const WebFloatSize&,
10146 const WebFloatSize&, 10146 const WebFloatSize&,
10147 const WebFloatPoint&, 10147 const WebFloatPoint&,
10148 const WebFloatSize&)); 10148 const WebFloatSize&,
10149 const WebScrollBoundaryBehavior&));
10149 }; 10150 };
10150 10151
10151 class WebFrameOverscrollTest 10152 class WebFrameOverscrollTest
10152 : public WebFrameTest, 10153 : public WebFrameTest,
10153 public ::testing::WithParamInterface<blink::WebGestureDevice> { 10154 public ::testing::WithParamInterface<blink::WebGestureDevice> {
10154 protected: 10155 protected:
10155 WebCoalescedInputEvent GenerateEvent(WebInputEvent::Type type, 10156 WebCoalescedInputEvent GenerateEvent(WebInputEvent::Type type,
10156 float delta_x = 0.0, 10157 float delta_x = 0.0,
10157 float delta_y = 0.0) { 10158 float delta_y = 0.0) {
10158 WebGestureEvent event(type, WebInputEvent::kNoModifiers, 10159 WebGestureEvent event(type, WebInputEvent::kNoModifiers,
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
10199 FrameTestHelpers::WebViewHelper web_view_helper; 10200 FrameTestHelpers::WebViewHelper web_view_helper;
10200 web_view_helper.InitializeAndLoad(base_url_ + "overscroll/overscroll.html", 10201 web_view_helper.InitializeAndLoad(base_url_ + "overscroll/overscroll.html",
10201 true, nullptr, &client, nullptr, 10202 true, nullptr, &client, nullptr,
10202 ConfigureAndroid); 10203 ConfigureAndroid);
10203 web_view_helper.Resize(WebSize(200, 200)); 10204 web_view_helper.Resize(WebSize(200, 200));
10204 10205
10205 // Calculation of accumulatedRootOverscroll and unusedDelta on multiple 10206 // Calculation of accumulatedRootOverscroll and unusedDelta on multiple
10206 // scrollUpdate. 10207 // scrollUpdate.
10207 ScrollBegin(&web_view_helper); 10208 ScrollBegin(&web_view_helper);
10208 EXPECT_CALL(client, DidOverscroll(WebFloatSize(8, 16), WebFloatSize(8, 16), 10209 EXPECT_CALL(client, DidOverscroll(WebFloatSize(8, 16), WebFloatSize(8, 16),
10209 WebFloatPoint(100, 100), WebFloatSize())); 10210 WebFloatPoint(100, 100), WebFloatSize(),
10211 WebScrollBoundaryBehavior()));
10210 ScrollUpdate(&web_view_helper, -308, -316); 10212 ScrollUpdate(&web_view_helper, -308, -316);
10211 Mock::VerifyAndClearExpectations(&client); 10213 Mock::VerifyAndClearExpectations(&client);
10212 10214
10213 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 13), WebFloatSize(8, 29), 10215 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 13), WebFloatSize(8, 29),
10214 WebFloatPoint(100, 100), WebFloatSize())); 10216 WebFloatPoint(100, 100), WebFloatSize(),
10217 WebScrollBoundaryBehavior()));
10215 ScrollUpdate(&web_view_helper, 0, -13); 10218 ScrollUpdate(&web_view_helper, 0, -13);
10216 Mock::VerifyAndClearExpectations(&client); 10219 Mock::VerifyAndClearExpectations(&client);
10217 10220
10218 EXPECT_CALL(client, DidOverscroll(WebFloatSize(20, 13), WebFloatSize(28, 42), 10221 EXPECT_CALL(client, DidOverscroll(WebFloatSize(20, 13), WebFloatSize(28, 42),
10219 WebFloatPoint(100, 100), WebFloatSize())); 10222 WebFloatPoint(100, 100), WebFloatSize(),
10223 WebScrollBoundaryBehavior()));
10220 ScrollUpdate(&web_view_helper, -20, -13); 10224 ScrollUpdate(&web_view_helper, -20, -13);
10221 Mock::VerifyAndClearExpectations(&client); 10225 Mock::VerifyAndClearExpectations(&client);
10222 10226
10223 // Overscroll is not reported. 10227 // Overscroll is not reported.
10224 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10228 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10225 ScrollUpdate(&web_view_helper, 0, 1); 10229 ScrollUpdate(&web_view_helper, 0, 1);
10226 Mock::VerifyAndClearExpectations(&client); 10230 Mock::VerifyAndClearExpectations(&client);
10227 10231
10228 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10232 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10229 ScrollUpdate(&web_view_helper, 1, 0); 10233 ScrollUpdate(&web_view_helper, 1, 0);
10230 Mock::VerifyAndClearExpectations(&client); 10234 Mock::VerifyAndClearExpectations(&client);
10231 10235
10232 // Overscroll is reported. 10236 // Overscroll is reported.
10233 EXPECT_CALL(client, 10237 EXPECT_CALL(client,
10234 DidOverscroll(WebFloatSize(0, -701), WebFloatSize(0, -701), 10238 DidOverscroll(WebFloatSize(0, -701), WebFloatSize(0, -701),
10235 WebFloatPoint(100, 100), WebFloatSize())); 10239 WebFloatPoint(100, 100), WebFloatSize(),
10240 WebScrollBoundaryBehavior()));
10236 ScrollUpdate(&web_view_helper, 0, 1000); 10241 ScrollUpdate(&web_view_helper, 0, 1000);
10237 Mock::VerifyAndClearExpectations(&client); 10242 Mock::VerifyAndClearExpectations(&client);
10238 10243
10239 // Overscroll is not reported. 10244 // Overscroll is not reported.
10240 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10245 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10241 ScrollEnd(&web_view_helper); 10246 ScrollEnd(&web_view_helper);
10242 Mock::VerifyAndClearExpectations(&client); 10247 Mock::VerifyAndClearExpectations(&client);
10243 } 10248 }
10244 10249
10245 TEST_P(WebFrameOverscrollTest, 10250 TEST_P(WebFrameOverscrollTest,
10246 AccumulatedOverscrollAndUnusedDeltaValuesOnDifferentAxesOverscroll) { 10251 AccumulatedOverscrollAndUnusedDeltaValuesOnDifferentAxesOverscroll) {
10247 OverscrollWebViewClient client; 10252 OverscrollWebViewClient client;
10248 RegisterMockedHttpURLLoad("overscroll/div-overscroll.html"); 10253 RegisterMockedHttpURLLoad("overscroll/div-overscroll.html");
10249 FrameTestHelpers::WebViewHelper web_view_helper; 10254 FrameTestHelpers::WebViewHelper web_view_helper;
10250 web_view_helper.InitializeAndLoad( 10255 web_view_helper.InitializeAndLoad(
10251 base_url_ + "overscroll/div-overscroll.html", true, nullptr, &client, 10256 base_url_ + "overscroll/div-overscroll.html", true, nullptr, &client,
10252 nullptr, ConfigureAndroid); 10257 nullptr, ConfigureAndroid);
10253 web_view_helper.Resize(WebSize(200, 200)); 10258 web_view_helper.Resize(WebSize(200, 200));
10254 10259
10255 ScrollBegin(&web_view_helper); 10260 ScrollBegin(&web_view_helper);
10256 10261
10257 // Scroll the Div to the end. 10262 // Scroll the Div to the end.
10258 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10263 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10259 ScrollUpdate(&web_view_helper, 0, -316); 10264 ScrollUpdate(&web_view_helper, 0, -316);
10260 Mock::VerifyAndClearExpectations(&client); 10265 Mock::VerifyAndClearExpectations(&client);
10261 10266
10262 ScrollEnd(&web_view_helper); 10267 ScrollEnd(&web_view_helper);
10263 ScrollBegin(&web_view_helper); 10268 ScrollBegin(&web_view_helper);
10264 10269
10265 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled. 10270 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled.
10266 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 100), WebFloatSize(0, 100), 10271 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 100), WebFloatSize(0, 100),
10267 WebFloatPoint(100, 100), WebFloatSize())); 10272 WebFloatPoint(100, 100), WebFloatSize(),
10273 WebScrollBoundaryBehavior()));
10268 ScrollUpdate(&web_view_helper, 0, -100); 10274 ScrollUpdate(&web_view_helper, 0, -100);
10269 ScrollUpdate(&web_view_helper, 0, -100); 10275 ScrollUpdate(&web_view_helper, 0, -100);
10270 Mock::VerifyAndClearExpectations(&client); 10276 Mock::VerifyAndClearExpectations(&client);
10271 10277
10272 // TODO(bokan): This has never worked but by the accident that this test was 10278 // TODO(bokan): This has never worked but by the accident that this test was
10273 // being run in a WebView without a size. This test should be fixed along with 10279 // being run in a WebView without a size. This test should be fixed along with
10274 // the bug, crbug.com/589320. 10280 // the bug, crbug.com/589320.
10275 // Page scrolls vertically, but over-scrolls horizontally. 10281 // Page scrolls vertically, but over-scrolls horizontally.
10276 // EXPECT_CALL(client, didOverscroll(WebFloatSize(-100, 0), WebFloatSize(-100, 10282 // EXPECT_CALL(client, didOverscroll(WebFloatSize(-100, 0), WebFloatSize(-100,
10277 // 0), WebFloatPoint(100, 100), WebFloatSize())); 10283 // 0), WebFloatPoint(100, 100), WebFloatSize(), WebScrollBoundaryBehavior()));
10278 // ScrollUpdate(&webViewHelper, 100, 50); 10284 // ScrollUpdate(&webViewHelper, 100, 50);
10279 // Mock::VerifyAndClearExpectations(&client); 10285 // Mock::VerifyAndClearExpectations(&client);
10280 10286
10281 // Scrolling up, Overscroll is not reported. 10287 // Scrolling up, Overscroll is not reported.
10282 // EXPECT_CALL(client, didOverscroll(_, _, _, _)).Times(0); 10288 // EXPECT_CALL(client, didOverscroll(_, _, _, _, _)).Times(0);
10283 // ScrollUpdate(&webViewHelper, 0, -50); 10289 // ScrollUpdate(&webViewHelper, 0, -50);
10284 // Mock::VerifyAndClearExpectations(&client); 10290 // Mock::VerifyAndClearExpectations(&client);
10285 10291
10286 // Page scrolls horizontally, but over-scrolls vertically. 10292 // Page scrolls horizontally, but over-scrolls vertically.
10287 // EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 100), WebFloatSize(0, 10293 // EXPECT_CALL(client, didOverscroll(WebFloatSize(0, 100), WebFloatSize(0,
10288 // 100), WebFloatPoint(100, 100), WebFloatSize())); 10294 // 100), WebFloatPoint(100, 100), WebFloatSize(),
10295 // WebScrollBoundaryBehavior()));
10289 // ScrollUpdate(&webViewHelper, -100, -100); 10296 // ScrollUpdate(&webViewHelper, -100, -100);
10290 // Mock::VerifyAndClearExpectations(&client); 10297 // Mock::VerifyAndClearExpectations(&client);
10291 } 10298 }
10292 10299
10293 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerDivOverScroll) { 10300 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerDivOverScroll) {
10294 OverscrollWebViewClient client; 10301 OverscrollWebViewClient client;
10295 RegisterMockedHttpURLLoad("overscroll/div-overscroll.html"); 10302 RegisterMockedHttpURLLoad("overscroll/div-overscroll.html");
10296 FrameTestHelpers::WebViewHelper web_view_helper; 10303 FrameTestHelpers::WebViewHelper web_view_helper;
10297 web_view_helper.InitializeAndLoad( 10304 web_view_helper.InitializeAndLoad(
10298 base_url_ + "overscroll/div-overscroll.html", true, nullptr, &client, 10305 base_url_ + "overscroll/div-overscroll.html", true, nullptr, &client,
10299 nullptr, ConfigureAndroid); 10306 nullptr, ConfigureAndroid);
10300 web_view_helper.Resize(WebSize(200, 200)); 10307 web_view_helper.Resize(WebSize(200, 200));
10301 10308
10302 ScrollBegin(&web_view_helper); 10309 ScrollBegin(&web_view_helper);
10303 10310
10304 // Scroll the Div to the end. 10311 // Scroll the Div to the end.
10305 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10312 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10306 ScrollUpdate(&web_view_helper, 0, -316); 10313 ScrollUpdate(&web_view_helper, 0, -316);
10307 Mock::VerifyAndClearExpectations(&client); 10314 Mock::VerifyAndClearExpectations(&client);
10308 10315
10309 ScrollEnd(&web_view_helper); 10316 ScrollEnd(&web_view_helper);
10310 ScrollBegin(&web_view_helper); 10317 ScrollBegin(&web_view_helper);
10311 10318
10312 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled. 10319 // Now On Scrolling DIV, scroll is bubbled and root layer is over-scrolled.
10313 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50), 10320 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50),
10314 WebFloatPoint(100, 100), WebFloatSize())); 10321 WebFloatPoint(100, 100), WebFloatSize(),
10322 WebScrollBoundaryBehavior()));
10315 ScrollUpdate(&web_view_helper, 0, -150); 10323 ScrollUpdate(&web_view_helper, 0, -150);
10316 Mock::VerifyAndClearExpectations(&client); 10324 Mock::VerifyAndClearExpectations(&client);
10317 } 10325 }
10318 10326
10319 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerIFrameOverScroll) { 10327 TEST_P(WebFrameOverscrollTest, RootLayerOverscrolledOnInnerIFrameOverScroll) {
10320 OverscrollWebViewClient client; 10328 OverscrollWebViewClient client;
10321 RegisterMockedHttpURLLoad("overscroll/iframe-overscroll.html"); 10329 RegisterMockedHttpURLLoad("overscroll/iframe-overscroll.html");
10322 RegisterMockedHttpURLLoad("overscroll/scrollable-iframe.html"); 10330 RegisterMockedHttpURLLoad("overscroll/scrollable-iframe.html");
10323 FrameTestHelpers::WebViewHelper web_view_helper; 10331 FrameTestHelpers::WebViewHelper web_view_helper;
10324 web_view_helper.InitializeAndLoad( 10332 web_view_helper.InitializeAndLoad(
10325 base_url_ + "overscroll/iframe-overscroll.html", true, nullptr, &client, 10333 base_url_ + "overscroll/iframe-overscroll.html", true, nullptr, &client,
10326 nullptr, ConfigureAndroid); 10334 nullptr, ConfigureAndroid);
10327 web_view_helper.Resize(WebSize(200, 200)); 10335 web_view_helper.Resize(WebSize(200, 200));
10328 10336
10329 ScrollBegin(&web_view_helper); 10337 ScrollBegin(&web_view_helper);
10330 // Scroll the IFrame to the end. 10338 // Scroll the IFrame to the end.
10331 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10339 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10332 10340
10333 // This scroll will fully scroll the iframe but will be consumed before being 10341 // This scroll will fully scroll the iframe but will be consumed before being
10334 // counted as overscroll. 10342 // counted as overscroll.
10335 ScrollUpdate(&web_view_helper, 0, -320); 10343 ScrollUpdate(&web_view_helper, 0, -320);
10336 10344
10337 // This scroll will again target the iframe but wont bubble further up. Make 10345 // This scroll will again target the iframe but wont bubble further up. Make
10338 // sure that the unused scroll isn't handled as overscroll. 10346 // sure that the unused scroll isn't handled as overscroll.
10339 ScrollUpdate(&web_view_helper, 0, -50); 10347 ScrollUpdate(&web_view_helper, 0, -50);
10340 Mock::VerifyAndClearExpectations(&client); 10348 Mock::VerifyAndClearExpectations(&client);
10341 10349
10342 ScrollEnd(&web_view_helper); 10350 ScrollEnd(&web_view_helper);
10343 ScrollBegin(&web_view_helper); 10351 ScrollBegin(&web_view_helper);
10344 10352
10345 // Now On Scrolling IFrame, scroll is bubbled and root layer is over-scrolled. 10353 // Now On Scrolling IFrame, scroll is bubbled and root layer is over-scrolled.
10346 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50), 10354 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, 50), WebFloatSize(0, 50),
10347 WebFloatPoint(100, 100), WebFloatSize())); 10355 WebFloatPoint(100, 100), WebFloatSize(),
10356 WebScrollBoundaryBehavior()));
10348 ScrollUpdate(&web_view_helper, 0, -150); 10357 ScrollUpdate(&web_view_helper, 0, -150);
10349 Mock::VerifyAndClearExpectations(&client); 10358 Mock::VerifyAndClearExpectations(&client);
10350 10359
10351 ScrollEnd(&web_view_helper); 10360 ScrollEnd(&web_view_helper);
10352 } 10361 }
10353 10362
10354 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) { 10363 TEST_P(WebFrameOverscrollTest, ScaledPageRootLayerOverscrolled) {
10355 OverscrollWebViewClient client; 10364 OverscrollWebViewClient client;
10356 RegisterMockedHttpURLLoad("overscroll/overscroll.html"); 10365 RegisterMockedHttpURLLoad("overscroll/overscroll.html");
10357 FrameTestHelpers::WebViewHelper web_view_helper; 10366 FrameTestHelpers::WebViewHelper web_view_helper;
10358 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( 10367 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad(
10359 base_url_ + "overscroll/overscroll.html", true, nullptr, &client, nullptr, 10368 base_url_ + "overscroll/overscroll.html", true, nullptr, &client, nullptr,
10360 ConfigureAndroid); 10369 ConfigureAndroid);
10361 web_view_helper.Resize(WebSize(200, 200)); 10370 web_view_helper.Resize(WebSize(200, 200));
10362 web_view_impl->SetPageScaleFactor(3.0); 10371 web_view_impl->SetPageScaleFactor(3.0);
10363 10372
10364 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page. 10373 // Calculation of accumulatedRootOverscroll and unusedDelta on scaled page.
10365 // The point is (99, 99) because we clamp in the division by 3 to 33 so when 10374 // The point is (99, 99) because we clamp in the division by 3 to 33 so when
10366 // we go back to viewport coordinates it becomes (99, 99). 10375 // we go back to viewport coordinates it becomes (99, 99).
10367 ScrollBegin(&web_view_helper); 10376 ScrollBegin(&web_view_helper);
10368 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30), 10377 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -30),
10369 WebFloatPoint(99, 99), WebFloatSize())); 10378 WebFloatPoint(99, 99), WebFloatSize(),
10379 WebScrollBoundaryBehavior()));
10370 ScrollUpdate(&web_view_helper, 0, 30); 10380 ScrollUpdate(&web_view_helper, 0, 30);
10371 Mock::VerifyAndClearExpectations(&client); 10381 Mock::VerifyAndClearExpectations(&client);
10372 10382
10373 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -60), 10383 EXPECT_CALL(client, DidOverscroll(WebFloatSize(0, -30), WebFloatSize(0, -60),
10374 WebFloatPoint(99, 99), WebFloatSize())); 10384 WebFloatPoint(99, 99), WebFloatSize(),
10385 WebScrollBoundaryBehavior()));
10375 ScrollUpdate(&web_view_helper, 0, 30); 10386 ScrollUpdate(&web_view_helper, 0, 30);
10376 Mock::VerifyAndClearExpectations(&client); 10387 Mock::VerifyAndClearExpectations(&client);
10377 10388
10378 EXPECT_CALL(client, 10389 EXPECT_CALL(client,
10379 DidOverscroll(WebFloatSize(-30, -30), WebFloatSize(-30, -90), 10390 DidOverscroll(WebFloatSize(-30, -30), WebFloatSize(-30, -90),
10380 WebFloatPoint(99, 99), WebFloatSize())); 10391 WebFloatPoint(99, 99), WebFloatSize(),
10392 WebScrollBoundaryBehavior()));
10381 ScrollUpdate(&web_view_helper, 30, 30); 10393 ScrollUpdate(&web_view_helper, 30, 30);
10382 Mock::VerifyAndClearExpectations(&client); 10394 Mock::VerifyAndClearExpectations(&client);
10383 10395
10384 EXPECT_CALL(client, 10396 EXPECT_CALL(client,
10385 DidOverscroll(WebFloatSize(-30, 0), WebFloatSize(-60, -90), 10397 DidOverscroll(WebFloatSize(-30, 0), WebFloatSize(-60, -90),
10386 WebFloatPoint(99, 99), WebFloatSize())); 10398 WebFloatPoint(99, 99), WebFloatSize(),
10399 WebScrollBoundaryBehavior()));
10387 ScrollUpdate(&web_view_helper, 30, 0); 10400 ScrollUpdate(&web_view_helper, 30, 0);
10388 Mock::VerifyAndClearExpectations(&client); 10401 Mock::VerifyAndClearExpectations(&client);
10389 10402
10390 // Overscroll is not reported. 10403 // Overscroll is not reported.
10391 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10404 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10392 ScrollEnd(&web_view_helper); 10405 ScrollEnd(&web_view_helper);
10393 Mock::VerifyAndClearExpectations(&client); 10406 Mock::VerifyAndClearExpectations(&client);
10394 } 10407 }
10395 10408
10396 TEST_P(WebFrameOverscrollTest, NoOverscrollForSmallvalues) { 10409 TEST_P(WebFrameOverscrollTest, NoOverscrollForSmallvalues) {
10397 OverscrollWebViewClient client; 10410 OverscrollWebViewClient client;
10398 RegisterMockedHttpURLLoad("overscroll/overscroll.html"); 10411 RegisterMockedHttpURLLoad("overscroll/overscroll.html");
10399 FrameTestHelpers::WebViewHelper web_view_helper; 10412 FrameTestHelpers::WebViewHelper web_view_helper;
10400 web_view_helper.InitializeAndLoad(base_url_ + "overscroll/overscroll.html", 10413 web_view_helper.InitializeAndLoad(base_url_ + "overscroll/overscroll.html",
10401 true, nullptr, &client, nullptr, 10414 true, nullptr, &client, nullptr,
10402 ConfigureAndroid); 10415 ConfigureAndroid);
10403 web_view_helper.Resize(WebSize(200, 200)); 10416 web_view_helper.Resize(WebSize(200, 200));
10404 10417
10405 ScrollBegin(&web_view_helper); 10418 ScrollBegin(&web_view_helper);
10406 EXPECT_CALL(client, 10419 EXPECT_CALL(client,
10407 DidOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10, -10), 10420 DidOverscroll(WebFloatSize(-10, -10), WebFloatSize(-10, -10),
10408 WebFloatPoint(100, 100), WebFloatSize())); 10421 WebFloatPoint(100, 100), WebFloatSize(),
10422 WebScrollBoundaryBehavior()));
10409 ScrollUpdate(&web_view_helper, 10, 10); 10423 ScrollUpdate(&web_view_helper, 10, 10);
10410 Mock::VerifyAndClearExpectations(&client); 10424 Mock::VerifyAndClearExpectations(&client);
10411 10425
10412 EXPECT_CALL(client, 10426 EXPECT_CALL(client,
10413 DidOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10, -10.10), 10427 DidOverscroll(WebFloatSize(0, -0.10), WebFloatSize(-10, -10.10),
10414 WebFloatPoint(100, 100), WebFloatSize())); 10428 WebFloatPoint(100, 100), WebFloatSize(),
10429 WebScrollBoundaryBehavior()));
10415 ScrollUpdate(&web_view_helper, 0, 0.10); 10430 ScrollUpdate(&web_view_helper, 0, 0.10);
10416 Mock::VerifyAndClearExpectations(&client); 10431 Mock::VerifyAndClearExpectations(&client);
10417 10432
10418 EXPECT_CALL(client, DidOverscroll(WebFloatSize(-0.10, 0), 10433 EXPECT_CALL(client, DidOverscroll(WebFloatSize(-0.10, 0),
10419 WebFloatSize(-10.10, -10.10), 10434 WebFloatSize(-10.10, -10.10),
10420 WebFloatPoint(100, 100), WebFloatSize())); 10435 WebFloatPoint(100, 100), WebFloatSize(),
10436 WebScrollBoundaryBehavior()));
10421 ScrollUpdate(&web_view_helper, 0.10, 0); 10437 ScrollUpdate(&web_view_helper, 0.10, 0);
10422 Mock::VerifyAndClearExpectations(&client); 10438 Mock::VerifyAndClearExpectations(&client);
10423 10439
10424 // For residual values overscrollDelta should be reset and didOverscroll 10440 // For residual values overscrollDelta should be reset and didOverscroll
10425 // shouldn't be called. 10441 // shouldn't be called.
10426 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10442 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10427 ScrollUpdate(&web_view_helper, 0, 0.09); 10443 ScrollUpdate(&web_view_helper, 0, 0.09);
10428 Mock::VerifyAndClearExpectations(&client); 10444 Mock::VerifyAndClearExpectations(&client);
10429 10445
10430 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10446 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10431 ScrollUpdate(&web_view_helper, 0.09, 0.09); 10447 ScrollUpdate(&web_view_helper, 0.09, 0.09);
10432 Mock::VerifyAndClearExpectations(&client); 10448 Mock::VerifyAndClearExpectations(&client);
10433 10449
10434 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10450 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10435 ScrollUpdate(&web_view_helper, 0.09, 0); 10451 ScrollUpdate(&web_view_helper, 0.09, 0);
10436 Mock::VerifyAndClearExpectations(&client); 10452 Mock::VerifyAndClearExpectations(&client);
10437 10453
10438 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10454 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10439 ScrollUpdate(&web_view_helper, 0, -0.09); 10455 ScrollUpdate(&web_view_helper, 0, -0.09);
10440 Mock::VerifyAndClearExpectations(&client); 10456 Mock::VerifyAndClearExpectations(&client);
10441 10457
10442 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10458 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10443 ScrollUpdate(&web_view_helper, -0.09, -0.09); 10459 ScrollUpdate(&web_view_helper, -0.09, -0.09);
10444 Mock::VerifyAndClearExpectations(&client); 10460 Mock::VerifyAndClearExpectations(&client);
10445 10461
10446 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10462 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10447 ScrollUpdate(&web_view_helper, -0.09, 0); 10463 ScrollUpdate(&web_view_helper, -0.09, 0);
10448 Mock::VerifyAndClearExpectations(&client); 10464 Mock::VerifyAndClearExpectations(&client);
10449 10465
10450 EXPECT_CALL(client, DidOverscroll(_, _, _, _)).Times(0); 10466 EXPECT_CALL(client, DidOverscroll(_, _, _, _, _)).Times(0);
10451 ScrollEnd(&web_view_helper); 10467 ScrollEnd(&web_view_helper);
10452 Mock::VerifyAndClearExpectations(&client); 10468 Mock::VerifyAndClearExpectations(&client);
10453 } 10469 }
10454 10470
10455 TEST_F(WebFrameTest, OrientationFrameDetach) { 10471 TEST_F(WebFrameTest, OrientationFrameDetach) {
10456 RuntimeEnabledFeatures::SetOrientationEventEnabled(true); 10472 RuntimeEnabledFeatures::SetOrientationEventEnabled(true);
10457 RegisterMockedHttpURLLoad("orientation-frame-detach.html"); 10473 RegisterMockedHttpURLLoad("orientation-frame-detach.html");
10458 FrameTestHelpers::WebViewHelper web_view_helper; 10474 FrameTestHelpers::WebViewHelper web_view_helper;
10459 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad( 10475 WebViewBase* web_view_impl = web_view_helper.InitializeAndLoad(
10460 base_url_ + "orientation-frame-detach.html", true); 10476 base_url_ + "orientation-frame-detach.html", true);
(...skipping 1780 matching lines...) Expand 10 before | Expand all | Expand 10 after
12241 if (obj->IsText()) { 12257 if (obj->IsText()) {
12242 LayoutText* layout_text = ToLayoutText(obj); 12258 LayoutText* layout_text = ToLayoutText(obj);
12243 text = layout_text->GetText(); 12259 text = layout_text->GetText();
12244 break; 12260 break;
12245 } 12261 }
12246 } 12262 }
12247 EXPECT_EQ("foo alt", text.Utf8()); 12263 EXPECT_EQ("foo alt", text.Utf8());
12248 } 12264 }
12249 12265
12250 } // namespace blink 12266 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698