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

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

Issue 289303004: Allow native command line arguments to be initialized early. (Closed) Base URL: https://chromium.googlesource.com/chromium/src
Patch Set: Rebase More. Created 6 years, 4 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
« no previous file with comments | « no previous file | base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/javatests/src/org/chromium/android_webview/test/CommandLineTest.java
diff --git a/android_webview/javatests/src/org/chromium/android_webview/test/CommandLineTest.java b/android_webview/javatests/src/org/chromium/android_webview/test/CommandLineTest.java
new file mode 100644
index 0000000000000000000000000000000000000000..1a70b319155e35f87e048b960e8e1ef50443c557
--- /dev/null
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/CommandLineTest.java
@@ -0,0 +1,52 @@
+// Copyright 2012 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.android_webview.test;
+
+import android.test.suitebuilder.annotation.SmallTest;
+
+import org.chromium.android_webview.AwBrowserProcess;
+import org.chromium.base.CommandLine;
+import org.chromium.base.test.util.Feature;
+
+/**
+ * Test suite for setting by the command line.
+ */
+public class CommandLineTest extends AwTestBase {
+ @Override
+ protected boolean needsBrowserProcessStarted() {
+ return false;
+ }
+
+ @SmallTest
+ @Feature({"AndroidWebView"})
+ public void testSetupCommandLine() throws Exception {
+ // The commandline starts off in Java:
+ CommandLine cl = CommandLine.getInstance();
+ assertFalse(cl.isNativeImplementation());
+
+ // We can add a switch.
+ assertFalse(cl.hasSwitch("magic-switch"));
+ cl.appendSwitchWithValue("magic-switch", "magic");
+ assertTrue(cl.hasSwitch("magic-switch"));
+ assertEquals("magic", cl.getSwitchValue("magic-switch"));
+
+ // Setup Chrome.
+ AwBrowserProcess.loadLibrary();
+
+ // Now we should have switched to a native backed command line:
+ cl = CommandLine.getInstance();
+ assertTrue(cl.isNativeImplementation());
+
+ // Our first switch is still there.
+ assertTrue(cl.hasSwitch("magic-switch"));
+ assertEquals("magic", cl.getSwitchValue("magic-switch"));
+
+ // And we can add another one.
+ assertFalse(cl.hasSwitch("more-magic-switch"));
+ cl.appendSwitchWithValue("more-magic-switch", "more-magic");
+ assertTrue(cl.hasSwitch("more-magic-switch"));
+ assertEquals("more-magic", cl.getSwitchValue("more-magic-switch"));
+ }
+}
« no previous file with comments | « no previous file | base/android/java/src/org/chromium/base/library_loader/LibraryLoader.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698