Chromium Code Reviews| Index: base/android/javatests/src/org/chromium/base/CommandLineTest.java |
| diff --git a/content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java b/base/android/javatests/src/org/chromium/base/CommandLineTest.java |
| similarity index 66% |
| copy from content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java |
| copy to base/android/javatests/src/org/chromium/base/CommandLineTest.java |
| index 96015f9129206789fc2c9e4aac007fe104676b1b..5167c9aba0c545835a8e3b95c8badce64b690314 100644 |
| --- a/content/public/android/javatests/src/org/chromium/content/browser/CommandLineTest.java |
| +++ b/base/android/javatests/src/org/chromium/base/CommandLineTest.java |
| @@ -2,18 +2,14 @@ |
| // 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; |
| +package org.chromium.base; |
| import android.test.InstrumentationTestCase; |
| import android.test.suitebuilder.annotation.MediumTest; |
| import android.test.suitebuilder.annotation.SmallTest; |
| +import org.chromium.base.CommandLine; |
| import org.chromium.base.test.util.Feature; |
| -import org.chromium.content.app.LibraryLoader; |
| -import org.chromium.content.common.CommandLine; |
| -import org.chromium.content.common.ProcessInitException; |
| -import org.chromium.content_shell_apk.ContentShellActivity; |
| -import org.chromium.content_shell_apk.ContentShellApplication; |
| public class CommandLineTest extends InstrumentationTestCase { |
| // A reference command line. Note that switch2 is [brea\d], switch3 is [and "butter"], |
| @@ -33,27 +29,13 @@ public class CommandLineTest extends InstrumentationTestCase { |
| static final String CL_ADDED_SWITCH_2 = "username"; |
| static final String CL_ADDED_VALUE_2 = "bozo"; |
| + private static boolean sInitialized = false; |
|
bulach
2013/11/19 12:18:09
nit: looks unused?
jdduke (slow)
2013/11/19 16:32:57
Done, good catch.
|
| + |
| @Override |
| public void setUp() throws Exception { |
| CommandLine.reset(); |
| } |
| - void loadJni() { |
| - assertFalse(CommandLine.getInstance().isNativeImplementation()); |
| - getInstrumentation().runOnMainSync(new Runnable() { |
| - @Override |
| - public void run() { |
| - ContentShellApplication.initializeApplicationParameters(); |
| - try { |
| - LibraryLoader.ensureInitialized(); |
| - } catch (ProcessInitException e) { |
| - throw new Error(e); |
| - } |
| - } |
| - }); |
| - assertTrue(CommandLine.getInstance().isNativeImplementation()); |
| - } |
| - |
| void checkInitSwitches() { |
| CommandLine cl = CommandLine.getInstance(); |
| assertFalse(cl.hasSwitch("init_command")); |
| @@ -95,13 +77,6 @@ public class CommandLineTest extends InstrumentationTestCase { |
| assertTrue("turbo".equals(cl.getSwitchValue("speed"))); |
| } |
| - void checkAppendedSwitchesPassedThrough() { |
| - CommandLine cl = CommandLine.getInstance(); |
| - assertTrue(cl.hasSwitch(CL_ADDED_SWITCH)); |
| - assertTrue(cl.hasSwitch(CL_ADDED_SWITCH_2)); |
| - assertTrue(CL_ADDED_VALUE_2.equals(cl.getSwitchValue(CL_ADDED_SWITCH_2))); |
| - } |
| - |
| void checkTokenizer(String[] expected, String toParse) { |
| String[] actual = CommandLine.tokenizeQuotedAruments(toParse.toCharArray()); |
| assertEquals(expected.length, actual.length); |
| @@ -118,40 +93,6 @@ public class CommandLineTest extends InstrumentationTestCase { |
| checkSettingThenGetting(); |
| } |
| - @MediumTest |
| - @Feature({"Android-AppBase"}) |
| - public void testJavaNativeTransition() { |
| - CommandLine.init(INIT_SWITCHES); |
| - checkInitSwitches(); |
| - loadJni(); |
| - checkInitSwitches(); |
| - checkSettingThenGetting(); |
| - } |
| - |
| - @MediumTest |
| - @Feature({"Android-AppBase"}) |
| - public void testJavaNativeTransitionAfterAppends() { |
| - CommandLine.init(INIT_SWITCHES); |
| - checkInitSwitches(); |
| - checkSettingThenGetting(); |
| - loadJni(); |
| - checkInitSwitches(); |
| - checkAppendedSwitchesPassedThrough(); |
| - } |
| - |
| - @MediumTest |
| - @Feature({"Android-AppBase"}) |
| - public void testNativeInitialization() { |
| - CommandLine.init(null); |
| - loadJni(); |
| - // Drop the program name for use with appendSwitchesAndArguments. |
| - String[] args = new String[INIT_SWITCHES.length - 1]; |
| - System.arraycopy(INIT_SWITCHES, 1, args, 0, args.length); |
| - CommandLine.getInstance().appendSwitchesAndArguments(args); |
| - checkInitSwitches(); |
| - checkSettingThenGetting(); |
| - } |
| - |
| @SmallTest |
| @Feature({"Android-AppBase"}) |
| public void testBufferInitialization() { |
| @@ -188,12 +129,4 @@ public class CommandLineTest extends InstrumentationTestCase { |
| "qr\\\"st",}; |
| checkTokenizer(expected, toParse); |
| } |
| - |
| - @MediumTest |
| - @Feature({"Android-AppBase"}) |
| - public void testFileInitialization() { |
| - CommandLine.initFromFile(ContentShellActivity.COMMAND_LINE_FILE); |
| - loadJni(); |
| - checkSettingThenGetting(); |
| - } |
| } |