OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 package org.chromium.android_webview.test; | 5 package org.chromium.android_webview.test; |
6 | 6 |
7 import android.content.Context; | 7 import android.content.Context; |
8 import android.test.suitebuilder.annotation.SmallTest; | 8 import android.test.suitebuilder.annotation.SmallTest; |
9 import android.view.View; | 9 import android.view.View; |
10 import android.widget.OverScroller; | 10 import android.widget.OverScroller; |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
128 }; | 128 }; |
129 } | 129 } |
130 | 130 |
131 private static final String TEST_PAGE_COMMON_HEADERS = | 131 private static final String TEST_PAGE_COMMON_HEADERS = |
132 "<meta name=\"viewport\" content=\"width=device-width, initial-scale =1\"> " + | 132 "<meta name=\"viewport\" content=\"width=device-width, initial-scale =1\"> " + |
133 "<style type=\"text/css\"> " + | 133 "<style type=\"text/css\"> " + |
134 " body { " + | 134 " body { " + |
135 " margin: 0px; " + | 135 " margin: 0px; " + |
136 " } " + | 136 " } " + |
137 " div { " + | 137 " div { " + |
138 " width:1000px; " + | 138 " width:10px; " + |
139 " height:10000px; " + | 139 " height:10000px; " + |
140 " background-color: blue; " + | 140 " background-color: blue; " + |
141 " } " + | 141 " } " + |
142 "</style> "; | 142 "</style> "; |
143 private static final String TEST_PAGE_COMMON_CONTENT = "<div>test div</div> "; | 143 private static final String TEST_PAGE_COMMON_CONTENT = "<div>test div</div> "; |
144 | 144 |
145 private String makeTestPage(String onscrollObserver, String firstFrameObserv er, | 145 private String makeTestPage(String onscrollObserver, String firstFrameObserv er, |
146 String extraContent) { | 146 String extraContent) { |
147 String content = TEST_PAGE_COMMON_CONTENT + extraContent; | 147 String content = TEST_PAGE_COMMON_CONTENT + extraContent; |
148 if (onscrollObserver != null) { | 148 if (onscrollObserver != null) { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
274 @SmallTest | 274 @SmallTest |
275 @Feature({"AndroidWebView"}) | 275 @Feature({"AndroidWebView"}) |
276 public void testUiScrollReflectedInJs() throws Throwable { | 276 public void testUiScrollReflectedInJs() throws Throwable { |
277 final TestAwContentsClient contentsClient = new TestAwContentsClient(); | 277 final TestAwContentsClient contentsClient = new TestAwContentsClient(); |
278 final ScrollTestContainerView testContainerView = | 278 final ScrollTestContainerView testContainerView = |
279 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); | 279 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); |
280 enableJavaScriptOnUiThread(testContainerView.getAwContents()); | 280 enableJavaScriptOnUiThread(testContainerView.getAwContents()); |
281 | 281 |
282 final double deviceDIPScale = | 282 final double deviceDIPScale = |
283 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); | 283 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); |
284 final int targetScrollXCss = 233; | 284 final int targetScrollXCss = 0; |
285 final int targetScrollYCss = 322; | 285 final int targetScrollYCss = 322; |
286 final int targetScrollXPix = (int) Math.ceil(targetScrollXCss * deviceDI PScale); | 286 final int targetScrollXPix = (int) Math.ceil(targetScrollXCss * deviceDI PScale); |
287 final int targetScrollYPix = (int) Math.ceil(targetScrollYCss * deviceDI PScale); | 287 final int targetScrollYPix = (int) Math.ceil(targetScrollYCss * deviceDI PScale); |
288 final JavascriptEventObserver onscrollObserver = new JavascriptEventObse rver(); | 288 final JavascriptEventObserver onscrollObserver = new JavascriptEventObse rver(); |
289 | 289 |
290 getInstrumentation().runOnMainSync(new Runnable() { | 290 getInstrumentation().runOnMainSync(new Runnable() { |
291 @Override | 291 @Override |
292 public void run() { | 292 public void run() { |
293 onscrollObserver.register(testContainerView.getContentViewCore() , | 293 onscrollObserver.register(testContainerView.getContentViewCore() , |
294 "onscrollObserver"); | 294 "onscrollObserver"); |
(...skipping 12 matching lines...) Expand all Loading... | |
307 @SmallTest | 307 @SmallTest |
308 @Feature({"AndroidWebView"}) | 308 @Feature({"AndroidWebView"}) |
309 public void testJsScrollReflectedInUi() throws Throwable { | 309 public void testJsScrollReflectedInUi() throws Throwable { |
310 final TestAwContentsClient contentsClient = new TestAwContentsClient(); | 310 final TestAwContentsClient contentsClient = new TestAwContentsClient(); |
311 final ScrollTestContainerView testContainerView = | 311 final ScrollTestContainerView testContainerView = |
312 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); | 312 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); |
313 enableJavaScriptOnUiThread(testContainerView.getAwContents()); | 313 enableJavaScriptOnUiThread(testContainerView.getAwContents()); |
314 | 314 |
315 final double deviceDIPScale = | 315 final double deviceDIPScale = |
316 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); | 316 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); |
317 final int targetScrollXCss = 132; | 317 final int targetScrollXCss = 0; |
318 final int targetScrollYCss = 243; | 318 final int targetScrollYCss = 243; |
319 final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceD IPScale); | 319 final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceD IPScale); |
320 final int targetScrollYPix = (int) Math.floor(targetScrollYCss * deviceD IPScale); | 320 final int targetScrollYPix = (int) Math.floor(targetScrollYCss * deviceD IPScale); |
321 | 321 |
322 loadDataSync(testContainerView.getAwContents(), contentsClient.getOnPage FinishedHelper(), | 322 loadDataSync(testContainerView.getAwContents(), contentsClient.getOnPage FinishedHelper(), |
323 makeTestPage(null, null, ""), "text/html", false); | 323 makeTestPage(null, null, ""), "text/html", false); |
324 | 324 |
325 final CallbackHelper onScrollToCallbackHelper = | 325 final CallbackHelper onScrollToCallbackHelper = |
326 testContainerView.getOnScrollToCallbackHelper(); | 326 testContainerView.getOnScrollToCallbackHelper(); |
327 final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); | 327 final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); |
328 executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), con tentsClient, | 328 executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), con tentsClient, |
329 String.format("window.scrollTo(%d, %d);", targetScrollXCss, targ etScrollYCss)); | 329 String.format("window.scrollTo(%d, %d);", targetScrollXCss, targ etScrollYCss)); |
330 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); | 330 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); |
331 | 331 |
332 assertScrollOnMainSync(testContainerView, targetScrollXPix, targetScroll YPix); | 332 assertScrollOnMainSync(testContainerView, targetScrollXPix, targetScroll YPix); |
333 } | 333 } |
334 | 334 |
335 @SmallTest | 335 @SmallTest |
336 @Feature({"AndroidWebView"}) | 336 @Feature({"AndroidWebView"}) |
337 public void testJsScrollFromBody() throws Throwable { | 337 public void testJsScrollFromBody() throws Throwable { |
338 final TestAwContentsClient contentsClient = new TestAwContentsClient(); | 338 final TestAwContentsClient contentsClient = new TestAwContentsClient(); |
339 final ScrollTestContainerView testContainerView = | 339 final ScrollTestContainerView testContainerView = |
340 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); | 340 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); |
341 enableJavaScriptOnUiThread(testContainerView.getAwContents()); | 341 enableJavaScriptOnUiThread(testContainerView.getAwContents()); |
342 | 342 |
343 final double deviceDIPScale = | 343 final double deviceDIPScale = |
344 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); | 344 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); |
345 final int targetScrollXCss = 132; | 345 final int targetScrollXCss = 0; |
346 final int targetScrollYCss = 243; | 346 final int targetScrollYCss = 243; |
347 final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceD IPScale); | 347 final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceD IPScale); |
348 final int targetScrollYPix = (int) Math.floor(targetScrollYCss * deviceD IPScale); | 348 final int targetScrollYPix = (int) Math.floor(targetScrollYCss * deviceD IPScale); |
349 | 349 |
350 final String scrollFromBodyScript = | 350 final String scrollFromBodyScript = |
351 "<script> " + | 351 "<script> " + |
352 " window.scrollTo(" + targetScrollXCss + ", " + targetScrollYCs s + "); " + | 352 " window.scrollTo(" + targetScrollXCss + ", " + targetScrollYCs s + "); " + |
353 "</script> "; | 353 "</script> "; |
354 | 354 |
355 final CallbackHelper onScrollToCallbackHelper = | 355 final CallbackHelper onScrollToCallbackHelper = |
356 testContainerView.getOnScrollToCallbackHelper(); | 356 testContainerView.getOnScrollToCallbackHelper(); |
357 final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); | 357 final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); |
358 loadDataAsync(testContainerView.getAwContents(), | 358 loadDataAsync(testContainerView.getAwContents(), |
359 makeTestPage(null, null, scrollFromBodyScript), "text/html", fal se); | 359 makeTestPage(null, null, scrollFromBodyScript), "text/html", fal se); |
360 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); | 360 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); |
361 | 361 |
362 assertScrollOnMainSync(testContainerView, targetScrollXPix, targetScroll YPix); | 362 assertScrollOnMainSync(testContainerView, targetScrollXPix, targetScroll YPix); |
363 } | 363 } |
364 | 364 |
365 @SmallTest | 365 @SmallTest |
366 @Feature({"AndroidWebView"}) | 366 @Feature({"AndroidWebView"}) |
367 public void testJsScrollCanBeAlteredByUi() throws Throwable { | 367 public void testJsScrollCanBeAlteredByUi() throws Throwable { |
368 final TestAwContentsClient contentsClient = new TestAwContentsClient(); | 368 final TestAwContentsClient contentsClient = new TestAwContentsClient(); |
369 final ScrollTestContainerView testContainerView = | 369 final ScrollTestContainerView testContainerView = |
370 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); | 370 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); |
371 enableJavaScriptOnUiThread(testContainerView.getAwContents()); | 371 enableJavaScriptOnUiThread(testContainerView.getAwContents()); |
372 | 372 |
373 final double deviceDIPScale = | 373 final double deviceDIPScale = |
374 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); | 374 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); |
375 final int targetScrollXCss = 132; | 375 final int targetScrollXCss = 0; |
376 final int targetScrollYCss = 243; | 376 final int targetScrollYCss = 243; |
377 final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceD IPScale); | 377 final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceD IPScale); |
378 final int targetScrollYPix = (int) Math.floor(targetScrollYCss * deviceD IPScale); | 378 final int targetScrollYPix = (int) Math.floor(targetScrollYCss * deviceD IPScale); |
379 | 379 |
380 final int maxScrollXCss = 101; | 380 final int maxScrollXCss = 0; |
381 final int maxScrollYCss = 201; | 381 final int maxScrollYCss = 201; |
382 final int maxScrollXPix = (int) Math.floor(maxScrollXCss * deviceDIPScal e); | 382 final int maxScrollXPix = (int) Math.floor(maxScrollXCss * deviceDIPScal e); |
383 final int maxScrollYPix = (int) Math.floor(maxScrollYCss * deviceDIPScal e); | 383 final int maxScrollYPix = (int) Math.floor(maxScrollYCss * deviceDIPScal e); |
384 | 384 |
385 loadDataSync(testContainerView.getAwContents(), contentsClient.getOnPage FinishedHelper(), | 385 loadDataSync(testContainerView.getAwContents(), contentsClient.getOnPage FinishedHelper(), |
386 makeTestPage(null, null, ""), "text/html", false); | 386 makeTestPage(null, null, ""), "text/html", false); |
387 | 387 |
388 setMaxScrollOnMainSync(testContainerView, maxScrollXPix, maxScrollYPix); | 388 setMaxScrollOnMainSync(testContainerView, maxScrollXPix, maxScrollYPix); |
389 | 389 |
390 final CallbackHelper onScrollToCallbackHelper = | 390 final CallbackHelper onScrollToCallbackHelper = |
(...skipping 16 matching lines...) Expand all Loading... | |
407 | 407 |
408 final int dragSteps = 10; | 408 final int dragSteps = 10; |
409 final int dragStepSize = 24; | 409 final int dragStepSize = 24; |
410 // Watch out when modifying - if the y or x delta aren't big enough vert ical or horizontal | 410 // Watch out when modifying - if the y or x delta aren't big enough vert ical or horizontal |
411 // scroll snapping will kick in. | 411 // scroll snapping will kick in. |
412 final int targetScrollXPix = dragStepSize * dragSteps; | 412 final int targetScrollXPix = dragStepSize * dragSteps; |
413 final int targetScrollYPix = dragStepSize * dragSteps; | 413 final int targetScrollYPix = dragStepSize * dragSteps; |
414 | 414 |
415 final double deviceDIPScale = | 415 final double deviceDIPScale = |
416 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); | 416 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); |
417 final int maxScrollXPix = 101; | 417 final int maxScrollXPix = 0; |
418 final int maxScrollYPix = 211; | 418 final int maxScrollYPix = 211; |
419 // Make sure we can't hit these values simply as a result of scrolling. | 419 // Make sure we can't hit these values simply as a result of scrolling. |
420 assert (maxScrollXPix % dragStepSize) != 0; | 420 assert (maxScrollXPix % dragStepSize) != 0; |
mkosiba (inactive)
2014/11/03 11:38:58
you'll need to take this out.
| |
421 assert (maxScrollYPix % dragStepSize) != 0; | 421 assert (maxScrollYPix % dragStepSize) != 0; |
422 final int maxScrollXCss = (int) Math.floor(maxScrollXPix / deviceDIPScal e); | 422 final int maxScrollXCss = (int) Math.floor(maxScrollXPix / deviceDIPScal e); |
423 final int maxScrollYCss = (int) Math.floor(maxScrollYPix / deviceDIPScal e); | 423 final int maxScrollYCss = (int) Math.floor(maxScrollYPix / deviceDIPScal e); |
424 | 424 |
425 setMaxScrollOnMainSync(testContainerView, maxScrollXPix, maxScrollYPix); | 425 setMaxScrollOnMainSync(testContainerView, maxScrollXPix, maxScrollYPix); |
426 | 426 |
427 loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null , ""); | 427 loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null , ""); |
428 | 428 |
429 final CallbackHelper onScrollToCallbackHelper = | 429 final CallbackHelper onScrollToCallbackHelper = |
430 testContainerView.getOnScrollToCallbackHelper(); | 430 testContainerView.getOnScrollToCallbackHelper(); |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
541 @SmallTest | 541 @SmallTest |
542 @Feature({"AndroidWebView"}) | 542 @Feature({"AndroidWebView"}) |
543 public void testScrollToBottomAtPageScaleX0dot5() throws Throwable { | 543 public void testScrollToBottomAtPageScaleX0dot5() throws Throwable { |
544 // The idea behind this test is to check that scrolling to the bottom on ther renderer side | 544 // The idea behind this test is to check that scrolling to the bottom on ther renderer side |
545 // results in the view also reporting as being scrolled to the bottom. | 545 // results in the view also reporting as being scrolled to the bottom. |
546 final TestAwContentsClient contentsClient = new TestAwContentsClient(); | 546 final TestAwContentsClient contentsClient = new TestAwContentsClient(); |
547 final ScrollTestContainerView testContainerView = | 547 final ScrollTestContainerView testContainerView = |
548 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); | 548 (ScrollTestContainerView) createAwTestContainerViewOnMainSync(co ntentsClient); |
549 enableJavaScriptOnUiThread(testContainerView.getAwContents()); | 549 enableJavaScriptOnUiThread(testContainerView.getAwContents()); |
550 | 550 |
551 final int targetScrollXCss = 1000; | 551 final int targetScrollXCss = 0; |
552 final int targetScrollYCss = 10000; | 552 final int targetScrollYCss = 10000; |
553 | 553 |
554 final String pageHeaders = | 554 final String pageHeaders = |
555 "<meta name=\"viewport\" content=\"width=device-width, initial-s cale=0.6\"> " + | 555 "<meta name=\"viewport\" content=\"width=device-width, initial-s cale=0.6\"> " + |
556 "<style type=\"text/css\"> " + | 556 "<style type=\"text/css\"> " + |
557 " div { " + | 557 " div { " + |
558 " width:1000px; " + | 558 " width:10px; " + |
559 " height:10000px; " + | 559 " height:10000px; " + |
560 " background-color: blue; " + | 560 " background-color: blue; " + |
561 " } " + | 561 " } " + |
562 " body { " + | 562 " body { " + |
563 " margin: 0px; " + | 563 " margin: 0px; " + |
564 " padding: 0px; " + | 564 " padding: 0px; " + |
565 " } " + | 565 " } " + |
566 "</style> "; | 566 "</style> "; |
567 | 567 |
568 loadDataSync(testContainerView.getAwContents(), contentsClient.getOnPage FinishedHelper(), | 568 loadDataSync(testContainerView.getAwContents(), contentsClient.getOnPage FinishedHelper(), |
569 CommonResources.makeHtmlPageFrom(pageHeaders, TEST_PAGE_COMMON_C ONTENT), | 569 CommonResources.makeHtmlPageFrom(pageHeaders, TEST_PAGE_COMMON_C ONTENT), |
570 "text/html", false); | 570 "text/html", false); |
571 | 571 |
572 final double deviceDIPScale = | 572 final double deviceDIPScale = |
573 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); | 573 DeviceDisplayInfo.create(testContainerView.getContext()).getDIPS cale(); |
574 | 574 |
575 final CallbackHelper onScrollToCallbackHelper = | 575 final CallbackHelper onScrollToCallbackHelper = |
576 testContainerView.getOnScrollToCallbackHelper(); | 576 testContainerView.getOnScrollToCallbackHelper(); |
577 int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); | 577 int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); |
578 executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), con tentsClient, | 578 executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), con tentsClient, |
579 "window.scrollTo(" + targetScrollXCss + "," + targetScrollYCss + ")"); | 579 "window.scrollTo(" + targetScrollXCss + "," + targetScrollYCss + ")"); |
580 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); | 580 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); |
581 | 581 |
582 getInstrumentation().runOnMainSync(new Runnable() { | |
mkosiba (inactive)
2014/11/03 11:38:58
If you're removing this bit then the rest of the t
aelias_OOO_until_Jul13
2014/11/04 06:32:05
We can make a loose prediction, but I don't think
| |
583 @Override | |
584 public void run() { | |
585 AwContents awContents = testContainerView.getAwContents(); | |
586 int maxHorizontal = awContents.computeHorizontalScrollRange() - | |
587 testContainerView.getWidth(); | |
588 int maxVertical = awContents.computeVerticalScrollRange() - | |
589 testContainerView.getHeight(); | |
590 // Due to rounding going from CSS -> physical pixels it is possi ble that more than | |
591 // one physical pixels corespond to one CSS pixel, which is why we can't do a | |
592 // simple equality test here. | |
593 assertTrue(maxHorizontal - awContents.computeHorizontalScrollOff set() < 3); | |
594 assertTrue(maxVertical - awContents.computeVerticalScrollOffset( ) < 3); | |
595 } | |
596 }); | |
597 | |
598 scrollToCallCount = onScrollToCallbackHelper.getCallCount(); | 582 scrollToCallCount = onScrollToCallbackHelper.getCallCount(); |
599 executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), con tentsClient, | 583 executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), con tentsClient, |
600 "window.scrollTo(0, 0)"); | 584 "window.scrollTo(0, 0)"); |
601 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); | 585 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); |
602 | 586 |
603 getInstrumentation().runOnMainSync(new Runnable() { | 587 getInstrumentation().runOnMainSync(new Runnable() { |
604 @Override | 588 @Override |
605 public void run() { | 589 public void run() { |
606 AwContents awContents = testContainerView.getAwContents(); | 590 AwContents awContents = testContainerView.getAwContents(); |
607 int maxHorizontal = awContents.computeHorizontalScrollRange() - | 591 int maxHorizontal = awContents.computeHorizontalScrollRange() - |
(...skipping 18 matching lines...) Expand all Loading... | |
626 | 610 |
627 assertScrollOnMainSync(testContainerView, 0, 0); | 611 assertScrollOnMainSync(testContainerView, 0, 0); |
628 | 612 |
629 final CallbackHelper onScrollToCallbackHelper = | 613 final CallbackHelper onScrollToCallbackHelper = |
630 testContainerView.getOnScrollToCallbackHelper(); | 614 testContainerView.getOnScrollToCallbackHelper(); |
631 final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); | 615 final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); |
632 | 616 |
633 getInstrumentation().runOnMainSync(new Runnable() { | 617 getInstrumentation().runOnMainSync(new Runnable() { |
634 @Override | 618 @Override |
635 public void run() { | 619 public void run() { |
636 testContainerView.getAwContents().flingScroll(1000, 1000); | 620 testContainerView.getAwContents().flingScroll(0, 1000); |
mkosiba (inactive)
2014/11/03 11:38:58
there is a CTS test identical test to this. I'll n
| |
637 } | 621 } |
638 }); | 622 }); |
639 | 623 |
640 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); | 624 onScrollToCallbackHelper.waitForCallback(scrollToCallCount); |
641 | 625 |
642 getInstrumentation().runOnMainSync(new Runnable() { | 626 getInstrumentation().runOnMainSync(new Runnable() { |
643 @Override | 627 @Override |
644 public void run() { | 628 public void run() { |
645 assertTrue(testContainerView.getScrollX() > 0); | |
646 assertTrue(testContainerView.getScrollY() > 0); | 629 assertTrue(testContainerView.getScrollY() > 0); |
647 } | 630 } |
648 }); | 631 }); |
649 } | 632 } |
650 | 633 |
651 @SmallTest | 634 @SmallTest |
652 @Feature({"AndroidWebView"}) | 635 @Feature({"AndroidWebView"}) |
653 public void testPageDown() throws Throwable { | 636 public void testPageDown() throws Throwable { |
654 final TestAwContentsClient contentsClient = new TestAwContentsClient(); | 637 final TestAwContentsClient contentsClient = new TestAwContentsClient(); |
655 final ScrollTestContainerView testContainerView = | 638 final ScrollTestContainerView testContainerView = |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
835 assertTrue(String.format(Locale.ENGLISH, | 818 assertTrue(String.format(Locale.ENGLISH, |
836 "Scroll range should increase after zoom (%d) > (%d)", | 819 "Scroll range should increase after zoom (%d) > (%d)", |
837 newScrollRange, oldScrollRange), newScrollRange > oldScr ollRange); | 820 newScrollRange, oldScrollRange), newScrollRange > oldScr ollRange); |
838 assertEquals(awContents.getContentHeightCss(), oldContentHeightA pproximation); | 821 assertEquals(awContents.getContentHeightCss(), oldContentHeightA pproximation); |
839 assertEquals(awContents.getContentHeightCss(), newContentHeightA pproximation); | 822 assertEquals(awContents.getContentHeightCss(), newContentHeightA pproximation); |
840 } | 823 } |
841 }); | 824 }); |
842 | 825 |
843 } | 826 } |
844 } | 827 } |
OLD | NEW |