| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.android_webview.test; | 5 package org.chromium.android_webview.test; |
| 6 | 6 |
| 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 7 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
| 8 | 8 |
| 9 import android.content.Context; | 9 import android.content.Context; |
| 10 import android.graphics.Point; | 10 import android.graphics.Point; |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 import org.chromium.android_webview.test.util.VideoTestWebServer; | 31 import org.chromium.android_webview.test.util.VideoTestWebServer; |
| 32 import org.chromium.base.test.util.CallbackHelper; | 32 import org.chromium.base.test.util.CallbackHelper; |
| 33 import org.chromium.base.test.util.DisabledTest; | 33 import org.chromium.base.test.util.DisabledTest; |
| 34 import org.chromium.base.test.util.Feature; | 34 import org.chromium.base.test.util.Feature; |
| 35 import org.chromium.base.test.util.RetryOnFailure; | 35 import org.chromium.base.test.util.RetryOnFailure; |
| 36 import org.chromium.base.test.util.TestFileUtil; | 36 import org.chromium.base.test.util.TestFileUtil; |
| 37 import org.chromium.base.test.util.UrlUtils; | 37 import org.chromium.base.test.util.UrlUtils; |
| 38 import org.chromium.content.browser.test.util.DOMUtils; | 38 import org.chromium.content.browser.test.util.DOMUtils; |
| 39 import org.chromium.content.browser.test.util.HistoryUtils; | 39 import org.chromium.content.browser.test.util.HistoryUtils; |
| 40 import org.chromium.content_public.browser.WebContents; | 40 import org.chromium.content_public.browser.WebContents; |
| 41 import org.chromium.content_public.common.ContentUrlConstants; |
| 41 import org.chromium.net.test.EmbeddedTestServer; | 42 import org.chromium.net.test.EmbeddedTestServer; |
| 42 import org.chromium.net.test.util.TestWebServer; | 43 import org.chromium.net.test.util.TestWebServer; |
| 43 import org.chromium.ui.display.DisplayAndroid; | 44 import org.chromium.ui.display.DisplayAndroid; |
| 44 | 45 |
| 45 import java.io.File; | 46 import java.io.File; |
| 46 import java.util.concurrent.Callable; | 47 import java.util.concurrent.Callable; |
| 47 import java.util.concurrent.TimeUnit; | 48 import java.util.concurrent.TimeUnit; |
| 48 import java.util.regex.Matcher; | 49 import java.util.regex.Matcher; |
| 49 import java.util.regex.Pattern; | 50 import java.util.regex.Pattern; |
| 50 | 51 |
| (...skipping 2877 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2928 private void doAllowEmptyDocumentPersistenceTest(boolean allow) throws Throw
able { | 2929 private void doAllowEmptyDocumentPersistenceTest(boolean allow) throws Throw
able { |
| 2929 mOverridenFactory = new EmptyDocumentPeristenceTestDependencyFactory(all
ow); | 2930 mOverridenFactory = new EmptyDocumentPeristenceTestDependencyFactory(all
ow); |
| 2930 | 2931 |
| 2931 final TestAwContentsClient client = new TestAwContentsClient(); | 2932 final TestAwContentsClient client = new TestAwContentsClient(); |
| 2932 final AwTestContainerView mContainerView = createAwTestContainerViewOnMa
inSync(client); | 2933 final AwTestContainerView mContainerView = createAwTestContainerViewOnMa
inSync(client); |
| 2933 final AwContents awContents = mContainerView.getAwContents(); | 2934 final AwContents awContents = mContainerView.getAwContents(); |
| 2934 enableJavaScriptOnUiThread(awContents); | 2935 enableJavaScriptOnUiThread(awContents); |
| 2935 JSUtils.executeJavaScriptAndWaitForResult(this, awContents, | 2936 JSUtils.executeJavaScriptAndWaitForResult(this, awContents, |
| 2936 client.getOnEvaluateJavaScriptResultHelper(), | 2937 client.getOnEvaluateJavaScriptResultHelper(), |
| 2937 "window.emptyDocumentPersistenceTest = true;"); | 2938 "window.emptyDocumentPersistenceTest = true;"); |
| 2938 loadUrlSync(awContents, client.getOnPageFinishedHelper(), "about:blank")
; | 2939 loadUrlSync(awContents, client.getOnPageFinishedHelper(), |
| 2940 ContentUrlConstants.ABOUT_BLANK_DISPLAY_URL); |
| 2939 String result = JSUtils.executeJavaScriptAndWaitForResult(this, awConten
ts, | 2941 String result = JSUtils.executeJavaScriptAndWaitForResult(this, awConten
ts, |
| 2940 client.getOnEvaluateJavaScriptResultHelper(), | 2942 client.getOnEvaluateJavaScriptResultHelper(), |
| 2941 "window.emptyDocumentPersistenceTest ? 'set' : 'not set';"); | 2943 "window.emptyDocumentPersistenceTest ? 'set' : 'not set';"); |
| 2942 assertEquals(allow ? "\"set\"" : "\"not set\"", result); | 2944 assertEquals(allow ? "\"set\"" : "\"not set\"", result); |
| 2943 } | 2945 } |
| 2944 | 2946 |
| 2945 @SmallTest | 2947 @SmallTest |
| 2946 @Feature({"AndroidWebView", "Preferences"}) | 2948 @Feature({"AndroidWebView", "Preferences"}) |
| 2947 public void testAllowEmptyDocumentPersistence() throws Throwable { | 2949 public void testAllowEmptyDocumentPersistence() throws Throwable { |
| 2948 doAllowEmptyDocumentPersistenceTest(true); | 2950 doAllowEmptyDocumentPersistenceTest(true); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3192 final AwContents awContents = webView.getAwContents(); | 3194 final AwContents awContents = webView.getAwContents(); |
| 3193 runTestOnUiThread(new Runnable() { | 3195 runTestOnUiThread(new Runnable() { |
| 3194 @Override | 3196 @Override |
| 3195 public void run() { | 3197 public void run() { |
| 3196 awContents.getContentViewCore().sendDoubleTapForTest( | 3198 awContents.getContentViewCore().sendDoubleTapForTest( |
| 3197 SystemClock.uptimeMillis(), x, y); | 3199 SystemClock.uptimeMillis(), x, y); |
| 3198 } | 3200 } |
| 3199 }); | 3201 }); |
| 3200 } | 3202 } |
| 3201 } | 3203 } |
| OLD | NEW |