Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(108)

Side by Side Diff: android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java

Issue 2963683002: Simplify CommandLine parameterizing J3 Instrumentation Tests (Closed)
Patch Set: Change host side runner Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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.app.Instrumentation; 9 import android.app.Instrumentation;
10 import android.content.Context; 10 import android.content.Context;
11 import android.os.Build; 11 import android.os.Build;
12 import android.util.AndroidRuntimeException; 12 import android.util.AndroidRuntimeException;
13 import android.util.Log; 13 import android.util.Log;
14 import android.view.ViewGroup; 14 import android.view.ViewGroup;
15 15
16 import org.chromium.android_webview.AwBrowserContext; 16 import org.chromium.android_webview.AwBrowserContext;
17 import org.chromium.android_webview.AwBrowserProcess; 17 import org.chromium.android_webview.AwBrowserProcess;
18 import org.chromium.android_webview.AwContents; 18 import org.chromium.android_webview.AwContents;
19 import org.chromium.android_webview.AwContents.DependencyFactory; 19 import org.chromium.android_webview.AwContents.DependencyFactory;
20 import org.chromium.android_webview.AwContents.InternalAccessDelegate; 20 import org.chromium.android_webview.AwContents.InternalAccessDelegate;
21 import org.chromium.android_webview.AwContents.NativeDrawGLFunctorFactory; 21 import org.chromium.android_webview.AwContents.NativeDrawGLFunctorFactory;
22 import org.chromium.android_webview.AwContentsClient; 22 import org.chromium.android_webview.AwContentsClient;
23 import org.chromium.android_webview.AwSettings; 23 import org.chromium.android_webview.AwSettings;
24 import org.chromium.android_webview.AwSwitches; 24 import org.chromium.android_webview.AwSwitches;
25 import org.chromium.android_webview.test.util.GraphicsTestUtils; 25 import org.chromium.android_webview.test.util.GraphicsTestUtils;
26 import org.chromium.android_webview.test.util.JSUtils; 26 import org.chromium.android_webview.test.util.JSUtils;
27 import org.chromium.base.ThreadUtils; 27 import org.chromium.base.ThreadUtils;
28 import org.chromium.base.test.BaseActivityInstrumentationTestCase; 28 import org.chromium.base.test.BaseActivityInstrumentationTestCase;
29 import org.chromium.base.test.util.CallbackHelper; 29 import org.chromium.base.test.util.CallbackHelper;
30 import org.chromium.base.test.util.CommandLineFlags;
31 import org.chromium.base.test.util.InMemorySharedPreferences; 30 import org.chromium.base.test.util.InMemorySharedPreferences;
32 import org.chromium.base.test.util.MinAndroidSdkLevel; 31 import org.chromium.base.test.util.MinAndroidSdkLevel;
33 import org.chromium.base.test.util.parameter.Parameter; 32 import org.chromium.base.test.util.parameter.JUnit3CommandLineParameter;
34 import org.chromium.base.test.util.parameter.ParameterizedTest;
35 import org.chromium.content.browser.test.util.Criteria; 33 import org.chromium.content.browser.test.util.Criteria;
36 import org.chromium.content.browser.test.util.CriteriaHelper; 34 import org.chromium.content.browser.test.util.CriteriaHelper;
37 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage FinishedHelper; 35 import org.chromium.content.browser.test.util.TestCallbackHelperContainer.OnPage FinishedHelper;
38 import org.chromium.content_public.browser.LoadUrlParams; 36 import org.chromium.content_public.browser.LoadUrlParams;
39 import org.chromium.net.test.util.TestWebServer; 37 import org.chromium.net.test.util.TestWebServer;
40 38
41 import java.lang.annotation.Annotation; 39 import java.lang.annotation.Annotation;
42 import java.lang.reflect.AnnotatedElement; 40 import java.lang.reflect.AnnotatedElement;
43 import java.lang.reflect.Method; 41 import java.lang.reflect.Method;
44 import java.util.Map; 42 import java.util.Map;
45 import java.util.concurrent.Callable; 43 import java.util.concurrent.Callable;
46 import java.util.concurrent.FutureTask; 44 import java.util.concurrent.FutureTask;
47 import java.util.concurrent.TimeUnit; 45 import java.util.concurrent.TimeUnit;
48 import java.util.regex.Matcher; 46 import java.util.regex.Matcher;
49 import java.util.regex.Pattern; 47 import java.util.regex.Pattern;
50 48
51 /** 49 /**
52 * A base class for android_webview tests. WebView only runs on KitKat and later , 50 * A base class for android_webview tests. WebView only runs on KitKat and later ,
53 * so make sure no one attempts to run the tests on earlier OS releases. 51 * so make sure no one attempts to run the tests on earlier OS releases.
54 * 52 *
55 * By default, all tests run both in single-process mode, and with sandboxed ren derer. 53 * By default, all tests run both in single-process mode, and with sandboxed ren derer.
56 * If a test doesn't yet work with sandboxed renderer, an entire class, or an in dividual test 54 * If a test doesn't yet work with sandboxed renderer, an entire class, or an in dividual test
57 * method can be marked for single-process testing only by adding the following annotation: 55 * method can be marked for single-process testing only by adding the following annotation:
58 * 56 *
59 * @ParameterizedTest.Set 57 * @SkipParameterization
60 */ 58 */
61 @MinAndroidSdkLevel(Build.VERSION_CODES.KITKAT) 59 @MinAndroidSdkLevel(Build.VERSION_CODES.KITKAT)
62 @ParameterizedTest.Set(tests = { 60 @JUnit3CommandLineParameter({"", AwSwitches.WEBVIEW_SANDBOXED_RENDERER})
63 @ParameterizedTest(parameters = {
64 @Parameter(
65 tag = CommandLineFlags.Parameter.PARAMETER_TAG)} ),
66 @ParameterizedTest(parameters = {
67 @Parameter(
68 tag = CommandLineFlags.Parameter.PARAMETER_TAG,
69 arguments = {
70 @Parameter.Argument(
71 name = CommandLineFlags.Parameter.ADD_AR G,
72 stringArray = {AwSwitches.WEBVIEW_SANDBO XED_RENDERER})
73 })})})
74 public class AwTestBase 61 public class AwTestBase
75 extends BaseActivityInstrumentationTestCase<AwTestRunnerActivity> { 62 extends BaseActivityInstrumentationTestCase<AwTestRunnerActivity> {
76 public static final long WAIT_TIMEOUT_MS = scaleTimeout(15000); 63 public static final long WAIT_TIMEOUT_MS = scaleTimeout(15000);
77 public static final int CHECK_INTERVAL = 100; 64 public static final int CHECK_INTERVAL = 100;
78 private static final String TAG = "AwTestBase"; 65 private static final String TAG = "AwTestBase";
79 private static final Pattern MAYBE_QUOTED_STRING = Pattern.compile("^(\"?)(. *)\\1$"); 66 private static final Pattern MAYBE_QUOTED_STRING = Pattern.compile("^(\"?)(. *)\\1$");
80 67
81 // The browser context needs to be a process-wide singleton. 68 // The browser context needs to be a process-wide singleton.
82 private AwBrowserContext mBrowserContext; 69 private AwBrowserContext mBrowserContext;
83 70
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 int titleCallCount = onReceivedTitleHelper.getCallCount(); 747 int titleCallCount = onReceivedTitleHelper.getCallCount();
761 748
762 onPageFinishedHelper.waitForCallback(finishCallCount, 1, WAIT_TIMEOUT_MS , 749 onPageFinishedHelper.waitForCallback(finishCallCount, 1, WAIT_TIMEOUT_MS ,
763 TimeUnit.MILLISECONDS); 750 TimeUnit.MILLISECONDS);
764 onReceivedTitleHelper.waitForCallback(titleCallCount, 1, WAIT_TIMEOUT_MS , 751 onReceivedTitleHelper.waitForCallback(titleCallCount, 1, WAIT_TIMEOUT_MS ,
765 TimeUnit.MILLISECONDS); 752 TimeUnit.MILLISECONDS);
766 753
767 return new PopupInfo(popupContentsClient, popupContainerView, popupConte nts); 754 return new PopupInfo(popupContentsClient, popupContainerView, popupConte nts);
768 } 755 }
769 } 756 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698