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

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

Issue 2201783003: Add test to ensure shouldOverrideUrlLoading throws Java exception (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add testbase for separate-service tests, use this from AwSecondBrowserTest. Created 4 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
index cb4e8b096da8030cb36537f2486c02501c585455..1352c588e154d1a855993a2c42afdd01f0c51a9b 100644
--- a/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/AwTestBase.java
@@ -18,6 +18,7 @@ import org.chromium.android_webview.AwContents;
import org.chromium.android_webview.AwContentsClient;
import org.chromium.android_webview.AwSettings;
import org.chromium.android_webview.AwSwitches;
+import org.chromium.android_webview.test.AwTestBaseUtility.TestDependencyFactory;
import org.chromium.android_webview.test.util.GraphicsTestUtils;
import org.chromium.android_webview.test.util.JSUtils;
import org.chromium.base.ThreadUtils;
@@ -374,24 +375,6 @@ public class AwTestBase
return ((AnnotatedElement) method).isAnnotationPresent(clazz);
}
- /**
- * Factory class used in creation of test AwContents instances.
- *
- * Test cases can provide subclass instances to the createAwTest* methods in order to create an
- * AwContents instance with injected test dependencies.
- */
- public static class TestDependencyFactory extends AwContents.DependencyFactory {
- public AwTestContainerView createAwTestContainerView(AwTestRunnerActivity activity,
- boolean allowHardwareAcceleration) {
- return new AwTestContainerView(activity, allowHardwareAcceleration);
- }
- public AwSettings createAwSettings(Context context, boolean supportsLegacyQuirks) {
- return new AwSettings(context, false /* isAccessFromFileURLsGrantedByDefault */,
- supportsLegacyQuirks, false /* allowEmptyDocumentPersistence */,
- true /* allowGeolocationOnInsecureOrigins */);
- }
- }
-
protected TestDependencyFactory createTestDependencyFactory() {
return new TestDependencyFactory();
}
@@ -424,17 +407,9 @@ public class AwTestBase
final TestDependencyFactory testDependencyFactory = createTestDependencyFactory();
boolean allowHardwareAcceleration = isHardwareAcceleratedTest();
- final AwTestContainerView testContainerView =
- testDependencyFactory.createAwTestContainerView(getActivity(),
- allowHardwareAcceleration);
-
- AwSettings awSettings = testDependencyFactory.createAwSettings(getActivity(),
- supportsLegacyQuirks);
- testContainerView.initialize(new AwContents(mBrowserContext, testContainerView,
- testContainerView.getContext(), testContainerView.getInternalAccessDelegate(),
- testContainerView.getNativeDrawGLFunctorFactory(), awContentsClient, awSettings,
- testDependencyFactory));
- return testContainerView;
+ return AwTestBaseUtility.createDetachedAwTestContainerView(getActivity(), mBrowserContext,
+ testDependencyFactory, awContentsClient, supportsLegacyQuirks,
+ allowHardwareAcceleration);
}
protected boolean isHardwareAcceleratedTest() {

Powered by Google App Engine
This is Rietveld 408576698