Index: chrome/android/javatests/src/org/chromium/chrome/browser/ChromeTestCommandLineInitRule.java |
diff --git a/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeTestCommandLineInitRule.java b/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeTestCommandLineInitRule.java |
new file mode 100644 |
index 0000000000000000000000000000000000000000..8a2cb28affdb35d2bdb0267f4a9dd8d6ea82dff4 |
--- /dev/null |
+++ b/chrome/android/javatests/src/org/chromium/chrome/browser/ChromeTestCommandLineInitRule.java |
@@ -0,0 +1,33 @@ |
+// 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.chrome.browser; |
+ |
+import org.junit.rules.TestRule; |
+import org.junit.runner.Description; |
+import org.junit.runners.model.Statement; |
+ |
+import org.chromium.base.CommandLine; |
+import org.chromium.base.test.SetUpTestRule; |
+ |
+public class ChromeTestCommandLineInitRule |
+ implements TestRule, SetUpTestRule<ChromeTestCommandLineInitRule> { |
+ private boolean mShouldSetUp; |
+ |
+ @Override |
+ public ChromeTestCommandLineInitRule shouldSetUp(boolean runSetUp) { |
+ mShouldSetUp = runSetUp; |
+ return this; |
+ } |
+ |
+ @Override |
+ public void setUp() { |
+ CommandLine.init(null); |
+ } |
+ |
+ @Override |
+ public Statement apply(Statement base, Description description) { |
+ return new SetUpTestRule.SetUpStatement(base, this, mShouldSetUp); |
+ } |
+} |