summaryrefslogtreecommitdiffstats
path: root/android_webview
diff options
context:
space:
mode:
authorhjd@chromium.org <hjd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-11 13:36:00 +0000
committerhjd@chromium.org <hjd@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-11 13:37:30 +0000
commit28eb8a28986c00f24221b0a25757f02b9a942839 (patch)
tree8a12f58a62773f87f06354f03ae3caa4b77b1e4f /android_webview
parent18953a234c906f27e6344c45f444a8a779aa18c2 (diff)
downloadchromium_src-28eb8a28986c00f24221b0a25757f02b9a942839.zip
chromium_src-28eb8a28986c00f24221b0a25757f02b9a942839.tar.gz
chromium_src-28eb8a28986c00f24221b0a25757f02b9a942839.tar.bz2
The WebView has a path (early use of the CookieManager) which
needs access to the native command line arguments before we have initialized Chromium. This cl moves the setting up of the native command line to just after the LibraryLoaded.load step rather than just before the LibraryLoaded.initialise step. We remove the ability to pass the command line to initialize (which doesn't seem to be used) and remove the command line argument from the LibraryLoaded hook. You can access the native command line arguments instead which will have been set up. BUG=331424 Review URL: https://codereview.chromium.org/289303004 Cr-Commit-Position: refs/heads/master@{#288697} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@288697 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'android_webview')
-rw-r--r--android_webview/javatests/src/org/chromium/android_webview/test/CommandLineTest.java52
1 files changed, 52 insertions, 0 deletions
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 0000000..4582f64
--- /dev/null
+++ b/android_webview/javatests/src/org/chromium/android_webview/test/CommandLineTest.java
@@ -0,0 +1,52 @@
+// Copyright 2014 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"));
+ }
+}