| Index: android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
|
| diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
|
| index dca62e8be3d117548f57530b0586a80603ac36e3..38a7f5fd53e81cd3ee9c4642c16bf5b847be37b1 100644
|
| --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
|
| +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidScrollIntegrationTest.java
|
| @@ -129,45 +129,43 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
|
| }
|
|
|
| private static final String TEST_PAGE_COMMON_HEADERS =
|
| - "<meta name=\"viewport\" content=\"" +
|
| - "width=device-width, initial-scale=1, minimum-scale=1\"> " +
|
| - "<style type=\"text/css\"> " +
|
| - " body { " +
|
| - " margin: 0px; " +
|
| - " } " +
|
| - " div { " +
|
| - " width:1000px; " +
|
| - " height:10000px; " +
|
| - " background-color: blue; " +
|
| - " } " +
|
| - "</style> ";
|
| + "<meta name=\"viewport\" content=\""
|
| + + "width=device-width, initial-scale=1, minimum-scale=1\"> "
|
| + + "<style type=\"text/css\"> "
|
| + + " body { "
|
| + + " margin: 0px; "
|
| + + " } "
|
| + + " div { "
|
| + + " width:1000px; "
|
| + + " height:10000px; "
|
| + + " background-color: blue; "
|
| + + " } "
|
| + + "</style> ";
|
| private static final String TEST_PAGE_COMMON_CONTENT = "<div>test div</div> ";
|
|
|
| private String makeTestPage(String onscrollObserver, String firstFrameObserver,
|
| String extraContent) {
|
| String content = TEST_PAGE_COMMON_CONTENT + extraContent;
|
| if (onscrollObserver != null) {
|
| - content +=
|
| - "<script> " +
|
| - " window.onscroll = function(oEvent) { " +
|
| - " " + onscrollObserver + ".notifyJava(); " +
|
| - " } " +
|
| - "</script>";
|
| + content += "<script> "
|
| + + " window.onscroll = function(oEvent) { "
|
| + + " " + onscrollObserver + ".notifyJava(); "
|
| + + " } "
|
| + + "</script>";
|
| }
|
| if (firstFrameObserver != null) {
|
| - content +=
|
| - "<script> " +
|
| - " window.framesToIgnore = 20; " +
|
| - " window.onAnimationFrame = function(timestamp) { " +
|
| - " if (window.framesToIgnore == 0) { " +
|
| - " " + firstFrameObserver + ".notifyJava(); " +
|
| - " } else {" +
|
| - " window.framesToIgnore -= 1; " +
|
| - " window.requestAnimationFrame(window.onAnimationFrame); " +
|
| - " } " +
|
| - " }; " +
|
| - " window.requestAnimationFrame(window.onAnimationFrame); " +
|
| - "</script>";
|
| + content += "<script> "
|
| + + " window.framesToIgnore = 20; "
|
| + + " window.onAnimationFrame = function(timestamp) { "
|
| + + " if (window.framesToIgnore == 0) { "
|
| + + " " + firstFrameObserver + ".notifyJava(); "
|
| + + " } else {"
|
| + + " window.framesToIgnore -= 1; "
|
| + + " window.requestAnimationFrame(window.onAnimationFrame); "
|
| + + " } "
|
| + + " }; "
|
| + + " window.requestAnimationFrame(window.onAnimationFrame); "
|
| + + "</script>";
|
| }
|
| return CommonResources.makeHtmlPageFrom(TEST_PAGE_COMMON_HEADERS, content);
|
| }
|
| @@ -198,8 +196,8 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
|
| getInstrumentation().runOnMainSync(new Runnable() {
|
| @Override
|
| public void run() {
|
| - equal.set((scrollXPix == testContainerView.getScrollX()) &&
|
| - (scrollYPix == testContainerView.getScrollY()));
|
| + equal.set((scrollXPix == testContainerView.getScrollX())
|
| + && (scrollYPix == testContainerView.getScrollY()));
|
| }
|
| });
|
| return equal.get();
|
| @@ -226,16 +224,16 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
|
| "window.scrollX");
|
| String y = executeJavaScriptAndWaitForResult(awContents, contentsClient,
|
| "window.scrollY");
|
| - return (Integer.toString(xCss).equals(x) &&
|
| - Integer.toString(yCss).equals(y));
|
| + return (Integer.toString(xCss).equals(x)
|
| + && Integer.toString(yCss).equals(y));
|
| }
|
| });
|
| }
|
|
|
| private void assertScrolledToBottomInJs(final AwContents awContents,
|
| final TestAwContentsClient contentsClient) throws Exception {
|
| - final String isBottomScript = "window.scrollY == " +
|
| - "(window.document.documentElement.scrollHeight - window.innerHeight)";
|
| + final String isBottomScript = "window.scrollY == "
|
| + + "(window.document.documentElement.scrollHeight - window.innerHeight)";
|
| poll(new Callable<Boolean>() {
|
| @Override
|
| public Boolean call() throws Exception {
|
| @@ -349,9 +347,9 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
|
| final int targetScrollYPix = (int) Math.floor(targetScrollYCss * deviceDIPScale);
|
|
|
| final String scrollFromBodyScript =
|
| - "<script> " +
|
| - " window.scrollTo(" + targetScrollXCss + ", " + targetScrollYCss + "); " +
|
| - "</script> ";
|
| + "<script> "
|
| + + " window.scrollTo(" + targetScrollXCss + ", " + targetScrollYCss + "); "
|
| + + "</script> ";
|
|
|
| final CallbackHelper onScrollToCallbackHelper =
|
| testContainerView.getOnScrollToCallbackHelper();
|
| @@ -573,7 +571,6 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
|
| });
|
| }
|
|
|
| - @DisableHardwareAccelerationForTest
|
| @SmallTest
|
| @Feature({"AndroidWebView"})
|
| public void testPageDown() throws Throwable {
|
| @@ -589,8 +586,8 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
|
| final int maxScrollYPix = runTestOnUiThreadAndGetResult(new Callable<Integer>() {
|
| @Override
|
| public Integer call() {
|
| - return (testContainerView.getAwContents().computeVerticalScrollRange() -
|
| - testContainerView.getHeight());
|
| + return (testContainerView.getAwContents().computeVerticalScrollRange()
|
| + - testContainerView.getHeight());
|
| }
|
| });
|
|
|
| @@ -700,9 +697,9 @@ public class AndroidScrollIntegrationTest extends AwTestBase {
|
| final int targetScrollYPix = dragStepSize * dragSteps;
|
|
|
| loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null,
|
| - "<div>" +
|
| - " <div style=\"width:10000px; height: 10000px;\"> force scrolling </div>" +
|
| - "</div>");
|
| + "<div>"
|
| + + " <div style=\"width:10000px; height: 10000px;\"> force scrolling </div>"
|
| + + "</div>");
|
|
|
| getInstrumentation().runOnMainSync(new Runnable() {
|
| @Override
|
|
|