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 android.content.Context; | 7 import android.content.Context; |
8 import android.graphics.Point; | 8 import android.graphics.Point; |
9 import android.net.http.SslError; | 9 import android.net.http.SslError; |
10 import android.os.Build; | 10 import android.os.Build; |
11 import android.os.SystemClock; | 11 import android.os.SystemClock; |
12 import android.test.suitebuilder.annotation.MediumTest; | 12 import android.test.suitebuilder.annotation.MediumTest; |
13 import android.test.suitebuilder.annotation.SmallTest; | 13 import android.test.suitebuilder.annotation.SmallTest; |
14 import android.view.WindowManager; | 14 import android.view.WindowManager; |
15 import android.webkit.JavascriptInterface; | 15 import android.webkit.JavascriptInterface; |
16 import android.webkit.ValueCallback; | 16 import android.webkit.ValueCallback; |
| 17 import android.webkit.WebResourceResponse; |
17 import android.webkit.WebSettings; | 18 import android.webkit.WebSettings; |
18 import android.webkit.WebSettings.LayoutAlgorithm; | 19 import android.webkit.WebSettings.LayoutAlgorithm; |
19 | 20 |
20 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 21 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
21 | 22 |
22 import org.apache.http.Header; | 23 import org.apache.http.Header; |
23 import org.apache.http.HttpRequest; | 24 import org.apache.http.HttpRequest; |
24 import org.chromium.android_webview.AwContents; | 25 import org.chromium.android_webview.AwContents; |
25 import org.chromium.android_webview.AwSettings; | 26 import org.chromium.android_webview.AwSettings; |
26 import org.chromium.android_webview.AwWebResourceResponse; | |
27 import org.chromium.android_webview.test.util.CommonResources; | 27 import org.chromium.android_webview.test.util.CommonResources; |
28 import org.chromium.android_webview.test.util.ImagePageGenerator; | 28 import org.chromium.android_webview.test.util.ImagePageGenerator; |
29 import org.chromium.android_webview.test.util.VideoTestUtil; | 29 import org.chromium.android_webview.test.util.VideoTestUtil; |
30 import org.chromium.android_webview.test.util.VideoTestWebServer; | 30 import org.chromium.android_webview.test.util.VideoTestWebServer; |
31 import org.chromium.base.test.util.DisabledTest; | 31 import org.chromium.base.test.util.DisabledTest; |
32 import org.chromium.base.test.util.Feature; | 32 import org.chromium.base.test.util.Feature; |
33 import org.chromium.base.test.util.MinAndroidSdkLevel; | 33 import org.chromium.base.test.util.MinAndroidSdkLevel; |
34 import org.chromium.base.test.util.TestFileUtil; | 34 import org.chromium.base.test.util.TestFileUtil; |
35 import org.chromium.base.test.util.UrlUtils; | 35 import org.chromium.base.test.util.UrlUtils; |
36 import org.chromium.content.browser.test.util.CallbackHelper; | 36 import org.chromium.content.browser.test.util.CallbackHelper; |
(...skipping 2698 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2735 assertFalse(VideoTestUtil.runVideoTest(this, true, scaleTimeout(5000))); | 2735 assertFalse(VideoTestUtil.runVideoTest(this, true, scaleTimeout(5000))); |
2736 } | 2736 } |
2737 | 2737 |
2738 @SmallTest | 2738 @SmallTest |
2739 @Feature({"AndroidWebView", "Preferences"}) | 2739 @Feature({"AndroidWebView", "Preferences"}) |
2740 public void testDefaultVideoPosterURL() throws Throwable { | 2740 public void testDefaultVideoPosterURL() throws Throwable { |
2741 final CallbackHelper videoPosterAccessedCallbackHelper = new CallbackHel
per(); | 2741 final CallbackHelper videoPosterAccessedCallbackHelper = new CallbackHel
per(); |
2742 final String defaultVideoPosterUrl = "http://default_video_poster/"; | 2742 final String defaultVideoPosterUrl = "http://default_video_poster/"; |
2743 TestAwContentsClient client = new TestAwContentsClient() { | 2743 TestAwContentsClient client = new TestAwContentsClient() { |
2744 @Override | 2744 @Override |
2745 public AwWebResourceResponse shouldInterceptRequest(AwWebResourceReq
uest request) { | 2745 public WebResourceResponse shouldInterceptRequest(WebResourceRequest
Impl request) { |
2746 if (request.url.equals(defaultVideoPosterUrl)) { | 2746 if (request.getUrlString().equals(defaultVideoPosterUrl)) { |
2747 videoPosterAccessedCallbackHelper.notifyCalled(); | 2747 videoPosterAccessedCallbackHelper.notifyCalled(); |
2748 } | 2748 } |
2749 return null; | 2749 return null; |
2750 } | 2750 } |
2751 }; | 2751 }; |
2752 final AwContents awContents = createAwTestContainerViewOnMainSync(client
).getAwContents(); | 2752 final AwContents awContents = createAwTestContainerViewOnMainSync(client
).getAwContents(); |
2753 getInstrumentation().runOnMainSync(new Runnable() { | 2753 getInstrumentation().runOnMainSync(new Runnable() { |
2754 @Override | 2754 @Override |
2755 public void run() { | 2755 public void run() { |
2756 AwSettings awSettings = awContents.getSettings(); | 2756 AwSettings awSettings = awContents.getSettings(); |
(...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2975 final AwContents awContents = webView.getAwContents(); | 2975 final AwContents awContents = webView.getAwContents(); |
2976 runTestOnUiThread(new Runnable() { | 2976 runTestOnUiThread(new Runnable() { |
2977 @Override | 2977 @Override |
2978 public void run() { | 2978 public void run() { |
2979 awContents.getContentViewCore().sendDoubleTapForTest( | 2979 awContents.getContentViewCore().sendDoubleTapForTest( |
2980 SystemClock.uptimeMillis(), x, y); | 2980 SystemClock.uptimeMillis(), x, y); |
2981 } | 2981 } |
2982 }); | 2982 }); |
2983 } | 2983 } |
2984 } | 2984 } |
OLD | NEW |