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

Unified Diff: patch.diff

Issue 12760007: [chromedriver] Move the new chromedriver java tests to use the server. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webdriver/
Patch Set: Created 7 years, 9 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 | test-standalone.jar » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: patch.diff
===================================================================
--- patch.diff (revision 187341)
+++ patch.diff (working copy)
@@ -1,144 +1,55 @@
-Index: java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverSupplier.java
+Index: java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
===================================================================
---- java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverSupplier.java (revision 18370)
-+++ java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDriverSupplier.java (working copy)
-@@ -87,7 +87,7 @@
- if (DesiredCapabilities.android().getBrowserName().equals(name)) {
- className = "org.openqa.selenium.android.AndroidDriver";
- } else if (DesiredCapabilities.chrome().getBrowserName().equals(name)) {
-- className = "org.openqa.selenium.testing.drivers.TestChromeDriver";
-+ className = "org.openqa.selenium.testing.drivers.TestNewChromeDriver";
- } else if (DesiredCapabilities.firefox().getBrowserName().equals(name)) {
- className = getFirefoxClassName();
- } else if (DesiredCapabilities.htmlUnit().getBrowserName().equals(name)) {
-Index: java/client/test/org/openqa/selenium/testing/drivers/build.desc
+--- java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java (revision 17049)
++++ java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java (working copy)
+@@ -74,6 +74,10 @@
+ if (chromePath != null) {
+ options.setBinary(new File(chromePath));
+ }
++ String androidPackage = System.getProperty("webdriver.chrome.android_package");
++ if (androidPackage != null) {
++ options.setAndroidPackage(androidPackage);
++ }
+
+ DesiredCapabilities capabilities = DesiredCapabilities.chrome();
+ capabilities.setCapability(ChromeOptions.CAPABILITY, options);
+Index: java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
===================================================================
---- java/client/test/org/openqa/selenium/testing/drivers/build.desc (revision 18370)
-+++ java/client/test/org/openqa/selenium/testing/drivers/build.desc (working copy)
-@@ -9,6 +9,7 @@
- "SauceDriver.java",
- "SynthesizedFirefoxDriver.java",
- "TestChromeDriver.java",
-+ "TestNewChromeDriver.java",
- "TestIgnorance.java",
- "TestInternetExplorerDriver.java",
- "WebDriverBuilder.java",
-Index: java/client/test/org/openqa/selenium/testing/drivers/TestNewChromeDriver.java
-===================================================================
---- java/client/test/org/openqa/selenium/testing/drivers/TestNewChromeDriver.java (revision 0)
-+++ java/client/test/org/openqa/selenium/testing/drivers/TestNewChromeDriver.java (revision 0)
-@@ -0,0 +1,56 @@
-+/*
-+Copyright 2012 Selenium committers
-+Copyright 2012 Software Freedom Conservancy
-+
-+Licensed under the Apache License, Version 2.0 (the "License");
-+you may not use this file except in compliance with the License.
-+You may obtain a copy of the License at
-+
-+ http://www.apache.org/licenses/LICENSE-2.0
-+
-+Unless required by applicable law or agreed to in writing, software
-+distributed under the License is distributed on an "AS IS" BASIS,
-+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-+See the License for the specific language governing permissions and
-+limitations under the License.
-+*/
-+
-+package org.openqa.selenium.testing.drivers;
-+
-+import org.openqa.selenium.Capabilities;
-+import org.openqa.selenium.chrome.ChromeOptions;
-+import org.openqa.selenium.chrome.NewCommandExecutor;
-+import org.openqa.selenium.remote.DesiredCapabilities;
-+import org.openqa.selenium.remote.RemoteWebDriver;
-+
-+import java.io.File;
-+
-+public class TestNewChromeDriver extends RemoteWebDriver {
-+
-+ public TestNewChromeDriver() {
-+ this(chromeWithCustomCapabilities(null));
+--- java/client/src/org/openqa/selenium/chrome/ChromeOptions.java (revision 17049)
++++ java/client/src/org/openqa/selenium/chrome/ChromeOptions.java (working copy)
+@@ -65,6 +65,7 @@
+ public static final String CAPABILITY = "chromeOptions";
+
+ private File binary;
++ private String androidPackage;
+ private List<String> args = Lists.newArrayList();
+ private List<File> extensionFiles = Lists.newArrayList();
+ private Map<String, Object> experimentalOptions = Maps.newHashMap();
+@@ -81,6 +82,16 @@
+ }
+
+ /**
++ * Sets the Android package name for Chrome. The package should already exist
++ * on the Android device.
++ *
++ * @param package_name Name of Chrome's Android package.
++ */
++ public void setAndroidPackage(String package_name) {
++ androidPackage = checkNotNull(package_name);
+ }
+
-+ public TestNewChromeDriver(Capabilities capabilities) {
-+ super(new NewCommandExecutor(), chromeWithCustomCapabilities(capabilities));
-+ }
-+
-+ private static DesiredCapabilities chromeWithCustomCapabilities(
-+ Capabilities originalCapabilities) {
-+ ChromeOptions options = new ChromeOptions();
-+ options.addArguments("disable-extensions");
-+ String chromePath = System.getProperty("webdriver.chrome.binary");
-+ if (chromePath != null) {
-+ options.setBinary(new File(chromePath));
++ /**
+ * @param arguments The arguments to use when starting Chrome.
+ * @see #addArguments(java.util.List)
+ */
+@@ -147,6 +158,10 @@
+ options.put("binary", binary.getPath());
+ }
+
++ if (androidPackage != null) {
++ options.put("android_package", androidPackage);
+ }
+
-+ DesiredCapabilities capabilities = DesiredCapabilities.chrome();
-+ capabilities.setCapability(ChromeOptions.CAPABILITY, options);
-+
-+ if (originalCapabilities != null) {
-+ capabilities.merge(originalCapabilities);
-+ }
-+
-+ return capabilities;
-+ }
-+}
-Index: java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java
-===================================================================
---- java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java (revision 0)
-+++ java/client/src/org/openqa/selenium/chrome/NewCommandExecutor.java (revision 0)
-@@ -0,0 +1,53 @@
-+/*
-+Copyright 2012 Selenium committers
-+Copyright 2012 Software Freedom Conservancy
-+
-+Licensed under the Apache License, Version 2.0 (the "License");
-+you may not use this file except in compliance with the License.
-+You may obtain a copy of the License at
-+
-+ http://www.apache.org/licenses/LICENSE-2.0
-+
-+Unless required by applicable law or agreed to in writing, software
-+distributed under the License is distributed on an "AS IS" BASIS,
-+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-+See the License for the specific language governing permissions and
-+limitations under the License.
-+*/
-+
-+package org.openqa.selenium.chrome;
-+
-+import org.openqa.selenium.remote.BeanToJsonConverter;
-+import org.openqa.selenium.remote.Command;
-+import org.openqa.selenium.remote.CommandExecutor;
-+import org.openqa.selenium.remote.JsonToBeanConverter;
-+import org.openqa.selenium.remote.Response;
-+
-+import java.io.IOException;
-+import java.util.HashMap;
-+import java.util.Map;
-+
-+/**
-+ * Executes a ChromeDriver command using the new ChromeDriver.
-+ */
-+public class NewCommandExecutor implements CommandExecutor {
-+
-+ static {
-+ System.loadLibrary("chromedriver");
-+ }
-+
-+ @Override
-+ public Response execute(Command command) throws IOException {
-+ Map<String, Object> jsonCommand = new HashMap<String, Object>();
-+ jsonCommand.put("name", command.getName());
-+ jsonCommand.put("parameters", command.getParameters());
-+ String id = "";
-+ if (command.getSessionId() != null)
-+ id = command.getSessionId().toString();
-+ jsonCommand.put("sessionId", id);
-+ String responseText = execute(new BeanToJsonConverter().convert(jsonCommand));
-+ return new JsonToBeanConverter().convert(Response.class, responseText);
-+ }
-+
-+ private static native String execute(String command);
-+}
+ options.put("args", ImmutableList.copyOf(args));
+
+ List<String> extensions = Lists.newArrayListWithExpectedSize(
« no previous file with comments | « no previous file | test-standalone.jar » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698