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

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

Issue 617883003: Fix the CommandLine for the WebView (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix test. Created 6 years, 2 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 unified diff | Download patch
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 package org.chromium.android_webview.test; 5 package org.chromium.android_webview.test;
6 6
7 import android.test.suitebuilder.annotation.SmallTest; 7 import android.test.suitebuilder.annotation.SmallTest;
8 8
9 import org.chromium.android_webview.AwBrowserProcess; 9 import org.chromium.android_webview.AwBrowserProcess;
10 import org.chromium.base.CommandLine; 10 import org.chromium.base.CommandLine;
11 import org.chromium.base.library_loader.LibraryLoader;
12 import org.chromium.base.test.util.Feature; 11 import org.chromium.base.test.util.Feature;
13 12
14 /** 13 /**
15 * Test suite for setting by the command line. 14 * Test suite for setting by the command line.
16 */ 15 */
17 public class CommandLineTest extends AwTestBase { 16 public class CommandLineTest extends AwTestBase {
18 @Override 17 @Override
19 protected boolean needsBrowserProcessStarted() { 18 protected boolean needsBrowserProcessStarted() {
20 return false; 19 return false;
21 } 20 }
22 21
23 @SmallTest 22 @SmallTest
24 @Feature({"AndroidWebView"}) 23 @Feature({"AndroidWebView"})
25 public void testSetupCommandLine() throws Exception { 24 public void testSetupCommandLine() throws Exception {
26 // The commandline starts off in Java: 25 // The commandline starts off in Java:
27 CommandLine cl = CommandLine.getInstance(); 26 CommandLine cl = CommandLine.getInstance();
28 assertFalse(cl.isNativeImplementation()); 27 assertFalse(cl.isNativeImplementation());
29 28
30 // We can add a switch. 29 // We can add a switch.
31 assertFalse(cl.hasSwitch("magic-switch")); 30 assertFalse(cl.hasSwitch("magic-switch"));
32 cl.appendSwitchWithValue("magic-switch", "magic"); 31 cl.appendSwitchWithValue("magic-switch", "magic");
33 assertTrue(cl.hasSwitch("magic-switch")); 32 assertTrue(cl.hasSwitch("magic-switch"));
34 assertEquals("magic", cl.getSwitchValue("magic-switch")); 33 assertEquals("magic", cl.getSwitchValue("magic-switch"));
35 34
36 // Setup Chrome. 35 // Setup Chrome.
37 AwBrowserProcess.loadLibrary(); 36 AwBrowserProcess.loadLibrary();
38 LibraryLoader.switchCommandLineForWebView();
39 37
40 // Now we should have switched to a native backed command line: 38 // Now we should have switched to a native backed command line:
41 cl = CommandLine.getInstance(); 39 cl = CommandLine.getInstance();
42 assertTrue(cl.isNativeImplementation()); 40 assertTrue(cl.isNativeImplementation());
43 41
44 // Our first switch is still there. 42 // Our first switch is still there.
45 assertTrue(cl.hasSwitch("magic-switch")); 43 assertTrue(cl.hasSwitch("magic-switch"));
46 assertEquals("magic", cl.getSwitchValue("magic-switch")); 44 assertEquals("magic", cl.getSwitchValue("magic-switch"));
47 45
48 // And we can add another one. 46 // And we can add another one.
49 assertFalse(cl.hasSwitch("more-magic-switch")); 47 assertFalse(cl.hasSwitch("more-magic-switch"));
50 cl.appendSwitchWithValue("more-magic-switch", "more-magic"); 48 cl.appendSwitchWithValue("more-magic-switch", "more-magic");
51 assertTrue(cl.hasSwitch("more-magic-switch")); 49 assertTrue(cl.hasSwitch("more-magic-switch"));
52 assertEquals("more-magic", cl.getSwitchValue("more-magic-switch")); 50 assertEquals("more-magic", cl.getSwitchValue("more-magic-switch"));
53 } 51 }
54 } 52 }
OLDNEW
« no previous file with comments | « android_webview/java/src/org/chromium/android_webview/AwBrowserProcess.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698