| Index: patch.diff
|
| ===================================================================
|
| --- patch.diff (revision 209493)
|
| +++ patch.diff (working copy)
|
| @@ -1,119 +1,168 @@
|
| -Index: patch.diff
|
| -===================================================================
|
| ---- patch.diff (revision 199265)
|
| -+++ patch.diff (working copy)
|
| -@@ -1,16 +1,16 @@
|
| - diff --git a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java b/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
|
| --index 322ca9f..79a7109 100644
|
| -+index 423cfe9..67e0ddb 100644
|
| - --- a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
|
| - +++ b/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
|
| - @@ -71,6 +71,7 @@
|
| - public static final String CAPABILITY = "chromeOptions";
|
| -
|
| -- private File binary;
|
| -+ private String binary;
|
| - + private String androidPackage;
|
| - private List<String> args = Lists.newArrayList();
|
| - private List<File> extensionFiles = Lists.newArrayList();
|
| - private Map<String, Object> experimentalOptions = Maps.newHashMap();
|
| --@@ -87,6 +88,16 @@ public void setBinary(File path) {
|
| -+@@ -98,6 +99,16 @@ public void setBinary(String path) {
|
| - }
|
| -
|
| - /**
|
| -@@ -27,8 +27,8 @@
|
| - * @param arguments The arguments to use when starting Chrome.
|
| - * @see #addArguments(java.util.List)
|
| - */
|
| --@@ -165,6 +176,10 @@ public JSONObject toJson() throws IOException, JSONException {
|
| -- options.put("binary", binary.getPath());
|
| -+@@ -176,6 +187,10 @@ public JSONObject toJson() throws IOException, JSONException {
|
| -+ options.put("binary", binary);
|
| - }
|
| -
|
| - + if (androidPackage != null) {
|
| -@@ -39,7 +39,7 @@
|
| -
|
| - List<String> extensions = Lists.newArrayListWithExpectedSize(
|
| - diff --git a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
|
| --index 7b2d178..4e2c3d6 100644
|
| -+index a486201..036a060 100644
|
| - --- a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
|
| - +++ b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
|
| - @@ -64,6 +64,7 @@
|
| -@@ -63,10 +63,10 @@
|
| - HttpResponse response = fallBackExecute(context, httpMethod);
|
| - log(LogType.PROFILER, new HttpProfilerLogEntry(command.getName(), false));
|
| - diff --git a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
|
| --index ac6efbf..7fbad26 100644
|
| -+index e5beaf1..89d8971 100755
|
| - --- a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
|
| - +++ b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
|
| --@@ -27,6 +27,7 @@
|
| -+@@ -28,6 +28,7 @@
|
| - import org.junit.runner.RunWith;
|
| - import org.openqa.selenium.Pages;
|
| - import org.openqa.selenium.WebDriver;
|
| -@@ -74,7 +74,7 @@
|
| - import org.openqa.selenium.environment.GlobalTestEnvironment;
|
| - import org.openqa.selenium.environment.InProcessTestEnvironment;
|
| - import org.openqa.selenium.environment.TestEnvironment;
|
| --@@ -90,6 +91,16 @@ public WebDriver getWrappedDriver() {
|
| -+@@ -94,6 +95,16 @@ public WebDriver getWrappedDriver() {
|
| - public static WebDriver actuallyCreateDriver() {
|
| - WebDriver driver = storedDriver.get();
|
| -
|
| -@@ -91,7 +91,7 @@
|
| - if (driver == null) {
|
| - driver = new WebDriverBuilder().get();
|
| - storedDriver.set(driver);
|
| --@@ -122,4 +133,4 @@ protected boolean isIeDriverTimedOutException(IllegalStateException e) {
|
| -+@@ -126,4 +137,4 @@ protected boolean isIeDriverTimedOutException(IllegalStateException e) {
|
| - return e.getClass().getName().contains("TimedOutException");
|
| - }
|
| -
|
| -@@ -99,10 +99,10 @@
|
| - \ No newline at end of file
|
| - +}
|
| - diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
|
| --index e8a1c22..1629284 100644
|
| -+index f8e3e02..58bd0cc 100755
|
| - --- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
|
| - +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
|
| --@@ -73,6 +73,10 @@ private static DesiredCapabilities chromeWithCustomCapabilities(
|
| -+@@ -76,6 +76,10 @@ private static DesiredCapabilities chromeWithCustomCapabilities(
|
| - if (chromePath != null) {
|
| - options.setBinary(new File(chromePath));
|
| - }
|
| -@@ -114,10 +114,10 @@
|
| - DesiredCapabilities capabilities = DesiredCapabilities.chrome();
|
| - capabilities.setCapability(ChromeOptions.CAPABILITY, options);
|
| - diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
|
| --index 587cea0..c14b8fd 100644
|
| -+index c04d79d..8fe0370 100644
|
| - --- a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
|
| - +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
|
| --@@ -93,8 +93,28 @@ public boolean isIgnored(AnnotatedElement element) {
|
| -+@@ -92,8 +92,28 @@ public boolean isIgnored(AnnotatedElement element) {
|
| - return ignored;
|
| - }
|
| -
|
| -@@ -147,7 +147,7 @@
|
| - boolean ignored = ignoreComparator.shouldIgnore(test.getClass().getAnnotation(Ignore.class)) ||
|
| - ignoreComparator.shouldIgnore(method.getMethod().getAnnotation(Ignore.class));
|
| -
|
| --@@ -224,4 +244,4 @@ private void addIgnoresForBrowser(Browser browser, IgnoreComparator comparator)
|
| -+@@ -220,4 +240,4 @@ private void addIgnoresForBrowser(Browser browser, IgnoreComparator comparator)
|
| - }
|
| - }
|
| -
|
| -@@ -155,7 +155,7 @@
|
| - \ No newline at end of file
|
| - +}
|
| - diff --git a/rake-tasks/crazy_fun/mappings/java.rb b/rake-tasks/crazy_fun/mappings/java.rb
|
| --index c41395e..7122c6c 100644
|
| -+index f723db2..5876840 100644
|
| - --- a/rake-tasks/crazy_fun/mappings/java.rb
|
| - +++ b/rake-tasks/crazy_fun/mappings/java.rb
|
| - @@ -34,6 +34,7 @@ class JavaMappings
|
| +diff --git a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java b/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
|
| +index 423cfe9..67e0ddb 100644
|
| +--- a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
|
| ++++ b/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java
|
| +@@ -71,6 +71,7 @@
|
| + public static final String CAPABILITY = "chromeOptions";
|
| +
|
| + private String binary;
|
| ++ private String androidPackage;
|
| + private List<String> args = Lists.newArrayList();
|
| + private List<File> extensionFiles = Lists.newArrayList();
|
| + private Map<String, Object> experimentalOptions = Maps.newHashMap();
|
| +@@ -98,6 +99,16 @@ public void setBinary(String path) {
|
| + }
|
| +
|
| + /**
|
| ++ * 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);
|
| ++ }
|
| ++
|
| ++ /**
|
| + * @param arguments The arguments to use when starting Chrome.
|
| + * @see #addArguments(java.util.List)
|
| + */
|
| +@@ -176,6 +187,10 @@ public JSONObject toJson() throws IOException, JSONException {
|
| + options.put("binary", binary);
|
| + }
|
| +
|
| ++ if (androidPackage != null) {
|
| ++ options.put("androidPackage", androidPackage);
|
| ++ }
|
| ++
|
| + options.put("args", ImmutableList.copyOf(args));
|
| +
|
| + List<String> extensions = Lists.newArrayListWithExpectedSize(
|
| +diff --git a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
|
| +index a486201..036a060 100644
|
| +--- a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
|
| ++++ b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
|
| +@@ -64,6 +64,7 @@
|
| + import static org.openqa.selenium.remote.DriverCommand.*;
|
| +
|
| + public class HttpCommandExecutor implements CommandExecutor, NeedsLocalLogs {
|
| ++ private static final int SO_TIMEOUT = Integer.parseInt(System.getProperty("http.socket.timeout", "60")) * 1000;
|
| +
|
| + private static final int MAX_REDIRECTS = 10;
|
| +
|
| +@@ -291,6 +292,11 @@ public Response execute(Command command) throws IOException {
|
| + httpMethod.addHeader("Cache-Control", "no-cache");
|
| + }
|
| +
|
| ++ // Set the timeout for waiting response from server side.
|
| ++ HttpParams params = new BasicHttpParams();
|
| ++ params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, SO_TIMEOUT);
|
| ++ httpMethod.setParams(params);
|
| ++
|
| + log(LogType.PROFILER, new HttpProfilerLogEntry(command.getName(), true));
|
| + HttpResponse response = fallBackExecute(context, httpMethod);
|
| + log(LogType.PROFILER, new HttpProfilerLogEntry(command.getName(), false));
|
| +diff --git a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
|
| +index e5beaf1..89d8971 100755
|
| +--- a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
|
| ++++ b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
|
| +@@ -28,6 +28,7 @@
|
| + import org.junit.runner.RunWith;
|
| + import org.openqa.selenium.Pages;
|
| + import org.openqa.selenium.WebDriver;
|
| ++import org.openqa.selenium.WebDriverException;
|
| + import org.openqa.selenium.environment.GlobalTestEnvironment;
|
| + import org.openqa.selenium.environment.InProcessTestEnvironment;
|
| + import org.openqa.selenium.environment.TestEnvironment;
|
| +@@ -94,6 +95,16 @@ public WebDriver getWrappedDriver() {
|
| + public static WebDriver actuallyCreateDriver() {
|
| + WebDriver driver = storedDriver.get();
|
| +
|
| ++ // If the driver is left in a bad state, create a new one.
|
| ++ // This happens on Android after any test that creates its own driver.
|
| ++ // Since only one instance of Chrome can run on Android at a time, the
|
| ++ // stored driver's browser is destroyed.
|
| ++ try {
|
| ++ if (driver != null)
|
| ++ driver.getCurrentUrl();
|
| ++ } catch (WebDriverException e) {
|
| ++ driver = null;
|
| ++ }
|
| + if (driver == null) {
|
| + driver = new WebDriverBuilder().get();
|
| + storedDriver.set(driver);
|
| +@@ -126,4 +137,4 @@ protected boolean isIeDriverTimedOutException(IllegalStateException e) {
|
| + return e.getClass().getName().contains("TimedOutException");
|
| + }
|
| +
|
| +-}
|
| +\ No newline at end of file
|
| ++}
|
| +diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
|
| +index f8e3e02..58bd0cc 100755
|
| +--- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
|
| ++++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
|
| +@@ -76,6 +76,10 @@ private static DesiredCapabilities chromeWithCustomCapabilities(
|
| + 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);
|
| +diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
|
| +index c04d79d..8fe0370 100644
|
| +--- a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
|
| ++++ b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java
|
| +@@ -92,8 +92,28 @@ public boolean isIgnored(AnnotatedElement element) {
|
| + return ignored;
|
| + }
|
| +
|
| +- // JUnit 4
|
| + public boolean isIgnored(FrameworkMethod method, Object test) {
|
| ++ String name = test.getClass().getSimpleName() + "." + method.getName();
|
| ++ String filter = System.getProperty("filter", ".*");
|
| ++ String[] patternGroups = filter.split("-");
|
| ++ String[] positivePatterns = patternGroups[0].split(":");
|
| ++ String[] negativePatterns = new String[0];
|
| ++ if (patternGroups.length > 1)
|
| ++ negativePatterns = patternGroups[1].split(":");
|
| ++
|
| ++ for (int i = 0; i < negativePatterns.length; i++) {
|
| ++ if (name.matches(negativePatterns[i]))
|
| ++ return true;
|
| ++ }
|
| ++ for (int i = 0; i < positivePatterns.length; i++) {
|
| ++ if (name.matches(positivePatterns[i]))
|
| ++ return false;
|
| ++ }
|
| ++ return true;
|
| ++ }
|
| ++
|
| ++ // JUnit 4
|
| ++ public boolean isIgnoredOld(FrameworkMethod method, Object test) {
|
| + boolean ignored = ignoreComparator.shouldIgnore(test.getClass().getAnnotation(Ignore.class)) ||
|
| + ignoreComparator.shouldIgnore(method.getMethod().getAnnotation(Ignore.class));
|
| +
|
| +@@ -220,4 +240,4 @@ private void addIgnoresForBrowser(Browser browser, IgnoreComparator comparator)
|
| + }
|
| + }
|
| +
|
| +-}
|
| +\ No newline at end of file
|
| ++}
|
| +diff --git a/rake-tasks/crazy_fun/mappings/java.rb b/rake-tasks/crazy_fun/mappings/java.rb
|
| +index f723db2..5876840 100644
|
| +--- a/rake-tasks/crazy_fun/mappings/java.rb
|
| ++++ b/rake-tasks/crazy_fun/mappings/java.rb
|
| +@@ -34,6 +34,7 @@ class JavaMappings
|
| + fun.add_mapping("java_test", CrazyFunJava::RunTests.new)
|
| + fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new)
|
| + fun.add_mapping("java_test", CrazyFunJava::CreateUberJar.new)
|
| ++ fun.add_mapping("java_test", CrazyFunJava::CreateProjectSourceJar.new)
|
| + fun.add_mapping("java_test", CrazyFunJava::CreateProjectJar.new)
|
| + end
|
| + end
|
|
|