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.WebSettings; | 17 import android.webkit.WebSettings; |
18 | 18 |
19 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; | 19 import static org.chromium.base.test.util.ScalableTimeout.scaleTimeout; |
20 | 20 |
21 import org.apache.http.Header; | 21 import org.apache.http.Header; |
22 import org.apache.http.HttpRequest; | 22 import org.apache.http.HttpRequest; |
23 import org.chromium.android_webview.AwContents; | 23 import org.chromium.android_webview.AwContents; |
| 24 import org.chromium.android_webview.AwContentsClient.ShouldInterceptRequestParam
s; |
24 import org.chromium.android_webview.AwSettings; | 25 import org.chromium.android_webview.AwSettings; |
25 import org.chromium.android_webview.AwSettings.LayoutAlgorithm; | 26 import org.chromium.android_webview.AwSettings.LayoutAlgorithm; |
26 import org.chromium.android_webview.InterceptedRequestData; | 27 import org.chromium.android_webview.AwWebResourceResponse; |
27 import org.chromium.android_webview.test.util.CommonResources; | 28 import org.chromium.android_webview.test.util.CommonResources; |
28 import org.chromium.android_webview.test.util.ImagePageGenerator; | 29 import org.chromium.android_webview.test.util.ImagePageGenerator; |
29 import org.chromium.android_webview.test.util.VideoTestUtil; | 30 import org.chromium.android_webview.test.util.VideoTestUtil; |
30 import org.chromium.android_webview.test.util.VideoTestWebServer; | 31 import org.chromium.android_webview.test.util.VideoTestWebServer; |
31 import org.chromium.base.test.util.DisabledTest; | 32 import org.chromium.base.test.util.DisabledTest; |
32 import org.chromium.base.test.util.Feature; | 33 import org.chromium.base.test.util.Feature; |
33 import org.chromium.base.test.util.TestFileUtil; | 34 import org.chromium.base.test.util.TestFileUtil; |
34 import org.chromium.base.test.util.UrlUtils; | 35 import org.chromium.base.test.util.UrlUtils; |
35 import org.chromium.content.browser.ContentViewCore; | 36 import org.chromium.content.browser.ContentViewCore; |
36 import org.chromium.content.browser.test.util.CallbackHelper; | 37 import org.chromium.content.browser.test.util.CallbackHelper; |
(...skipping 2524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2561 assertFalse(VideoTestUtil.runVideoTest(this, true, scaleTimeout(5000))); | 2562 assertFalse(VideoTestUtil.runVideoTest(this, true, scaleTimeout(5000))); |
2562 } | 2563 } |
2563 | 2564 |
2564 @SmallTest | 2565 @SmallTest |
2565 @Feature({"AndroidWebView", "Preferences"}) | 2566 @Feature({"AndroidWebView", "Preferences"}) |
2566 public void testDefaultVideoPosterURL() throws Throwable { | 2567 public void testDefaultVideoPosterURL() throws Throwable { |
2567 final CallbackHelper videoPosterAccessedCallbackHelper = new CallbackHel
per(); | 2568 final CallbackHelper videoPosterAccessedCallbackHelper = new CallbackHel
per(); |
2568 final String DEFAULT_VIDEO_POSTER_URL = "http://default_video_poster/"; | 2569 final String DEFAULT_VIDEO_POSTER_URL = "http://default_video_poster/"; |
2569 TestAwContentsClient client = new TestAwContentsClient() { | 2570 TestAwContentsClient client = new TestAwContentsClient() { |
2570 @Override | 2571 @Override |
2571 public InterceptedRequestData shouldInterceptRequest(String url) { | 2572 public AwWebResourceResponse shouldInterceptRequest( |
2572 if (url.equals(DEFAULT_VIDEO_POSTER_URL)) { | 2573 ShouldInterceptRequestParams params) { |
| 2574 if (params.url.equals(DEFAULT_VIDEO_POSTER_URL)) { |
2573 videoPosterAccessedCallbackHelper.notifyCalled(); | 2575 videoPosterAccessedCallbackHelper.notifyCalled(); |
2574 } | 2576 } |
2575 return null; | 2577 return null; |
2576 } | 2578 } |
2577 }; | 2579 }; |
2578 final AwContents awContents = createAwTestContainerViewOnMainSync(client
).getAwContents(); | 2580 final AwContents awContents = createAwTestContainerViewOnMainSync(client
).getAwContents(); |
2579 getInstrumentation().runOnMainSync(new Runnable() { | 2581 getInstrumentation().runOnMainSync(new Runnable() { |
2580 @Override | 2582 @Override |
2581 public void run() { | 2583 public void run() { |
2582 AwSettings awSettings = awContents.getSettings(); | 2584 AwSettings awSettings = awContents.getSettings(); |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2793 final AwContents awContents = webView.getAwContents(); | 2795 final AwContents awContents = webView.getAwContents(); |
2794 runTestOnUiThread(new Runnable() { | 2796 runTestOnUiThread(new Runnable() { |
2795 @Override | 2797 @Override |
2796 public void run() { | 2798 public void run() { |
2797 awContents.getContentViewCore().sendDoubleTapForTest( | 2799 awContents.getContentViewCore().sendDoubleTapForTest( |
2798 SystemClock.uptimeMillis(), x, y); | 2800 SystemClock.uptimeMillis(), x, y); |
2799 } | 2801 } |
2800 }); | 2802 }); |
2801 } | 2803 } |
2802 } | 2804 } |
OLD | NEW |