diff options
author | aurimas <aurimas@chromium.org> | 2014-10-16 14:10:22 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-10-16 21:10:38 +0000 |
commit | a49e9faf5eb9f5fe417ce6470bb58f95d2a7261e (patch) | |
tree | c6b258026f67cfdbab82110b917466c6b1f3c2c8 /android_webview/javatests/src | |
parent | d87ffab4e3cd44b2ad5df4c8360f9525c01c9076 (diff) | |
download | chromium_src-a49e9faf5eb9f5fe417ce6470bb58f95d2a7261e.zip chromium_src-a49e9faf5eb9f5fe417ce6470bb58f95d2a7261e.tar.gz chromium_src-a49e9faf5eb9f5fe417ce6470bb58f95d2a7261e.tar.bz2 |
Fix Java indentation issues.
Fix indentation issues to allow enabling Checkstyle indentation rule.
BUG=318404
Review URL: https://codereview.chromium.org/663573002
Cr-Commit-Position: refs/heads/master@{#299975}
Diffstat (limited to 'android_webview/javatests/src')
25 files changed, 454 insertions, 442 deletions
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 bd75c07..5f8b805 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 @@ -62,7 +62,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { private CallbackHelper mOnScrollToCallbackHelper = new CallbackHelper(); private OverScrollByCallbackHelper mOverScrollByCallbackHelper = - new OverScrollByCallbackHelper(); + new OverScrollByCallbackHelper(); public ScrollTestContainerView(Context context, boolean allowHardwareAcceleration) { super(context, allowHardwareAcceleration); @@ -129,17 +129,17 @@ public class AndroidScrollIntegrationTest extends AwTestBase { } private static final String TEST_PAGE_COMMON_HEADERS = - "<meta name=\"viewport\" content=\"width=device-width, initial-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\"> " + + "<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, @@ -198,7 +198,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { @Override public void run() { equal.set((scrollXPix == testContainerView.getScrollX()) && - (scrollYPix == testContainerView.getScrollY())); + (scrollYPix == testContainerView.getScrollY())); } }); return equal.get(); @@ -222,11 +222,11 @@ public class AndroidScrollIntegrationTest extends AwTestBase { @Override public Boolean call() throws Exception { String x = executeJavaScriptAndWaitForResult(awContents, contentsClient, - "window.scrollX"); + "window.scrollX"); String y = executeJavaScriptAndWaitForResult(awContents, contentsClient, - "window.scrollY"); + "window.scrollY"); return (Integer.toString(xCss).equals(x) && - Integer.toString(yCss).equals(y)); + Integer.toString(yCss).equals(y)); } }); } @@ -234,12 +234,12 @@ public class AndroidScrollIntegrationTest extends AwTestBase { private void assertScrolledToBottomInJs(final AwContents awContents, final TestAwContentsClient contentsClient) throws Exception { final String isBottomScript = "window.scrollY == " + - "(window.document.documentElement.scrollHeight - window.innerHeight)"; + "(window.document.documentElement.scrollHeight - window.innerHeight)"; poll(new Callable<Boolean>() { @Override public Boolean call() throws Exception { String r = executeJavaScriptAndWaitForResult(awContents, contentsClient, - isBottomScript); + isBottomScript); return r.equals("true"); } }); @@ -256,7 +256,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { @Override public void run() { firstFrameObserver.register(testContainerView.getContentViewCore(), - firstFrameObserverName); + firstFrameObserverName); } }); @@ -276,11 +276,11 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testUiScrollReflectedInJs() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int targetScrollXCss = 233; final int targetScrollYCss = 322; final int targetScrollXPix = (int) Math.ceil(targetScrollXCss * deviceDIPScale); @@ -291,7 +291,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { @Override public void run() { onscrollObserver.register(testContainerView.getContentViewCore(), - "onscrollObserver"); + "onscrollObserver"); } }); @@ -309,11 +309,11 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testJsScrollReflectedInUi() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int targetScrollXCss = 132; final int targetScrollYCss = 243; final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceDIPScale); @@ -323,7 +323,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { makeTestPage(null, null, ""), "text/html", false); final CallbackHelper onScrollToCallbackHelper = - testContainerView.getOnScrollToCallbackHelper(); + testContainerView.getOnScrollToCallbackHelper(); final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), contentsClient, String.format("window.scrollTo(%d, %d);", targetScrollXCss, targetScrollYCss)); @@ -337,23 +337,23 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testJsScrollFromBody() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int targetScrollXCss = 132; final int targetScrollYCss = 243; final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceDIPScale); 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(); + testContainerView.getOnScrollToCallbackHelper(); final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); loadDataAsync(testContainerView.getAwContents(), makeTestPage(null, null, scrollFromBodyScript), "text/html", false); @@ -367,11 +367,11 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testJsScrollCanBeAlteredByUi() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int targetScrollXCss = 132; final int targetScrollYCss = 243; final int targetScrollXPix = (int) Math.floor(targetScrollXCss * deviceDIPScale); @@ -388,7 +388,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { setMaxScrollOnMainSync(testContainerView, maxScrollXPix, maxScrollYPix); final CallbackHelper onScrollToCallbackHelper = - testContainerView.getOnScrollToCallbackHelper(); + testContainerView.getOnScrollToCallbackHelper(); final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), contentsClient, "window.scrollTo(" + targetScrollXCss + "," + targetScrollYCss + ")"); @@ -402,7 +402,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testTouchScrollCanBeAlteredByUi() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final int dragSteps = 10; @@ -413,7 +413,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { final int targetScrollYPix = dragStepSize * dragSteps; final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int maxScrollXPix = 101; final int maxScrollYPix = 211; // Make sure we can't hit these values simply as a result of scrolling. @@ -427,7 +427,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null, ""); final CallbackHelper onScrollToCallbackHelper = - testContainerView.getOnScrollToCallbackHelper(); + testContainerView.getOnScrollToCallbackHelper(); final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); AwTestTouchUtils.dragCompleteView(testContainerView, 0, -targetScrollXPix, // these need to be negative as we're scrolling down. @@ -437,8 +437,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { for (int i = 1; i <= dragSteps; ++i) { onScrollToCallbackHelper.waitForCallback(scrollToCallCount, i); - if (checkScrollOnMainSync(testContainerView, maxScrollXPix, maxScrollYPix)) - break; + if (checkScrollOnMainSync(testContainerView, maxScrollXPix, maxScrollYPix)) break; } assertScrollOnMainSync(testContainerView, maxScrollXPix, maxScrollYPix); @@ -451,7 +450,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testNoSpuriousOverScrolls() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final int dragSteps = 1; @@ -462,7 +461,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null, ""); final CallbackHelper onScrollToCallbackHelper = - testContainerView.getOnScrollToCallbackHelper(); + testContainerView.getOnScrollToCallbackHelper(); final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); CountDownLatch scrollingCompleteLatch = new CountDownLatch(1); AwTestTouchUtils.dragCompleteView(testContainerView, @@ -483,9 +482,9 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testOverScrollX() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); final OverScrollByCallbackHelper overScrollByCallbackHelper = - testContainerView.getOverScrollByCallbackHelper(); + testContainerView.getOverScrollByCallbackHelper(); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final int overScrollDeltaX = 30; @@ -516,9 +515,9 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testOverScrollY() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); final OverScrollByCallbackHelper overScrollByCallbackHelper = - testContainerView.getOverScrollByCallbackHelper(); + testContainerView.getOverScrollByCallbackHelper(); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final int overScrollDeltaY = 30; @@ -546,35 +545,35 @@ public class AndroidScrollIntegrationTest extends AwTestBase { // results in the view also reporting as being scrolled to the bottom. final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final int targetScrollXCss = 1000; final int targetScrollYCss = 10000; final String pageHeaders = - "<meta name=\"viewport\" content=\"width=device-width, initial-scale=0.6\"> " + - "<style type=\"text/css\"> " + - " div { " + - " width:1000px; " + - " height:10000px; " + - " background-color: blue; " + - " } " + - " body { " + - " margin: 0px; " + - " padding: 0px; " + - " } " + - "</style> "; + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=0.6\"> " + + "<style type=\"text/css\"> " + + " div { " + + " width:1000px; " + + " height:10000px; " + + " background-color: blue; " + + " } " + + " body { " + + " margin: 0px; " + + " padding: 0px; " + + " } " + + "</style> "; loadDataSync(testContainerView.getAwContents(), contentsClient.getOnPageFinishedHelper(), CommonResources.makeHtmlPageFrom(pageHeaders, TEST_PAGE_COMMON_CONTENT), "text/html", false); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final CallbackHelper onScrollToCallbackHelper = - testContainerView.getOnScrollToCallbackHelper(); + testContainerView.getOnScrollToCallbackHelper(); int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); executeJavaScriptAndWaitForResult(testContainerView.getAwContents(), contentsClient, "window.scrollTo(" + targetScrollXCss + "," + targetScrollYCss + ")"); @@ -620,7 +619,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testFlingScroll() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null, ""); @@ -628,7 +627,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { assertScrollOnMainSync(testContainerView, 0, 0); final CallbackHelper onScrollToCallbackHelper = - testContainerView.getOnScrollToCallbackHelper(); + testContainerView.getOnScrollToCallbackHelper(); final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); getInstrumentation().runOnMainSync(new Runnable() { @@ -654,7 +653,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testPageDown() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); loadTestPageAndWaitForFirstFrame(testContainerView, contentsClient, null, ""); @@ -670,7 +669,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { }); final CallbackHelper onScrollToCallbackHelper = - testContainerView.getOnScrollToCallbackHelper(); + testContainerView.getOnScrollToCallbackHelper(); final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); getInstrumentation().runOnMainSync(new Runnable() { @@ -683,8 +682,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { // Wait for the animation to hit the bottom of the page. for (int i = 1;; ++i) { onScrollToCallbackHelper.waitForCallback(scrollToCallCount, i); - if (checkScrollOnMainSync(testContainerView, 0, maxScrollYPix)) - break; + if (checkScrollOnMainSync(testContainerView, 0, maxScrollYPix)) break; } } @@ -693,11 +691,11 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testPageUp() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); enableJavaScriptOnUiThread(testContainerView.getAwContents()); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int targetScrollYCss = 243; final int targetScrollYPix = (int) Math.ceil(targetScrollYCss * deviceDIPScale); @@ -708,7 +706,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { scrollToOnMainSync(testContainerView, 0, targetScrollYPix); final CallbackHelper onScrollToCallbackHelper = - testContainerView.getOnScrollToCallbackHelper(); + testContainerView.getOnScrollToCallbackHelper(); final int scrollToCallCount = onScrollToCallbackHelper.getCallCount(); getInstrumentation().runOnMainSync(new Runnable() { @@ -721,8 +719,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { // Wait for the animation to hit the bottom of the page. for (int i = 1;; ++i) { onScrollToCallbackHelper.waitForCallback(scrollToCallCount, i); - if (checkScrollOnMainSync(testContainerView, 0, 0)) - break; + if (checkScrollOnMainSync(testContainerView, 0, 0)) break; } } @@ -765,7 +762,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testTouchScrollingConsumesScrollByGesture() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); final TestGestureStateListener testGestureStateListener = new TestGestureStateListener(); enableJavaScriptOnUiThread(testContainerView.getAwContents()); @@ -789,7 +786,7 @@ public class AndroidScrollIntegrationTest extends AwTestBase { } }); final CallbackHelper onScrollUpdateGestureConsumedHelper = - testGestureStateListener.getOnScrollUpdateGestureConsumedHelper(); + testGestureStateListener.getOnScrollUpdateGestureConsumedHelper(); final int callCount = onScrollUpdateGestureConsumedHelper.getCallCount(); AwTestTouchUtils.dragCompleteView(testContainerView, @@ -805,9 +802,9 @@ public class AndroidScrollIntegrationTest extends AwTestBase { public void testPinchZoomUpdatesScrollRangeSynchronously() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final ScrollTestContainerView testContainerView = - (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); + (ScrollTestContainerView) createAwTestContainerViewOnMainSync(contentsClient); final OverScrollByCallbackHelper overScrollByCallbackHelper = - testContainerView.getOverScrollByCallbackHelper(); + testContainerView.getOverScrollByCallbackHelper(); final AwContents awContents = testContainerView.getAwContents(); enableJavaScriptOnUiThread(awContents); @@ -819,18 +816,18 @@ public class AndroidScrollIntegrationTest extends AwTestBase { assertTrue(awContents.canZoomIn()); int oldScrollRange = - awContents.computeVerticalScrollRange() - testContainerView.getHeight(); + awContents.computeVerticalScrollRange() - testContainerView.getHeight(); float oldScale = awContents.getScale(); int oldContentHeightApproximation = - (int) Math.ceil(awContents.computeVerticalScrollRange() / oldScale); + (int) Math.ceil(awContents.computeVerticalScrollRange() / oldScale); awContents.zoomIn(); int newScrollRange = - awContents.computeVerticalScrollRange() - testContainerView.getHeight(); + awContents.computeVerticalScrollRange() - testContainerView.getHeight(); float newScale = awContents.getScale(); int newContentHeightApproximation = - (int) Math.ceil(awContents.computeVerticalScrollRange() / newScale); + (int) Math.ceil(awContents.computeVerticalScrollRange() / newScale); assertTrue(String.format(Locale.ENGLISH, "Scale range should increase after zoom (%f) > (%f)", diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java index 84278da..2930d39 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AndroidViewIntegrationTest.java @@ -47,22 +47,24 @@ public class AndroidViewIntegrationTest extends AwTestBase { } private OnContentSizeChangedHelper mOnContentSizeChangedHelper = - new OnContentSizeChangedHelper(); + new OnContentSizeChangedHelper(); private CallbackHelper mOnPageScaleChangedHelper = new CallbackHelper(); private class TestAwLayoutSizer extends AwLayoutSizer { @Override public void onContentSizeChanged(int widthCss, int heightCss) { super.onContentSizeChanged(widthCss, heightCss); - if (mOnContentSizeChangedHelper != null) + if (mOnContentSizeChangedHelper != null) { mOnContentSizeChangedHelper.onContentSizeChanged(widthCss, heightCss); + } } @Override public void onPageScaleChanged(float pageScaleFactor) { super.onPageScaleChanged(pageScaleFactor); - if (mOnPageScaleChangedHelper != null) + if (mOnPageScaleChangedHelper != null) { mOnPageScaleChangedHelper.notifyCalled(); + } } } @@ -77,7 +79,7 @@ public class AndroidViewIntegrationTest extends AwTestBase { } final LinearLayout.LayoutParams mWrapContentLayoutParams = - new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); + new LinearLayout.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT); private AwTestContainerView createCustomTestContainerViewOnMainSync( final AwContentsClient awContentsClient, final int visibility) throws Exception { @@ -191,7 +193,7 @@ public class AndroidViewIntegrationTest extends AwTestBase { public void testDisconnectedViewLoadsContent() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createDetachedTestContainerViewOnMainSync(contentsClient); + createDetachedTestContainerViewOnMainSync(contentsClient); assertZeroHeight(testContainerView); final int contentSizeChangeCallCount = mOnContentSizeChangedHelper.getCallCount(); @@ -204,8 +206,7 @@ public class AndroidViewIntegrationTest extends AwTestBase { private String makeHtmlPageOfSize(int widthCss, int heightCss, boolean heightPercent) { String content = "<div class=\"normal\">a</div>"; - if (heightPercent) - content += "<div class=\"heightPercent\"></div>"; + if (heightPercent) content += "<div class=\"heightPercent\"></div>"; return CommonResources.makeHtmlPageFrom( "<style type=\"text/css\">" + "body { margin:0px; padding:0px; } " + @@ -282,15 +283,15 @@ public class AndroidViewIntegrationTest extends AwTestBase { final int heightCss = 180; final String htmlData = CommonResources.makeHtmlPageFrom( - "<style type=\"text/css\">" + - "body { margin:0px; padding:0px; } " + - "div { " + - "position: absolute; " + - "width:" + widthCss + "px; " + - "height:" + heightCss + "px; " + - "background-color: red; " + - "} " + - "</style>", "<div>a</div>"); + "<style type=\"text/css\">" + + " body { margin:0px; padding:0px; } " + + " div { " + + " position: absolute; " + + " width:" + widthCss + "px; " + + " height:" + heightCss + "px; " + + " background-color: red; " + + " } " + + "</style>", "<div>a</div>"); final int contentSizeChangeCallCount = mOnContentSizeChangedHelper.getCallCount(); loadDataAsync(testContainerView.getAwContents(), htmlData, "text/html", false); @@ -308,7 +309,7 @@ public class AndroidViewIntegrationTest extends AwTestBase { assertZeroHeight(testContainerView); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int contentWidthCss = 142; final int contentHeightCss = 180; @@ -316,7 +317,7 @@ public class AndroidViewIntegrationTest extends AwTestBase { // In wrap-content mode the AwLayoutSizer will size the view to be as wide as the parent // view. final int expectedWidthCss = - (int) Math.ceil(getRootLayoutWidthOnMainThread() / deviceDIPScale); + (int) Math.ceil(getRootLayoutWidthOnMainThread() / deviceDIPScale); final int expectedHeightCss = contentHeightCss; loadPageOfSizeAndWaitForSizeChange(testContainerView.getAwContents(), @@ -336,13 +337,13 @@ public class AndroidViewIntegrationTest extends AwTestBase { assertZeroHeight(testContainerView); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int contentWidthCss = 142; final int contentHeightCss = 180; final int expectedWidthCss = - (int) Math.ceil(getRootLayoutWidthOnMainThread() / deviceDIPScale); + (int) Math.ceil(getRootLayoutWidthOnMainThread() / deviceDIPScale); final int expectedHeightCss = contentHeightCss; loadPageOfSizeAndWaitForSizeChange(testContainerView.getAwContents(), @@ -362,15 +363,15 @@ public class AndroidViewIntegrationTest extends AwTestBase { final AwContents awContents = testContainerView.getAwContents(); final double deviceDIPScale = - DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); + DeviceDisplayInfo.create(testContainerView.getContext()).getDIPScale(); final int physicalWidth = 600; final int spanWidth = 42; final int expectedWidthCss = - (int) Math.ceil(physicalWidth / deviceDIPScale); + (int) Math.ceil(physicalWidth / deviceDIPScale); StringBuilder htmlBuilder = new StringBuilder("<html><body style='margin:0px;'>"); final String spanBlock = - "<span style='width: " + spanWidth + "px; display: inline-block;'>a</span>"; + "<span style='width: " + spanWidth + "px; display: inline-block;'>a</span>"; for (int i = 0; i < 10; ++i) { htmlBuilder.append(spanBlock); } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientAutoLoginTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientAutoLoginTest.java index 2fac919..7385b36 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientAutoLoginTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientAutoLoginTest.java @@ -27,7 +27,7 @@ public class AwContentsClientAutoLoginTest extends AwTestBase { AwTestContainerView testView = createAwTestContainerViewOnMainSync(mContentsClient); AwContents awContents = testView.getAwContents(); final OnReceivedLoginRequestHelper loginRequestHelper = - mContentsClient.getOnReceivedLoginRequestHelper(); + mContentsClient.getOnReceivedLoginRequestHelper(); final String path = "/" + testName + ".html"; final String html = testName; diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java index 8b5cab3..570afd8 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientCallbackHelperTest.java @@ -133,7 +133,7 @@ public class AwContentsClientCallbackHelperTest extends AwTestBase { @SmallTest public void testOnNewPicture() throws Exception { final PictureListenerHelper pictureListenerHelper = - mContentsClient.getPictureListenerHelper(); + mContentsClient.getPictureListenerHelper(); final Picture thePicture = new Picture(); @@ -183,7 +183,7 @@ public class AwContentsClientCallbackHelperTest extends AwTestBase { @SmallTest public void testOnReceivedLoginRequest() throws Exception { OnReceivedLoginRequestHelper receivedLoginRequestHelper = - mContentsClient.getOnReceivedLoginRequestHelper(); + mContentsClient.getOnReceivedLoginRequestHelper(); int onReceivedLoginRequestCount = receivedLoginRequestHelper.getCallCount(); mClientHelper.postOnReceivedLoginRequest(REALM, ACCOUNT, ARGS); @@ -197,7 +197,7 @@ public class AwContentsClientCallbackHelperTest extends AwTestBase { @SmallTest public void testOnReceivedError() throws Exception { OnReceivedErrorHelper receivedErrorHelper = - mContentsClient.getOnReceivedErrorHelper(); + mContentsClient.getOnReceivedErrorHelper(); int onReceivedErrorCount = receivedErrorHelper.getCallCount(); mClientHelper.postOnReceivedError(ERROR_CODE, ERROR_MESSAGE, TEST_URL); @@ -211,7 +211,7 @@ public class AwContentsClientCallbackHelperTest extends AwTestBase { @SmallTest public void testOnScaleChangedScaled() throws Exception { TestAwContentsClient.OnScaleChangedHelper scaleChangedHelper = - mContentsClient.getOnScaleChangedHelper(); + mContentsClient.getOnScaleChangedHelper(); int onScaleChangeCount = scaleChangedHelper.getCallCount(); mClientHelper.postOnScaleChangedScaled(OLD_SCALE, NEW_SCALE); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java index f70e7a9..ff3d0fc 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientFaviconTest.java @@ -111,9 +111,9 @@ public class AwContentsClientFaviconTest extends AwTestBase { int callCount = mContentsClient.mFaviconHelper.getCallCount(); final String faviconUrl = mWebServer.setResponseBase64(FAVICON1_URL, - CommonResources.FAVICON_DATA_BASE64, CommonResources.getImagePngHeaders(true)); + CommonResources.FAVICON_DATA_BASE64, CommonResources.getImagePngHeaders(true)); final String pageUrl = mWebServer.setResponse(FAVICON1_PAGE_URL, FAVICON1_PAGE_HTML, - CommonResources.getTextHtmlHeaders(true)); + CommonResources.getTextHtmlHeaders(true)); loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), pageUrl); @@ -138,7 +138,7 @@ public class AwContentsClientFaviconTest extends AwTestBase { mWebServer.setResponseWithNotFoundStatus(FAVICON1_URL); final String pageUrl = mWebServer.setResponse(FAVICON1_PAGE_URL, FAVICON1_PAGE_HTML, - CommonResources.getTextHtmlHeaders(true)); + CommonResources.getTextHtmlHeaders(true)); loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), pageUrl); poll(new Callable<Boolean>() { @@ -161,7 +161,7 @@ public class AwContentsClientFaviconTest extends AwTestBase { int callCount = mContentsClient.mFaviconHelper.getCallCount(); final String pageUrl = mWebServer.setResponse(TOUCHICON_REL_URL, TOUCHICON_REL_PAGE_HTML, - CommonResources.getTextHtmlHeaders(true)); + CommonResources.getTextHtmlHeaders(true)); loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), pageUrl); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java index 47cb465..4606961 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldInterceptRequestTest.java @@ -43,10 +43,10 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { public static class ShouldInterceptRequestHelper extends CallbackHelper { private List<String> mShouldInterceptRequestUrls = new ArrayList<String>(); - private ConcurrentHashMap<String, AwWebResourceResponse> mReturnValuesByUrls - = new ConcurrentHashMap<String, AwWebResourceResponse>(); - private ConcurrentHashMap<String, ShouldInterceptRequestParams> mParamsByUrls - = new ConcurrentHashMap<String, ShouldInterceptRequestParams>(); + private ConcurrentHashMap<String, AwWebResourceResponse> mReturnValuesByUrls = + new ConcurrentHashMap<String, AwWebResourceResponse>(); + private ConcurrentHashMap<String, ShouldInterceptRequestParams> mParamsByUrls = + new ConcurrentHashMap<String, ShouldInterceptRequestParams>(); // This is read from the IO thread, so needs to be marked volatile. private volatile AwWebResourceResponse mShouldInterceptRequestReturnValue = null; void setReturnValue(AwWebResourceResponse value) { @@ -93,7 +93,7 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { @Override public AwWebResourceResponse shouldInterceptRequest(ShouldInterceptRequestParams params) { AwWebResourceResponse returnValue = - mShouldInterceptRequestHelper.getReturnValue(params.url); + mShouldInterceptRequestHelper.getReturnValue(params.url); mShouldInterceptRequestHelper.notifyCalled(params); return returnValue; } @@ -286,7 +286,7 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { mShouldInterceptRequestHelper.waitForCallback(callCount, 2); Map<String, String> headers = - mShouldInterceptRequestHelper.getParamsForUrl(syncGetUrl).requestHeaders; + mShouldInterceptRequestHelper.getParamsForUrl(syncGetUrl).requestHeaders; assertTrue(headers.containsKey(headerName)); assertEquals(headerValue, headers.get(headerName)); } @@ -296,7 +296,7 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { public void testOnLoadResourceCalledWithCorrectUrl() throws Throwable { final String aboutPageUrl = addAboutPageToTestServer(mWebServer); final TestAwContentsClient.OnLoadResourceHelper onLoadResourceHelper = - mContentsClient.getOnLoadResourceHelper(); + mContentsClient.getOnLoadResourceHelper(); int callCount = onLoadResourceHelper.getCallCount(); @@ -453,8 +453,8 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { final String aboutPageData = makePageWithTitle("some title"); final String encoding = "UTF-8"; final SlowAwWebResourceResponse slowAwWebResourceResponse = - new SlowAwWebResourceResponse("text/html", encoding, - new ByteArrayInputStream(aboutPageData.getBytes(encoding))); + new SlowAwWebResourceResponse("text/html", encoding, + new ByteArrayInputStream(aboutPageData.getBytes(encoding))); mShouldInterceptRequestHelper.setReturnValue(slowAwWebResourceResponse); int callCount = slowAwWebResourceResponse.getReadStartedCallbackHelper().getCallCount(); @@ -487,14 +487,14 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { public void testHttpStatusCodeAndText() throws Throwable { final String syncGetUrl = mWebServer.getResponseUrl("/intercept_me"); final String syncGetJs = - "(function() {" + - " var xhr = new XMLHttpRequest();" + - " xhr.open('GET', '" + syncGetUrl + "', false);" + - " xhr.send(null);" + - " console.info('xhr.status = ' + xhr.status);" + - " console.info('xhr.statusText = ' + xhr.statusText);" + - " return '[' + xhr.status + '][' + xhr.statusText + ']';" + - "})();"; + "(function() {" + + " var xhr = new XMLHttpRequest();" + + " xhr.open('GET', '" + syncGetUrl + "', false);" + + " xhr.send(null);" + + " console.info('xhr.status = ' + xhr.status);" + + " console.info('xhr.statusText = ' + xhr.statusText);" + + " return '[' + xhr.status + '][' + xhr.statusText + ']';" + + "})();"; enableJavaScriptOnUiThread(mAwContents); final String aboutPageUrl = addAboutPageToTestServer(mWebServer); @@ -512,7 +512,7 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { mShouldInterceptRequestHelper.setReturnValue( new AwWebResourceResponse("text/html", "UTF-8", new EmptyInputStream(), - TEAPOT_STATUS_CODE, TEAPOT_RESPONSE_PHRASE, new HashMap<String, String>())); + TEAPOT_STATUS_CODE, TEAPOT_RESPONSE_PHRASE, new HashMap<String, String>())); assertEquals("\"[" + TEAPOT_STATUS_CODE + "][" + TEAPOT_RESPONSE_PHRASE + "]\"", executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, syncGetJs)); } @@ -520,13 +520,13 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { private String getHeaderValue(AwContents awContents, TestAwContentsClient contentsClient, String url, String headerName) throws Exception { final String syncGetJs = - "(function() {" + - " var xhr = new XMLHttpRequest();" + - " xhr.open('GET', '" + url + "', false);" + - " xhr.send(null);" + - " console.info(xhr.getAllResponseHeaders());" + - " return xhr.getResponseHeader('" + headerName + "');" + - "})();"; + "(function() {" + + " var xhr = new XMLHttpRequest();" + + " xhr.open('GET', '" + url + "', false);" + + " xhr.send(null);" + + " console.info(xhr.getAllResponseHeaders());" + + " return xhr.getResponseHeader('" + headerName + "');" + + "})();"; String header = executeJavaScriptAndWaitForResult(awContents, contentsClient, syncGetJs); if (header.equals("null")) @@ -636,7 +636,7 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { @Feature({"AndroidWebView"}) public void testNullInputStreamCausesErrorForMainFrame() throws Throwable { final OnReceivedErrorHelper onReceivedErrorHelper = - mContentsClient.getOnReceivedErrorHelper(); + mContentsClient.getOnReceivedErrorHelper(); mShouldInterceptRequestHelper.setReturnValue( new AwWebResourceResponse("text/html", "UTF-8", null)); @@ -655,8 +655,8 @@ public class AwContentsClientShouldInterceptRequestTest extends AwTestBase { mWebServer.setResponseBase64(imagePath, CommonResources.FAVICON_DATA_BASE64, CommonResources.getImagePngHeaders(true)); final String pageWithImage = - addPageToTestServer(mWebServer, "/page_with_image.html", - CommonResources.getOnImageLoadedHtml(CommonResources.FAVICON_FILENAME)); + addPageToTestServer(mWebServer, "/page_with_image.html", + CommonResources.getOnImageLoadedHtml(CommonResources.FAVICON_FILENAME)); int callCount = mShouldInterceptRequestHelper.getCallCount(); loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), pageWithImage); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java index 97331c1..1284fba 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientShouldOverrideUrlLoadingTest.java @@ -118,10 +118,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testNotCalledOnLoadUrl() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); loadDataSync(awContents, contentsClient.getOnPageFinishedHelper(), CommonResources.makeHtmlPageWithSimpleLinkTo(DATA_URL), "text/html", false); @@ -144,10 +144,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testNotCalledOnBackForwardNavigation() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); final String[] pageTitles = new String[] { "page1", "page2", "page3" }; for (String title : pageTitles) { @@ -159,38 +159,38 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { waitForNavigationRunnableAndAssertTitleChanged(awContents, contentsClient.getOnPageFinishedHelper(), new Runnable() { - @Override - public void run() { - awContents.goBack(); - } - }); + @Override + public void run() { + awContents.goBack(); + } + }); assertEquals(0, shouldOverrideUrlLoadingHelper.getCallCount()); waitForNavigationRunnableAndAssertTitleChanged(awContents, contentsClient.getOnPageFinishedHelper(), new Runnable() { - @Override - public void run() { - awContents.goForward(); - } - }); + @Override + public void run() { + awContents.goForward(); + } + }); assertEquals(0, shouldOverrideUrlLoadingHelper.getCallCount()); waitForNavigationRunnableAndAssertTitleChanged(awContents, contentsClient.getOnPageFinishedHelper(), new Runnable() { - @Override - public void run() { - awContents.goBackOrForward(-2); - } - }); + @Override + public void run() { + awContents.goBackOrForward(-2); + } + }); assertEquals(0, shouldOverrideUrlLoadingHelper.getCallCount()); waitForNavigationRunnableAndAssertTitleChanged(awContents, contentsClient.getOnPageFinishedHelper(), new Runnable() { - @Override - public void run() { - awContents.goBackOrForward(1); - } - }); + @Override + public void run() { + awContents.goBackOrForward(1); + } + }); assertEquals(0, shouldOverrideUrlLoadingHelper.getCallCount()); } @@ -199,10 +199,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testCantBlockLoads() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); setShouldOverrideUrlLoadingReturnValueOnUiThread(shouldOverrideUrlLoadingHelper, true); @@ -218,10 +218,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testCalledBeforeOnPageStarted() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); OnPageStartedHelper onPageStartedHelper = contentsClient.getOnPageStartedHelper(); loadDataSync(awContents, contentsClient.getOnPageFinishedHelper(), @@ -242,10 +242,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testDoesNotCauseOnReceivedError() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); OnReceivedErrorHelper onReceivedErrorHelper = contentsClient.getOnReceivedErrorHelper(); final int onReceivedErrorCallCount = onReceivedErrorHelper.getCallCount(); @@ -284,10 +284,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { private void doTestNotCalledForAnchorNavigations(boolean useLoadData) throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); final String anchorLinkPath = "/anchor_link.html"; final String anchorLinkUrl = mWebServer.getResponseUrl(anchorLinkPath); @@ -302,7 +302,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { } final int shouldOverrideUrlLoadingCallCount = - shouldOverrideUrlLoadingHelper.getCallCount(); + shouldOverrideUrlLoadingHelper.getCallCount(); clickOnLinkUsingJs(awContents, contentsClient); @@ -319,7 +319,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testCalledWhenLinkClicked() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = contentsClient.getShouldOverrideUrlLoadingHelper(); @@ -340,7 +340,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testCalledWhenTopLevelAboutBlankNavigation() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = contentsClient.getShouldOverrideUrlLoadingHelper(); @@ -367,7 +367,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testCalledWhenSelfLinkClicked() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = contentsClient.getShouldOverrideUrlLoadingHelper(); @@ -395,7 +395,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); enableJavaScriptOnUiThread(awContents); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = @@ -418,7 +418,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); enableJavaScriptOnUiThread(awContents); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = @@ -438,7 +438,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testPassesCorrectUrl() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = contentsClient.getShouldOverrideUrlLoadingHelper(); @@ -460,7 +460,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testCanIgnoreLoading() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = contentsClient.getShouldOverrideUrlLoadingHelper(); @@ -505,7 +505,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { "L2hlYWQ+PC9odG1sPg=="; final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = contentsClient.getShouldOverrideUrlLoadingHelper(); @@ -527,7 +527,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testCalledForUnsupportedSchemes() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = contentsClient.getShouldOverrideUrlLoadingHelper(); @@ -550,10 +550,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { // The reason POST requests are excluded is BUG 155250. final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); final String redirectTargetUrl = createRedirectTargetPage(mWebServer); final String postLinkUrl = addPageToTestServer(mWebServer, "/page_with_post_link.html", @@ -562,7 +562,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), postLinkUrl); final int shouldOverrideUrlLoadingCallCount = - shouldOverrideUrlLoadingHelper.getCallCount(); + shouldOverrideUrlLoadingHelper.getCallCount(); assertEquals(0, mWebServer.getRequestCount(REDIRECT_TARGET_PATH)); clickOnLinkUsingJs(awContents, contentsClient); @@ -588,10 +588,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { // The reason POST requests are excluded is BUG 155250. final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); final String redirectTargetUrl = createRedirectTargetPage(mWebServer); final String postToGetRedirectUrl = mWebServer.setRedirect("/302.html", redirectTargetUrl); @@ -601,7 +601,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), postLinkUrl); final int shouldOverrideUrlLoadingCallCount = - shouldOverrideUrlLoadingHelper.getCallCount(); + shouldOverrideUrlLoadingHelper.getCallCount(); clickOnLinkUsingJs(awContents, contentsClient); @@ -624,20 +624,20 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testNotCalledForIframeHttpNavigations() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); final String iframeRedirectTargetUrl = createRedirectTargetPage(mWebServer); final String iframeRedirectUrl = - mWebServer.setRedirect("/302.html", iframeRedirectTargetUrl); + mWebServer.setRedirect("/302.html", iframeRedirectTargetUrl); final String pageWithIframeUrl = - addPageToTestServer(mWebServer, "/iframe_intercept.html", - makeHtmlPageFrom("", "<iframe src=\"" + iframeRedirectUrl + "\" />")); + addPageToTestServer(mWebServer, "/iframe_intercept.html", + makeHtmlPageFrom("", "<iframe src=\"" + iframeRedirectUrl + "\" />")); final int shouldOverrideUrlLoadingCallCount = - shouldOverrideUrlLoadingHelper.getCallCount(); + shouldOverrideUrlLoadingHelper.getCallCount(); assertEquals(0, mWebServer.getRequestCount(REDIRECT_TARGET_PATH)); loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), pageWithIframeUrl); @@ -659,18 +659,18 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { public void testCalledForIframeUnsupportedSchemeNavigations() throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); final String unsupportedSchemeUrl = "foobar://resource/1"; final String pageWithIframeUrl = - addPageToTestServer(mWebServer, "/iframe_intercept.html", - makeHtmlPageFrom("", "<iframe src=\"" + unsupportedSchemeUrl + "\" />")); + addPageToTestServer(mWebServer, "/iframe_intercept.html", + makeHtmlPageFrom("", "<iframe src=\"" + unsupportedSchemeUrl + "\" />")); final int shouldOverrideUrlLoadingCallCount = - shouldOverrideUrlLoadingHelper.getCallCount(); + shouldOverrideUrlLoadingHelper.getCallCount(); loadUrlSync(awContents, contentsClient.getOnPageFinishedHelper(), pageWithIframeUrl); @@ -691,7 +691,7 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { String redirectUrl, String redirectTarget) throws Throwable { final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); final String pageWithLinkToRedirectUrl = addPageToTestServer(webServer, "/page_with_link_to_redirect.html", @@ -794,10 +794,10 @@ public class AwContentsClientShouldOverrideUrlLoadingTest extends AwTestBase { final String jsUrl = "javascript:try{console.log('processed js loadUrl');}catch(e){};"; final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(contentsClient); + createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); TestAwContentsClient.ShouldOverrideUrlLoadingHelper shouldOverrideUrlLoadingHelper = - contentsClient.getShouldOverrideUrlLoadingHelper(); + contentsClient.getShouldOverrideUrlLoadingHelper(); // Do a double navigagtion, the second being an effective no-op, in quick succession (i.e. // without yielding the main thread inbetween). diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientVisitedHistoryTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientVisitedHistoryTest.java index 5d5c9fc..8e0c0df 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientVisitedHistoryTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsClientVisitedHistoryTest.java @@ -58,7 +58,7 @@ public class AwContentsClientVisitedHistoryTest extends AwTestBase { } private VisitedHistoryTestAwContentsClient mContentsClient = - new VisitedHistoryTestAwContentsClient(); + new VisitedHistoryTestAwContentsClient(); @Feature({"AndroidWebView"}) @SmallTest @@ -73,7 +73,7 @@ public class AwContentsClientVisitedHistoryTest extends AwTestBase { try { final String pageUrl = webServer.setResponse(path, html, null); final DoUpdateVisitedHistoryHelper doUpdateVisitedHistoryHelper = - mContentsClient.getDoUpdateVisitedHistoryHelper(); + mContentsClient.getDoUpdateVisitedHistoryHelper(); int callCount = doUpdateVisitedHistoryHelper.getCallCount(); loadUrlAsync(awContents, pageUrl); doUpdateVisitedHistoryHelper.waitForCallback(callCount); @@ -98,7 +98,7 @@ public class AwContentsClientVisitedHistoryTest extends AwTestBase { // possible test this end to end without using the flaky and brittle capturing picture of // the web page. So we are doing the next best thing, exercising all the code paths. final GetVisitedHistoryHelper visitedHistoryHelper = - mContentsClient.getGetVisitedHistoryHelper(); + mContentsClient.getGetVisitedHistoryHelper(); final int callCount = visitedHistoryHelper.getCallCount(); visitedHistoryHelper.setSaveCallback(true); @@ -129,7 +129,7 @@ public class AwContentsClientVisitedHistoryTest extends AwTestBase { @SmallTest public void testGetVisitedHistoryCallbackAfterDestroy() throws Throwable { GetVisitedHistoryHelper visitedHistoryHelper = - mContentsClient.getGetVisitedHistoryHelper(); + mContentsClient.getGetVisitedHistoryHelper(); visitedHistoryHelper.setSaveCallback(true); final int callCount = visitedHistoryHelper.getCallCount(); AwTestContainerView testView = createAwTestContainerViewOnMainSync(mContentsClient); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java index c2f611e..963e336 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsRenderTest.java @@ -82,8 +82,8 @@ public class AwContentsRenderTest extends AwTestBase { pollForBackgroundColor(Color.YELLOW); loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), - "data:text/html,<html><head><style>body {background-color:#227788}</style></head>" + - "<body></body></html>"); + "data:text/html,<html><head><style>body {background-color:#227788}</style></head>" + + "<body></body></html>"); pollForBackgroundColor(Color.rgb(0x22, 0x77, 0x88)); // Changing the base background should not override CSS background. diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java index 3ff100f..43cbe928 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwContentsTest.java @@ -217,7 +217,7 @@ public class AwContentsTest extends AwTestBase { runTestOnUiThread(new Runnable() { @Override public void run() { - awContents.documentHasImages(msg); + awContents.documentHasImages(msg); } }); assertTrue(s.tryAcquire(WAIT_TIMEOUT_MS, TimeUnit.MILLISECONDS)); @@ -349,7 +349,7 @@ public class AwContentsTest extends AwTestBase { final Object originalFaviconSource = (new URL(faviconUrl)).getContent(); final Bitmap originalFavicon = - BitmapFactory.decodeStream((InputStream) originalFaviconSource); + BitmapFactory.decodeStream((InputStream) originalFaviconSource); assertNotNull(originalFavicon); assertTrue(awContents.getFavicon().sameAs(originalFavicon)); @@ -379,7 +379,7 @@ public class AwContentsTest extends AwTestBase { final String pageUrl = webServer.setResponse( "/download.txt", data, downloadHeaders); final OnDownloadStartHelper downloadStartHelper = - mContentsClient.getOnDownloadStartHelper(); + mContentsClient.getOnDownloadStartHelper(); final int callCount = downloadStartHelper.getCallCount(); loadUrlAsync(awContents, pageUrl); downloadStartHelper.waitForCallback(callCount); @@ -405,17 +405,17 @@ public class AwContentsTest extends AwTestBase { // Default to "online". assertEquals("true", executeJavaScriptAndWaitForResult(awContents, mContentsClient, - script)); + script)); // Forcing "offline". setNetworkAvailableOnUiThread(awContents, false); assertEquals("false", executeJavaScriptAndWaitForResult(awContents, mContentsClient, - script)); + script)); // Forcing "online". setNetworkAvailableOnUiThread(awContents, true); assertEquals("true", executeJavaScriptAndWaitForResult(awContents, mContentsClient, - script)); + script)); } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java index df1c0d6..cc5430f 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwQuotaManagerBridgeTest.java @@ -101,13 +101,12 @@ public class AwQuotaManagerBridgeTest extends AwTestBase { @Override public void run() { bridge.getQuotaForOrigin("foo.com", - new ValueCallback<Long>() { - @Override - public void onReceiveValue(Long quota) { - callbackHelper.notifyCalled(quota); - } - } - ); + new ValueCallback<Long>() { + @Override + public void onReceiveValue(Long quota) { + callbackHelper.notifyCalled(quota); + } + }); } }); callbackHelper.waitForCallback(callCount); @@ -125,13 +124,12 @@ public class AwQuotaManagerBridgeTest extends AwTestBase { @Override public void run() { bridge.getUsageForOrigin(origin, - new ValueCallback<Long>() { - @Override - public void onReceiveValue(Long usage) { - callbackHelper.notifyCalled(usage); - } - } - ); + new ValueCallback<Long>() { + @Override + public void onReceiveValue(Long usage) { + callbackHelper.notifyCalled(usage); + } + }); } }); callbackHelper.waitForCallback(callCount); @@ -157,7 +155,7 @@ public class AwQuotaManagerBridgeTest extends AwTestBase { loadUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), url); executeJavaScriptAndWaitForResult(mAwContents, mContentsClient, - "window.applicationCache.update();"); + "window.applicationCache.update();"); } @LargeTest diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java index 57e9c33..d43870f 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwSettingsTest.java @@ -110,26 +110,26 @@ public class AwSettingsTest extends AwTestBase { protected void loadDataSync(String data) throws Throwable { AwSettingsTest.this.loadDataSync( - mAwContents, - mContentViewClient.getOnPageFinishedHelper(), - data, - "text/html", - false); + mAwContents, + mContentViewClient.getOnPageFinishedHelper(), + data, + "text/html", + false); } protected void loadUrlSync(String url) throws Throwable { AwSettingsTest.this.loadUrlSync( - mAwContents, - mContentViewClient.getOnPageFinishedHelper(), - url); + mAwContents, + mContentViewClient.getOnPageFinishedHelper(), + url); } protected void loadUrlSyncAndExpectError(String url) throws Throwable { AwSettingsTest.this.loadUrlSyncAndExpectError( - mAwContents, - mContentViewClient.getOnPageFinishedHelper(), - mContentViewClient.getOnReceivedErrorHelper(), - url); + mAwContents, + mContentViewClient.getOnPageFinishedHelper(), + mContentViewClient.getOnReceivedErrorHelper(), + url); } protected String executeJavaScriptAndWaitForResult(String script) throws Exception { @@ -176,8 +176,8 @@ public class AwSettingsTest extends AwTestBase { protected void doEnsureSettingHasValue(Boolean value) throws Throwable { loadDataSync(getData()); assertEquals( - value == ENABLED ? JS_ENABLED_STRING : JS_DISABLED_STRING, - getTitleOnUiThread()); + value == ENABLED ? JS_ENABLED_STRING : JS_DISABLED_STRING, + getTitleOnUiThread()); } private String getData() { @@ -244,8 +244,8 @@ public class AwSettingsTest extends AwTestBase { protected void doEnsureSettingHasValue(Boolean value) throws Throwable { loadDataSync(getData()); assertEquals( - value == ENABLED ? PLUGINS_ENABLED_STRING : PLUGINS_DISABLED_STRING, - getTitleOnUiThread()); + value == ENABLED ? PLUGINS_ENABLED_STRING : PLUGINS_DISABLED_STRING, + getTitleOnUiThread()); } private String getData() { @@ -505,8 +505,8 @@ public class AwSettingsTest extends AwTestBase { protected void doEnsureSettingHasValue(String value) throws Throwable { loadDataSync(getData()); assertEquals( - DEFAULT_UA.equals(value) ? mDefaultUa : value, - getTitleOnUiThread()); + DEFAULT_UA.equals(value) ? mDefaultUa : value, + getTitleOnUiThread()); } private String getData() { @@ -552,8 +552,8 @@ public class AwSettingsTest extends AwTestBase { // that is why a standalone page must be used. loadUrlSync(UrlUtils.getTestFileUrl(TEST_FILE)); assertEquals( - value == ENABLED ? HAS_LOCAL_STORAGE : NO_LOCAL_STORAGE, - getTitleOnUiThread()); + value == ENABLED ? HAS_LOCAL_STORAGE : NO_LOCAL_STORAGE, + getTitleOnUiThread()); } } @@ -596,8 +596,8 @@ public class AwSettingsTest extends AwTestBase { // violation). loadUrlSync(UrlUtils.getTestFileUrl(TEST_FILE)); assertEquals( - value == ENABLED ? HAS_DATABASE : NO_DATABASE, - getTitleOnUiThread()); + value == ENABLED ? HAS_DATABASE : NO_DATABASE, + getTitleOnUiThread()); } } @@ -646,8 +646,8 @@ public class AwSettingsTest extends AwTestBase { protected void doEnsureSettingHasValue(Boolean value) throws Throwable { loadUrlSync(mIframeContainerUrl); assertEquals( - value == ENABLED ? mIframeUrl : ACCESS_DENIED_TITLE, - getTitleOnUiThread()); + value == ENABLED ? mIframeUrl : ACCESS_DENIED_TITLE, + getTitleOnUiThread()); } private final String mIframeContainerUrl; @@ -696,8 +696,8 @@ public class AwSettingsTest extends AwTestBase { protected void doEnsureSettingHasValue(Boolean value) throws Throwable { loadUrlSync(mIframeContainerUrl); assertEquals( - value == ENABLED ? mIframeUrl : ACCESS_DENIED_TITLE, - getTitleOnUiThread()); + value == ENABLED ? mIframeUrl : ACCESS_DENIED_TITLE, + getTitleOnUiThread()); } private final String mIframeContainerUrl; @@ -744,8 +744,8 @@ public class AwSettingsTest extends AwTestBase { protected void doEnsureSettingHasValue(Boolean value) throws Throwable { loadUrlSync(mXhrContainerUrl); assertEquals( - value == ENABLED ? ACCESS_GRANTED_TITLE : ACCESS_DENIED_TITLE, - getTitleOnUiThread()); + value == ENABLED ? ACCESS_GRANTED_TITLE : ACCESS_DENIED_TITLE, + getTitleOnUiThread()); } private final String mXhrContainerUrl; @@ -1065,12 +1065,12 @@ public class AwSettingsTest extends AwTestBase { // Ensure that actual vs. initial font size ratio is similar to actual vs. initial // text zoom values ratio. final float ratiosDelta = Math.abs( - (actualFontSize / mInitialActualFontSize) - - (value / (float) INITIAL_TEXT_ZOOM)); + (actualFontSize / mInitialActualFontSize) - + (value / (float) INITIAL_TEXT_ZOOM)); assertTrue( - "|(" + actualFontSize + " / " + mInitialActualFontSize + ") - (" + - value + " / " + INITIAL_TEXT_ZOOM + ")| = " + ratiosDelta, - ratiosDelta <= 0.2f); + "|(" + actualFontSize + " / " + mInitialActualFontSize + ") - (" + + value + " / " + INITIAL_TEXT_ZOOM + ")| = " + ratiosDelta, + ratiosDelta <= 0.2f); } } @@ -1116,12 +1116,12 @@ public class AwSettingsTest extends AwTestBase { // Ensure that actual vs. initial font size ratio is similar to actual vs. initial // text zoom values ratio. final float ratiosDelta = Math.abs( - (actualFontSize / mInitialActualFontSize) - - (value / (float) INITIAL_TEXT_ZOOM)); + (actualFontSize / mInitialActualFontSize) - + (value / (float) INITIAL_TEXT_ZOOM)); assertTrue( - "|(" + actualFontSize + " / " + mInitialActualFontSize + ") - (" + - value + " / " + INITIAL_TEXT_ZOOM + ")| = " + ratiosDelta, - ratiosDelta <= 0.2f); + "|(" + actualFontSize + " / " + mInitialActualFontSize + ") - (" + + value + " / " + INITIAL_TEXT_ZOOM + ")| = " + ratiosDelta, + ratiosDelta <= 0.2f); } } @@ -1496,11 +1496,11 @@ public class AwSettingsTest extends AwTestBase { createAwTestContainerViewOnMainSync(contentClient); final AwContents awContents = testContainerView.getAwContents(); loadDataSync( - awContents, - contentClient.getOnPageFinishedHelper(), - testPageHtml, - "text/html", - false); + awContents, + contentClient.getOnPageFinishedHelper(), + testPageHtml, + "text/html", + false); assertEquals(jsDisabledString, getTitleOnUiThread(awContents)); } @@ -1509,8 +1509,8 @@ public class AwSettingsTest extends AwTestBase { public void testJavaScriptEnabledWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsJavaScriptTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsJavaScriptTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsJavaScriptTestHelper(views.getContainer0(), views.getClient0()), + new AwSettingsJavaScriptTestHelper(views.getContainer1(), views.getClient1())); } @SmallTest @@ -1518,8 +1518,10 @@ public class AwSettingsTest extends AwTestBase { public void testJavaScriptEnabledDynamicWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsJavaScriptDynamicTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsJavaScriptDynamicTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsJavaScriptDynamicTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsJavaScriptDynamicTestHelper( + views.getContainer1(), views.getClient1())); } @SmallTest @@ -1527,8 +1529,8 @@ public class AwSettingsTest extends AwTestBase { public void testPluginsEnabledWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsPluginsTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsPluginsTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsPluginsTestHelper(views.getContainer0(), views.getClient0()), + new AwSettingsPluginsTestHelper(views.getContainer1(), views.getClient1())); } @SmallTest @@ -1536,8 +1538,10 @@ public class AwSettingsTest extends AwTestBase { public void testStandardFontFamilyWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsStandardFontFamilyTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsStandardFontFamilyTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsStandardFontFamilyTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsStandardFontFamilyTestHelper( + views.getContainer1(), views.getClient1())); } @SmallTest @@ -1545,8 +1549,10 @@ public class AwSettingsTest extends AwTestBase { public void testDefaultFontSizeWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsDefaultFontSizeTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsDefaultFontSizeTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsDefaultFontSizeTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsDefaultFontSizeTestHelper( + views.getContainer1(), views.getClient1())); } // The test verifies that after changing the LoadsImagesAutomatically @@ -1586,10 +1592,10 @@ public class AwSettingsTest extends AwTestBase { public void testLoadsImagesAutomaticallyWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsLoadImagesAutomaticallyTestHelper( - views.getContainer0(), views.getClient0(), new ImagePageGenerator(0, true)), - new AwSettingsLoadImagesAutomaticallyTestHelper( - views.getContainer1(), views.getClient1(), new ImagePageGenerator(1, true))); + new AwSettingsLoadImagesAutomaticallyTestHelper( + views.getContainer0(), views.getClient0(), new ImagePageGenerator(0, true)), + new AwSettingsLoadImagesAutomaticallyTestHelper( + views.getContainer1(), views.getClient1(), new ImagePageGenerator(1, true))); } @SmallTest @@ -1597,8 +1603,10 @@ public class AwSettingsTest extends AwTestBase { public void testDefaultTextEncodingWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsDefaultTextEncodingTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsDefaultTextEncodingTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsDefaultTextEncodingTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsDefaultTextEncodingTestHelper( + views.getContainer1(), views.getClient1())); } // The test verifies that the default user agent string follows the format @@ -1693,10 +1701,10 @@ public class AwSettingsTest extends AwTestBase { final String page2 = String.format(pageTemplate, page2Title); settings.setUserAgentString(customUserAgentString); loadDataSync( - awContents, onPageFinishedHelper, page1, "text/html", false); + awContents, onPageFinishedHelper, page1, "text/html", false); assertEquals(page1Title + customUserAgentString, getTitleOnUiThread(awContents)); loadDataSync( - awContents, onPageFinishedHelper, page2, "text/html", false); + awContents, onPageFinishedHelper, page2, "text/html", false); assertEquals(page2Title + customUserAgentString, getTitleOnUiThread(awContents)); settings.setUserAgentString(null); // Must not cause any changes until the next page loading. @@ -1713,8 +1721,8 @@ public class AwSettingsTest extends AwTestBase { public void testUserAgentStringWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsUserAgentStringTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsUserAgentStringTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsUserAgentStringTestHelper(views.getContainer0(), views.getClient0()), + new AwSettingsUserAgentStringTestHelper(views.getContainer1(), views.getClient1())); } @SmallTest @@ -1756,8 +1764,10 @@ public class AwSettingsTest extends AwTestBase { public void testDomStorageEnabledWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsDomStorageEnabledTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsDomStorageEnabledTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsDomStorageEnabledTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsDomStorageEnabledTestHelper( + views.getContainer1(), views.getClient1())); } // Ideally, these three tests below should be combined into one, or tested using @@ -1803,10 +1813,10 @@ public class AwSettingsTest extends AwTestBase { public void testUniversalAccessFromFilesWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsUniversalAccessFromFilesTestHelper(views.getContainer0(), - views.getClient0()), - new AwSettingsUniversalAccessFromFilesTestHelper(views.getContainer1(), - views.getClient1())); + new AwSettingsUniversalAccessFromFilesTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsUniversalAccessFromFilesTestHelper( + views.getContainer1(), views.getClient1())); } // This test verifies that local image resources can be loaded from file: @@ -1835,10 +1845,10 @@ public class AwSettingsTest extends AwTestBase { public void testFileAccessFromFilesIframeWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsFileAccessFromFilesIframeTestHelper( - views.getContainer0(), views.getClient0()), - new AwSettingsFileAccessFromFilesIframeTestHelper( - views.getContainer1(), views.getClient1())); + new AwSettingsFileAccessFromFilesIframeTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsFileAccessFromFilesIframeTestHelper( + views.getContainer1(), views.getClient1())); } @SmallTest @@ -1846,10 +1856,10 @@ public class AwSettingsTest extends AwTestBase { public void testFileAccessFromFilesXhrWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsFileAccessFromFilesXhrTestHelper(views.getContainer0(), - views.getClient0()), - new AwSettingsFileAccessFromFilesXhrTestHelper(views.getContainer1(), - views.getClient1())); + new AwSettingsFileAccessFromFilesXhrTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsFileAccessFromFilesXhrTestHelper( + views.getContainer1(), views.getClient1())); } @SmallTest @@ -1857,8 +1867,10 @@ public class AwSettingsTest extends AwTestBase { public void testFileUrlAccessWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsFileUrlAccessTestHelper(views.getContainer0(), views.getClient0(), 0), - new AwSettingsFileUrlAccessTestHelper(views.getContainer1(), views.getClient1(), 1)); + new AwSettingsFileUrlAccessTestHelper( + views.getContainer0(), views.getClient0(), 0), + new AwSettingsFileUrlAccessTestHelper( + views.getContainer1(), views.getClient1(), 1)); } @SmallTest @@ -1866,8 +1878,10 @@ public class AwSettingsTest extends AwTestBase { public void testContentUrlAccessWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsContentUrlAccessTestHelper(views.getContainer0(), views.getClient0(), 0), - new AwSettingsContentUrlAccessTestHelper(views.getContainer1(), views.getClient1(), 1)); + new AwSettingsContentUrlAccessTestHelper( + views.getContainer0(), views.getClient0(), 0), + new AwSettingsContentUrlAccessTestHelper( + views.getContainer1(), views.getClient1(), 1)); } @SmallTest @@ -1884,11 +1898,11 @@ public class AwSettingsTest extends AwTestBase { "</body></html>"; resetResourceRequestCountInContentProvider(target); loadDataSync( - awContents, - contentClient.getOnPageFinishedHelper(), - page, - "text/html", - false); + awContents, + contentClient.getOnPageFinishedHelper(), + page, + "text/html", + false); ensureResourceRequestCountInContentProvider(target, 0); } @@ -1897,10 +1911,10 @@ public class AwSettingsTest extends AwTestBase { public void testContentUrlFromFileWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsContentUrlAccessFromFileTestHelper( - views.getContainer0(), views.getClient0(), 0), - new AwSettingsContentUrlAccessFromFileTestHelper( - views.getContainer1(), views.getClient1(), 1)); + new AwSettingsContentUrlAccessFromFileTestHelper( + views.getContainer0(), views.getClient0(), 0), + new AwSettingsContentUrlAccessFromFileTestHelper( + views.getContainer1(), views.getClient1(), 1)); } @SmallTest @@ -2010,18 +2024,18 @@ public class AwSettingsTest extends AwTestBase { // Actual test. Blocking should trigger onerror handler. awSettings.setBlockNetworkLoads(true); loadUrlSync( - awContents, - contentClient.getOnPageFinishedHelper(), - "file:///" + fileName); + awContents, + contentClient.getOnPageFinishedHelper(), + "file:///" + fileName); assertEquals(0, webServer.getRequestCount(httpPath)); assertEquals("img_onerror_fired", getTitleOnUiThread(awContents)); // Unblock should load normally. awSettings.setBlockNetworkLoads(false); loadUrlSync( - awContents, - contentClient.getOnPageFinishedHelper(), - "file:///" + fileName); + awContents, + contentClient.getOnPageFinishedHelper(), + "file:///" + fileName); assertEquals(1, webServer.getRequestCount(httpPath)); assertEquals("img_onload_fired", getTitleOnUiThread(awContents)); } finally { @@ -2147,8 +2161,8 @@ public class AwSettingsTest extends AwTestBase { final AwSettings settings = getAwSettingsOnUiThread(awContents); settings.setAllowFileAccess(false); loadUrlSync(awContents, - contentClient.getOnPageFinishedHelper(), - "file:///android_asset/asset_file.html"); + contentClient.getOnPageFinishedHelper(), + "file:///android_asset/asset_file.html"); assertEquals(expectedTitle, getTitleOnUiThread(awContents)); } @@ -2176,8 +2190,8 @@ public class AwSettingsTest extends AwTestBase { public void testLayoutAlgorithmWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsLayoutAlgorithmTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsLayoutAlgorithmTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsLayoutAlgorithmTestHelper(views.getContainer0(), views.getClient0()), + new AwSettingsLayoutAlgorithmTestHelper(views.getContainer1(), views.getClient1())); } @SmallTest @@ -2185,8 +2199,8 @@ public class AwSettingsTest extends AwTestBase { public void testTextZoomWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsTextZoomTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsTextZoomTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsTextZoomTestHelper(views.getContainer0(), views.getClient0()), + new AwSettingsTextZoomTestHelper(views.getContainer1(), views.getClient1())); } @SmallTest @@ -2194,8 +2208,10 @@ public class AwSettingsTest extends AwTestBase { public void testTextZoomAutosizingWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsTextZoomAutosizingTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsTextZoomAutosizingTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsTextZoomAutosizingTestHelper( + views.getContainer0(), views.getClient0()), + new AwSettingsTextZoomAutosizingTestHelper( + views.getContainer1(), views.getClient1())); } @SmallTest @@ -2203,8 +2219,9 @@ public class AwSettingsTest extends AwTestBase { public void testJavaScriptPopupsWithTwoViews() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsJavaScriptPopupsTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsJavaScriptPopupsTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsJavaScriptPopupsTestHelper(views.getContainer0(), views.getClient0()), + new AwSettingsJavaScriptPopupsTestHelper( + views.getContainer1(), views.getClient1())); } @SmallTest @@ -2467,8 +2484,8 @@ public class AwSettingsTest extends AwTestBase { public void testUseWideViewportWithTwoViews() throws Throwable { ViewPair views = createViews(true); runPerViewSettingsTest( - new AwSettingsUseWideViewportTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsUseWideViewportTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsUseWideViewportTestHelper(views.getContainer0(), views.getClient0()), + new AwSettingsUseWideViewportTestHelper(views.getContainer1(), views.getClient1())); } @SmallTest @@ -2476,8 +2493,8 @@ public class AwSettingsTest extends AwTestBase { public void testUseWideViewportWithTwoViewsNoQuirks() throws Throwable { ViewPair views = createViews(); runPerViewSettingsTest( - new AwSettingsUseWideViewportTestHelper(views.getContainer0(), views.getClient0()), - new AwSettingsUseWideViewportTestHelper(views.getContainer1(), views.getClient1())); + new AwSettingsUseWideViewportTestHelper(views.getContainer0(), views.getClient0()), + new AwSettingsUseWideViewportTestHelper(views.getContainer1(), views.getClient1())); } private void useWideViewportLayoutWidthTest( @@ -2669,7 +2686,7 @@ public class AwSettingsTest extends AwTestBase { "<p style='height:" + height + "px;width:" + width + "px'>" + "testSetInitialScale</p></body></html>"; final float defaultScale = - getInstrumentation().getTargetContext().getResources().getDisplayMetrics().density; + getInstrumentation().getTargetContext().getResources().getDisplayMetrics().density; assertEquals(defaultScale, getPixelScaleOnUiThread(awContents), .01f); loadDataSync(awContents, onPageFinishedHelper, page, "text/html", false); @@ -2740,13 +2757,14 @@ public class AwSettingsTest extends AwTestBase { getInstrumentation().getTargetContext()); try { String data = "<html><head><body>" + - "<video id='video' control src='" + - webServer.getOnePixelOneFrameWebmURL() + "' /> </body></html>"; + "<video id='video' control src='" + + webServer.getOnePixelOneFrameWebmURL() + "' /> </body></html>"; loadDataAsync(awContents, data, "text/html", false); videoPosterAccessedCallbackHelper.waitForCallback(0, 1, 20, TimeUnit.SECONDS); } finally { - if (webServer.getTestWebServer() != null) + if (webServer.getTestWebServer() != null) { webServer.getTestWebServer().shutdown(); + } } } @@ -2779,7 +2797,7 @@ public class AwSettingsTest extends AwTestBase { httpServer.setResponseBase64(imageUrl, CommonResources.FAVICON_DATA_BASE64, null); final String jsHtml = "<script src=\"" + httpServer.getResponseUrl(jsUrl) + - "\"></script>"; + "\"></script>"; final String imageHtml = "<img src=\"" + httpServer.getResponseUrl(imageUrl) + "\" />"; final String secureHtml = "<body>" + imageHtml + " " + jsHtml + "</body>"; diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java index 6c32141..0f62bbd 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/ClientOnPageFinishedTest.java @@ -131,7 +131,7 @@ public class ClientOnPageFinishedTest extends AwTestBase { urlOverrideHelper.setShouldOverrideUrlLoadingReturnValue(true); TestCallbackHelperContainer.OnPageFinishedHelper onPageFinishedHelper = - mContentsClient.getOnPageFinishedHelper(); + mContentsClient.getOnPageFinishedHelper(); final int currentOnPageFinishedCallCount = onPageFinishedHelper.getCallCount(); loadUrlAsync(mAwContents, redirectUrl); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java index e58d310..4dee1cf 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/CookieManagerTest.java @@ -413,7 +413,7 @@ public class CookieManagerTest extends AwTestBase { String response = ""; List<Pair<String, String>> responseHeaders = new ArrayList<Pair<String, String>>(); responseHeaders.add( - Pair.create("Set-Cookie", key + "=" + value + "; path=" + path)); + Pair.create("Set-Cookie", key + "=" + value + "; path=" + path)); return webServer.setResponse(path, response, responseHeaders); } @@ -543,7 +543,7 @@ public class CookieManagerTest extends AwTestBase { mWebServer = webServer; mContentsClient = new TestAwContentsClient(); final AwTestContainerView containerView = - createAwTestContainerViewOnMainSync(mContentsClient); + createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = containerView.getAwContents(); mAwContents.getSettings().setJavaScriptEnabled(true); } @@ -613,7 +613,7 @@ public class CookieManagerTest extends AwTestBase { private String makeCookieScriptUrl(TestWebServer webServer, String path, String key, String value) { String response = "<html><head></head><body>" + - "<script>document.cookie = \"" + key + "=" + value + "\";</script></body></html>"; + "<script>document.cookie = \"" + key + "=" + value + "\";</script></body></html>"; return webServer.setResponse(path, response, null); } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java index e09cae4..53aa66d 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/GeolocationTest.java @@ -115,7 +115,7 @@ public class GeolocationTest extends AwTestBase { poll(new Callable<Boolean>() { @Override public Boolean call() throws Exception { - return getPositionCountFromJS() == 1; + return getPositionCountFromJS() == 1; } }); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java index b84a3ba..875d0fc 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/KeySystemTest.java @@ -28,7 +28,7 @@ public class KeySystemTest extends AwTestBase { enableJavaScriptOnUiThread(mAwContents); loadDataSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), - getKeySystemTestPage(), "text/html", false); + getKeySystemTestPage(), "text/html", false); } private String getKeySystemTestPage() { diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java index a018e67..7c9d2a8 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/LoadDataWithBaseUrlTest.java @@ -42,8 +42,8 @@ public class LoadDataWithBaseUrlTest extends AwTestBase { } protected void loadDataWithBaseUrlSync( - final String data, final String mimeType, final boolean isBase64Encoded, - final String baseUrl, final String historyUrl) throws Throwable { + final String data, final String mimeType, final boolean isBase64Encoded, + final String baseUrl, final String historyUrl) throws Throwable { loadDataWithBaseUrlSync(mAwContents, mContentsClient.getOnPageFinishedHelper(), data, mimeType, isBase64Encoded, baseUrl, historyUrl); } @@ -310,20 +310,20 @@ public class LoadDataWithBaseUrlTest extends AwTestBase { // All access to file://, including android_asset and android_res is blocked // with a data: base URL, regardless of AwSettings.getAllowFileAccess(). assertFalse(canAccessFileFromData(dataBaseUrl, - "file:///android_asset/asset_icon.png?" + token)); + "file:///android_asset/asset_icon.png?" + token)); assertFalse(canAccessFileFromData(dataBaseUrl, - "file:///android_res/raw/resource_icon.png?" + token)); + "file:///android_res/raw/resource_icon.png?" + token)); assertFalse(canAccessFileFromData(dataBaseUrl, "file://" + imagePath + "?" + token)); // WebView always has access to android_asset and android_res for non-data // base URLs and can access other file:// URLs based on the value of // AwSettings.getAllowFileAccess(). assertTrue(canAccessFileFromData(nonDataBaseUrl, - "file:///android_asset/asset_icon.png?" + token)); + "file:///android_asset/asset_icon.png?" + token)); assertTrue(canAccessFileFromData(nonDataBaseUrl, - "file:///android_res/raw/resource_icon.png?" + token)); + "file:///android_res/raw/resource_icon.png?" + token)); assertFalse(canAccessFileFromData(nonDataBaseUrl, - "file://" + imagePath + "?" + token)); + "file://" + imagePath + "?" + token)); token += "a"; mAwContents.getSettings().setAllowFileAccess(true); @@ -331,17 +331,17 @@ public class LoadDataWithBaseUrlTest extends AwTestBase { // data: base URL, but we should now be able to access the wider file system // (still restricted by OS-level permission checks) with a non-data base URL. assertFalse(canAccessFileFromData(dataBaseUrl, - "file:///android_asset/asset_icon.png?" + token)); + "file:///android_asset/asset_icon.png?" + token)); assertFalse(canAccessFileFromData(dataBaseUrl, - "file:///android_res/raw/resource_icon.png?" + token)); + "file:///android_res/raw/resource_icon.png?" + token)); assertFalse(canAccessFileFromData(dataBaseUrl, "file://" + imagePath + "?" + token)); assertTrue(canAccessFileFromData(nonDataBaseUrl, - "file:///android_asset/asset_icon.png?" + token)); + "file:///android_asset/asset_icon.png?" + token)); assertTrue(canAccessFileFromData(nonDataBaseUrl, - "file:///android_res/raw/resource_icon.png?" + token)); + "file:///android_res/raw/resource_icon.png?" + token)); assertTrue(canAccessFileFromData(nonDataBaseUrl, - "file://" + imagePath + "?" + token)); + "file://" + imagePath + "?" + token)); } finally { if (!tempImage.delete()) throw new AssertionError(); } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java index 519f63d..48c1a5a 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/LoadUrlTest.java @@ -35,14 +35,14 @@ public class LoadUrlTest extends AwTestBase { public void testDataUrl() throws Throwable { final String expectedTitle = "dataUrlTest"; final String data = - "<html><head><title>" + expectedTitle + "</title></head><body>foo</body></html>"; + "<html><head><title>" + expectedTitle + "</title></head><body>foo</body></html>"; final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); loadDataSync(awContents, contentsClient.getOnPageFinishedHelper(), data, - "text/html", false); + "text/html", false); assertEquals(expectedTitle, getTitleOnUiThread(awContents)); } @@ -51,14 +51,14 @@ public class LoadUrlTest extends AwTestBase { public void testDataUrlBase64() throws Throwable { final String expectedTitle = "dataUrlTestBase64"; final String data = "PGh0bWw+PGhlYWQ+PHRpdGxlPmRhdGFVcmxUZXN0QmFzZTY0PC90aXRsZT48" + - "L2hlYWQ+PC9odG1sPg=="; + "L2hlYWQ+PC9odG1sPg=="; final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); loadDataSync(awContents, contentsClient.getOnPageFinishedHelper(), data, - "text/html", true); + "text/html", true); assertEquals(expectedTitle, getTitleOnUiThread(awContents)); } @@ -69,13 +69,13 @@ public class LoadUrlTest extends AwTestBase { // string as it's not in the US_ASCII character set. final String expectedTitle = "You win \u00a3100!"; final String data = - "<html><head><title>" + expectedTitle + "</title></head><body>foo</body></html>"; + "<html><head><title>" + expectedTitle + "</title></head><body>foo</body></html>"; final TestAwContentsClient contentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = createAwTestContainerViewOnMainSync(contentsClient); final AwContents awContents = testContainerView.getAwContents(); loadDataSyncWithCharset(awContents, contentsClient.getOnPageFinishedHelper(), data, - "text/html", false, "UTF-8"); + "text/html", false, "UTF-8"); assertEquals(expectedTitle, getTitleOnUiThread(awContents)); } @@ -97,7 +97,7 @@ public class LoadUrlTest extends AwTestBase { } }); onPageFinishedHelper.waitForCallback(currentCallCount, 1, WAIT_TIMEOUT_MS, - TimeUnit.MILLISECONDS); + TimeUnit.MILLISECONDS); } private static List<Pair<String, String>> createHeadersList(String[] namesAndValues) { @@ -109,13 +109,13 @@ public class LoadUrlTest extends AwTestBase { private static Map<String, String> createHeadersMap(String[] namesAndValues) { Map<String, String> result = new HashMap<String, String>(); - for (int i = 0; i < namesAndValues.length; i += 2) + for (int i = 0; i < namesAndValues.length; i += 2) { result.put(namesAndValues[i], namesAndValues[i + 1]); + } return result; } - private void validateRequestHeaders(String[] refNamesAndValues, - HttpRequest request) { + private void validateRequestHeaders(String[] refNamesAndValues, HttpRequest request) { for (int i = 0; i < refNamesAndValues.length; i += 2) { Header[] matchingHeaders = request.getHeaders(refNamesAndValues[i]); assertEquals(1, matchingHeaders.length); @@ -126,8 +126,7 @@ public class LoadUrlTest extends AwTestBase { } } - private void validateNoRequestHeaders(String[] refNamesAndValues, - HttpRequest request) { + private void validateNoRequestHeaders(String[] refNamesAndValues, HttpRequest request) { for (int i = 0; i < refNamesAndValues.length; i += 2) { Header[] matchingHeaders = request.getHeaders(refNamesAndValues[i]); assertEquals(0, matchingHeaders.length); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java index ebf9298..edc329d 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/NavigationHistoryTest.java @@ -44,7 +44,7 @@ public class NavigationHistoryTest extends AwTestBase { AwContents.setShouldDownloadFavicons(); mContentsClient = new TestAwContentsClient(); final AwTestContainerView testContainerView = - createAwTestContainerViewOnMainSync(mContentsClient); + createAwTestContainerViewOnMainSync(mContentsClient); mAwContents = testContainerView.getAwContents(); mWebServer = TestWebServer.start(); } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java b/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java index da69a39..f7d8437 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/TestAwContentsClient.java @@ -343,7 +343,7 @@ public class TestAwContentsClient extends NullContentsClient { public boolean shouldOverrideUrlLoading(String url) { super.shouldOverrideUrlLoading(url); boolean returnValue = - mShouldOverrideUrlLoadingHelper.getShouldOverrideUrlLoadingReturnValue(); + mShouldOverrideUrlLoadingHelper.getShouldOverrideUrlLoadingReturnValue(); mShouldOverrideUrlLoadingHelper.notifyCalled(url); return returnValue; } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/UserAgentTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/UserAgentTest.java index 0e6d363..da84d76 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/UserAgentTest.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/UserAgentTest.java @@ -33,13 +33,13 @@ public class UserAgentTest extends AwTestBase { public void testNoExtraSpaceBeforeBuildName() throws Throwable { getAwSettingsOnUiThread(mAwContents).setJavaScriptEnabled(true); loadDataSync( - mAwContents, - mContentsClient.getOnPageFinishedHelper(), - // Spaces are replaced with underscores to avoid consecutive spaces compression. - "<html>" + - "<body onload='document.title=navigator.userAgent.replace(/ /g, \"_\")'></body>" + - "</html>", - "text/html", false); + mAwContents, + mContentsClient.getOnPageFinishedHelper(), + // Spaces are replaced with underscores to avoid consecutive spaces compression. + "<html>" + + "<body onload='document.title=navigator.userAgent.replace(/ /g, \"_\")'></body>" + + "</html>", + "text/html", false); final String ua = getTitleOnUiThread(mAwContents); Matcher matcher = Pattern.compile("Android_[^;]+;_[^_]").matcher(ua); assertTrue(matcher.find()); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/AwQuotaManagerBridgeTestUtil.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/AwQuotaManagerBridgeTestUtil.java index 6d0782d..7a3b691 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/AwQuotaManagerBridgeTestUtil.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/AwQuotaManagerBridgeTestUtil.java @@ -51,13 +51,12 @@ public class AwQuotaManagerBridgeTestUtil { @Override public void run() { bridge.getOrigins( - new ValueCallback<AwQuotaManagerBridge.Origins>() { - @Override - public void onReceiveValue(AwQuotaManagerBridge.Origins origins) { - callbackHelper.notifyCalled(origins); - } - } - ); + new ValueCallback<AwQuotaManagerBridge.Origins>() { + @Override + public void onReceiveValue(AwQuotaManagerBridge.Origins origins) { + callbackHelper.notifyCalled(origins); + } + }); } }); callbackHelper.waitForCallback(callCount); diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/CommonResources.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/CommonResources.java index 2f8e900..ad36342 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/CommonResources.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/CommonResources.java @@ -58,18 +58,18 @@ public class CommonResources { // HTML code of a static simple page with a favicon. public static final String FAVICON_STATIC_HTML = - "<html><head><link rel=\"icon\" type=\"image/png\" href=\"" + FAVICON_FILENAME + "\">" + - "</head><body>Favicon example</body></html>"; + "<html><head><link rel=\"icon\" type=\"image/png\" href=\"" + FAVICON_FILENAME + "\">" + + "</head><body>Favicon example</body></html>"; // Base64 data of a favicon image resource. public static final String FAVICON_DATA_BASE64 = - "iVBORw0KGgoAAAANSUhEUgAAABAAAAAFCAYAAABM6GxJAAAABHNCSVQICAgIfAhkiAAAASJJREFU" + - "GJU9yDtLQnEYwOHfOZ40L3gZDJKgJCKaamvpGzS09wUaormh7xA0S5C0ZDTkZJsNUltkkpAUZkIX" + - "L3g9FzzH/9vm9vAgoqRUGUu20JHTXFfafUdERJSIKJnOPFUTERHpqIYclY5nb2QKFumky95OlO+W" + - "TSgATqOO5k3xr6ZxelXmDFDhdaqfLkPRWQglULaN/V5DPzl3iIb9xCI+Eskog/wdyhowLlb4vThE" + - "giF8zRsurx55beg8lMfMezZW9hqz20M/Owhwe2/yUrPI5Ds8//mRehN7JYWxvIX6eWJkbLK9laL8" + - "ZrKxFETzxTBNB5SOJjKV/mhCq+uSjGvE4hHc4QA9YGAEwnhWF1ePkCtOWFv0+PiasL8bR3QDr93h" + - "HyFup9LWUksHAAAAAElFTkSuQmCC"; + "iVBORw0KGgoAAAANSUhEUgAAABAAAAAFCAYAAABM6GxJAAAABHNCSVQICAgIfAhkiAAAASJJREFU" + + "GJU9yDtLQnEYwOHfOZ40L3gZDJKgJCKaamvpGzS09wUaormh7xA0S5C0ZDTkZJsNUltkkpAUZkIX" + + "L3g9FzzH/9vm9vAgoqRUGUu20JHTXFfafUdERJSIKJnOPFUTERHpqIYclY5nb2QKFumky95OlO+W" + + "TSgATqOO5k3xr6ZxelXmDFDhdaqfLkPRWQglULaN/V5DPzl3iIb9xCI+Eskog/wdyhowLlb4vThE" + + "giF8zRsurx55beg8lMfMezZW9hqz20M/Owhwe2/yUrPI5Ds8//mRehN7JYWxvIX6eWJkbLK9laL8" + + "ZrKxFETzxTBNB5SOJjKV/mhCq+uSjGvE4hHc4QA9YGAEwnhWF1ePkCtOWFv0+PiasL8bR3QDr93h" + + "HyFup9LWUksHAAAAAElFTkSuQmCC"; // Default name for an example 'about' HTML page. public static final String ABOUT_FILENAME = "about.html"; @@ -79,38 +79,38 @@ public class CommonResources { // HTML code of an 'about' example. public static final String ABOUT_HTML = - "<html>" + - " <head>" + - " <title>" + ABOUT_TITLE + "</title>" + - " </head>" + - " <body>" + - " This is the Google!" + - " </body>" + - "</html>"; + "<html>" + + " <head>" + + " <title>" + ABOUT_TITLE + "</title>" + + " </head>" + + " <body>" + + " This is the Google!" + + " </body>" + + "</html>"; public static String makeHtmlPageFrom(String headers, String body) { return "<html>" + - "<head>" + - "<style type=\"text/css\">" + - // Make the image take up all of the page so that we don't have to do - // any fancy hit target calculations when synthesizing the touch event - // to click it. - "img.big { width:100%; height:100%; background-color:blue; }" + - ".full_view { height:100%; width:100%; position:absolute; }" + - "</style>" + - headers + - "</head>" + - "<body>" + - body + - "</body>" + - "</html>"; + " <head>" + + " <style type=\"text/css\">" + + // Make the image take up all of the page so that we don't have to do + // any fancy hit target calculations when synthesizing the touch event + // to click it. + " img.big { width:100%; height:100%; background-color:blue; }" + + " .full_view { height:100%; width:100%; position:absolute; }" + + " </style>" + + headers + + " </head>" + + " <body>" + + body + + " </body>" + + "</html>"; } public static String makeHtmlPageWithSimpleLinkTo(String headers, String destination) { return makeHtmlPageFrom(headers, - "<a href=\"" + destination + "\" id=\"link\">" + - "<img class=\"big\" />" + - "</a>"); + "<a href=\"" + destination + "\" id=\"link\">" + + " <img class=\"big\" />" + + "</a>"); } public static String makeHtmlPageWithSimpleLinkTo(String destination) { @@ -120,7 +120,7 @@ public class CommonResources { public static String makeHtmlPageWithSimplePostFormTo(String destination) { return makeHtmlPageFrom("", "<form action=\"" + destination + "\" method=\"post\">" + - "<input type=\"submit\" value=\"post\" id=\"link\">" + + " <input type=\"submit\" value=\"post\" id=\"link\">" + "</form>"); } } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java index 8a89fae..9f8f3d1 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/JSUtils.java @@ -33,8 +33,8 @@ public class JSUtils { public boolean isSatisfied() { try { String linkIsNotNull = executeJavaScriptAndWaitForResult(testCase, awContents, - onEvaluateJavaScriptResultHelper, - "document.getElementById('" + linkId + "') != null"); + onEvaluateJavaScriptResultHelper, + "document.getElementById('" + linkId + "') != null"); return linkIsNotNull.equals("true"); } catch (Throwable t) { t.printStackTrace(); @@ -48,11 +48,11 @@ public class JSUtils { @Override public void run() { awContents.getWebContents().evaluateJavaScript( - "var evObj = document.createEvent('Events'); " + - "evObj.initEvent('click', true, false); " + - "document.getElementById('" + linkId + "').dispatchEvent(evObj);" + - "console.log('element with id [" + linkId + "] clicked');", - null); + "var evObj = document.createEvent('Events'); " + + "evObj.initEvent('click', true, false); " + + "document.getElementById('" + linkId + "').dispatchEvent(evObj);" + + "console.log('element with id [" + linkId + "] clicked');", + null); } }); } diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/util/VideoTestUtil.java b/android_webview/javatests/src/org/chromium/android_webview/test/util/VideoTestUtil.java index 5df2a03..529d730 100644 --- a/android_webview/javatests/src/org/chromium/android_webview/test/util/VideoTestUtil.java +++ b/android_webview/javatests/src/org/chromium/android_webview/test/util/VideoTestUtil.java @@ -20,12 +20,12 @@ public class VideoTestUtil { * @return true if the event happened, * @throws Throwable throw exception if timeout. */ - public static boolean runVideoTest(final AwTestBase testCase, final boolean requiredUserGesture, - long waitTime) throws Throwable { + public static boolean runVideoTest(final AwTestBase testCase, final boolean requiredUserGesture, + long waitTime) throws Throwable { final JavascriptEventObserver observer = new JavascriptEventObserver(); TestAwContentsClient client = new TestAwContentsClient(); final AwContents awContents = - testCase.createAwTestContainerViewOnMainSync(client).getAwContents(); + testCase.createAwTestContainerViewOnMainSync(client).getAwContents(); testCase.getInstrumentation().runOnMainSync(new Runnable() { @Override public void run() { @@ -38,14 +38,14 @@ public class VideoTestUtil { VideoTestWebServer webServer = new VideoTestWebServer(testCase.getActivity()); try { String data = "<html><head><script>" + - "addEventListener('DOMContentLoaded', function() { " + - " document.getElementById('video').addEventListener('play', function() { " + - " javaObserver.notifyJava(); " + - " }, false); " + - "}, false); " + - "</script></head><body>" + - "<video id='video' autoplay control src='" + - webServer.getOnePixelOneFrameWebmURL() + "' /> </body></html>"; + "addEventListener('DOMContentLoaded', function() { " + + " document.getElementById('video').addEventListener('play', function() { " + + " javaObserver.notifyJava(); " + + " }, false); " + + "}, false); " + + "</script></head><body>" + + "<video id='video' autoplay control src='" + + webServer.getOnePixelOneFrameWebmURL() + "' /> </body></html>"; testCase.loadDataAsync(awContents, data, "text/html", false); return observer.waitForEvent(waitTime); } finally { |