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

Unified Diff: content/public/test/android/javatests/src/org/chromium/content/browser/test/ContentJUnit4ClassRunner.java

Issue 2818643002: Support ChildProcessAllocatorSettings in JUnit4 tests (Closed)
Patch Set: add missing imports Created 3 years, 8 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: content/public/test/android/javatests/src/org/chromium/content/browser/test/ContentJUnit4ClassRunner.java
diff --git a/content/public/test/android/javatests/src/org/chromium/content/browser/test/ContentJUnit4ClassRunner.java b/content/public/test/android/javatests/src/org/chromium/content/browser/test/ContentJUnit4ClassRunner.java
new file mode 100644
index 0000000000000000000000000000000000000000..c6774d4a325b73af82f8b857d8130aa18577fd40
--- /dev/null
+++ b/content/public/test/android/javatests/src/org/chromium/content/browser/test/ContentJUnit4ClassRunner.java
@@ -0,0 +1,34 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+package org.chromium.content.browser.test;
+
+import org.junit.runners.model.InitializationError;
+
+import org.chromium.base.test.BaseJUnit4ClassRunner;
+import org.chromium.base.test.BaseTestResult.PreTestHook;
+
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * A custom runner for //content JUnit4 tests.
+ */
+public class ContentJUnit4ClassRunner extends BaseJUnit4ClassRunner {
+ /**
+ * Create a ContentJUnit4ClassRunner to run {@code klass} and initialize values
+ *
+ * @throws InitializationError if the test class malformed
+ */
+ public ContentJUnit4ClassRunner(final Class<?> klass) throws InitializationError {
+ super(klass, null, defaultPreTestHooks());
+ }
+
+ /**
+ * Change this static function to add default {@code PreTestHook}s.
+ */
+ private static List<PreTestHook> defaultPreTestHooks() {
+ return Arrays.asList(new PreTestHook[] {new ChildProcessAllocatorSettingsHook()});
+ }
+}

Powered by Google App Engine
This is Rietveld 408576698