OLD | NEW |
1 diff --git a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java b/jav
a/client/src/org/openqa/selenium/chrome/ChromeOptions.java | 1 diff --git a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java b/jav
a/client/src/org/openqa/selenium/chrome/ChromeOptions.java |
2 index 322ca9f..79a7109 100644 | 2 index 423cfe9..67e0ddb 100644 |
3 --- a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java | 3 --- a/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java |
4 +++ b/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java | 4 +++ b/java/client/src/org/openqa/selenium/chrome/ChromeOptions.java |
5 @@ -71,6 +71,7 @@ | 5 @@ -71,6 +71,7 @@ |
6 public static final String CAPABILITY = "chromeOptions"; | 6 public static final String CAPABILITY = "chromeOptions"; |
7 | 7 |
8 private File binary; | 8 private String binary; |
9 + private String androidPackage; | 9 + private String androidPackage; |
10 private List<String> args = Lists.newArrayList(); | 10 private List<String> args = Lists.newArrayList(); |
11 private List<File> extensionFiles = Lists.newArrayList(); | 11 private List<File> extensionFiles = Lists.newArrayList(); |
12 private Map<String, Object> experimentalOptions = Maps.newHashMap(); | 12 private Map<String, Object> experimentalOptions = Maps.newHashMap(); |
13 @@ -87,6 +88,16 @@ public void setBinary(File path) { | 13 @@ -98,6 +99,16 @@ public void setBinary(String path) { |
14 } | 14 } |
15 | 15 |
16 /** | 16 /** |
17 + * Sets the Android package name for Chrome. The package should already exist | 17 + * Sets the Android package name for Chrome. The package should already exist |
18 + * on the Android device. | 18 + * on the Android device. |
19 + * | 19 + * |
20 + * @param package_name Name of Chrome's Android package. | 20 + * @param package_name Name of Chrome's Android package. |
21 + */ | 21 + */ |
22 + public void setAndroidPackage(String package_name) { | 22 + public void setAndroidPackage(String package_name) { |
23 + androidPackage = checkNotNull(package_name); | 23 + androidPackage = checkNotNull(package_name); |
24 + } | 24 + } |
25 + | 25 + |
26 + /** | 26 + /** |
27 * @param arguments The arguments to use when starting Chrome. | 27 * @param arguments The arguments to use when starting Chrome. |
28 * @see #addArguments(java.util.List) | 28 * @see #addArguments(java.util.List) |
29 */ | 29 */ |
30 @@ -165,6 +176,10 @@ public JSONObject toJson() throws IOException, JSONExceptio
n { | 30 @@ -176,6 +187,10 @@ public JSONObject toJson() throws IOException, JSONExceptio
n { |
31 options.put("binary", binary.getPath()); | 31 options.put("binary", binary); |
32 } | 32 } |
33 | 33 |
34 + if (androidPackage != null) { | 34 + if (androidPackage != null) { |
35 + options.put("androidPackage", androidPackage); | 35 + options.put("androidPackage", androidPackage); |
36 + } | 36 + } |
37 + | 37 + |
38 options.put("args", ImmutableList.copyOf(args)); | 38 options.put("args", ImmutableList.copyOf(args)); |
39 | 39 |
40 List<String> extensions = Lists.newArrayListWithExpectedSize( | 40 List<String> extensions = Lists.newArrayListWithExpectedSize( |
41 diff --git a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java | 41 diff --git a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java
b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java |
42 index 7b2d178..4e2c3d6 100644 | 42 index a486201..036a060 100644 |
43 --- a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java | 43 --- a/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java |
44 +++ b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java | 44 +++ b/java/client/src/org/openqa/selenium/remote/HttpCommandExecutor.java |
45 @@ -64,6 +64,7 @@ | 45 @@ -64,6 +64,7 @@ |
46 import static org.openqa.selenium.remote.DriverCommand.*; | 46 import static org.openqa.selenium.remote.DriverCommand.*; |
47 | 47 |
48 public class HttpCommandExecutor implements CommandExecutor, NeedsLocalLogs { | 48 public class HttpCommandExecutor implements CommandExecutor, NeedsLocalLogs { |
49 + private static final int SO_TIMEOUT = Integer.parseInt(System.getProperty("ht
tp.socket.timeout", "60")) * 1000; | 49 + private static final int SO_TIMEOUT = Integer.parseInt(System.getProperty("ht
tp.socket.timeout", "60")) * 1000; |
50 | 50 |
51 private static final int MAX_REDIRECTS = 10; | 51 private static final int MAX_REDIRECTS = 10; |
52 | 52 |
53 @@ -291,6 +292,11 @@ public Response execute(Command command) throws IOException
{ | 53 @@ -291,6 +292,11 @@ public Response execute(Command command) throws IOException
{ |
54 httpMethod.addHeader("Cache-Control", "no-cache"); | 54 httpMethod.addHeader("Cache-Control", "no-cache"); |
55 } | 55 } |
56 | 56 |
57 + // Set the timeout for waiting response from server side. | 57 + // Set the timeout for waiting response from server side. |
58 + HttpParams params = new BasicHttpParams(); | 58 + HttpParams params = new BasicHttpParams(); |
59 + params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, SO_TIMEOUT); | 59 + params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT, SO_TIMEOUT); |
60 + httpMethod.setParams(params); | 60 + httpMethod.setParams(params); |
61 + | 61 + |
62 log(LogType.PROFILER, new HttpProfilerLogEntry(command.getName(), true)); | 62 log(LogType.PROFILER, new HttpProfilerLogEntry(command.getName(), true)); |
63 HttpResponse response = fallBackExecute(context, httpMethod); | 63 HttpResponse response = fallBackExecute(context, httpMethod); |
64 log(LogType.PROFILER, new HttpProfilerLogEntry(command.getName(), false))
; | 64 log(LogType.PROFILER, new HttpProfilerLogEntry(command.getName(), false))
; |
65 diff --git a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java b/
java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java | 65 diff --git a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java b/
java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java |
66 index ac6efbf..7fbad26 100644 | 66 index e5beaf1..89d8971 100755 |
67 --- a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java | 67 --- a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java |
68 +++ b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java | 68 +++ b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java |
69 @@ -27,6 +27,7 @@ | 69 @@ -28,6 +28,7 @@ |
70 import org.junit.runner.RunWith; | 70 import org.junit.runner.RunWith; |
71 import org.openqa.selenium.Pages; | 71 import org.openqa.selenium.Pages; |
72 import org.openqa.selenium.WebDriver; | 72 import org.openqa.selenium.WebDriver; |
73 +import org.openqa.selenium.WebDriverException; | 73 +import org.openqa.selenium.WebDriverException; |
74 import org.openqa.selenium.environment.GlobalTestEnvironment; | 74 import org.openqa.selenium.environment.GlobalTestEnvironment; |
75 import org.openqa.selenium.environment.InProcessTestEnvironment; | 75 import org.openqa.selenium.environment.InProcessTestEnvironment; |
76 import org.openqa.selenium.environment.TestEnvironment; | 76 import org.openqa.selenium.environment.TestEnvironment; |
77 @@ -90,6 +91,16 @@ public WebDriver getWrappedDriver() { | 77 @@ -94,6 +95,16 @@ public WebDriver getWrappedDriver() { |
78 public static WebDriver actuallyCreateDriver() { | 78 public static WebDriver actuallyCreateDriver() { |
79 WebDriver driver = storedDriver.get(); | 79 WebDriver driver = storedDriver.get(); |
80 | 80 |
81 + // If the driver is left in a bad state, create a new one. | 81 + // If the driver is left in a bad state, create a new one. |
82 + // This happens on Android after any test that creates its own driver. | 82 + // This happens on Android after any test that creates its own driver. |
83 + // Since only one instance of Chrome can run on Android at a time, the | 83 + // Since only one instance of Chrome can run on Android at a time, the |
84 + // stored driver's browser is destroyed. | 84 + // stored driver's browser is destroyed. |
85 + try { | 85 + try { |
86 + if (driver != null) | 86 + if (driver != null) |
87 + driver.getCurrentUrl(); | 87 + driver.getCurrentUrl(); |
88 + } catch (WebDriverException e) { | 88 + } catch (WebDriverException e) { |
89 + driver = null; | 89 + driver = null; |
90 + } | 90 + } |
91 if (driver == null) { | 91 if (driver == null) { |
92 driver = new WebDriverBuilder().get(); | 92 driver = new WebDriverBuilder().get(); |
93 storedDriver.set(driver); | 93 storedDriver.set(driver); |
94 @@ -122,4 +133,4 @@ protected boolean isIeDriverTimedOutException(IllegalStateEx
ception e) { | 94 @@ -126,4 +137,4 @@ protected boolean isIeDriverTimedOutException(IllegalStateEx
ception e) { |
95 return e.getClass().getName().contains("TimedOutException"); | 95 return e.getClass().getName().contains("TimedOutException"); |
96 } | 96 } |
97 | 97 |
98 -} | 98 -} |
99 \ No newline at end of file | 99 \ No newline at end of file |
100 +} | 100 +} |
101 diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriv
er.java b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.
java | 101 diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriv
er.java b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.
java |
102 index e8a1c22..1629284 100644 | 102 index f8e3e02..58bd0cc 100755 |
103 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java | 103 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java |
104 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java | 104 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java |
105 @@ -73,6 +73,10 @@ private static DesiredCapabilities chromeWithCustomCapabiliti
es( | 105 @@ -76,6 +76,10 @@ private static DesiredCapabilities chromeWithCustomCapabiliti
es( |
106 if (chromePath != null) { | 106 if (chromePath != null) { |
107 options.setBinary(new File(chromePath)); | 107 options.setBinary(new File(chromePath)); |
108 } | 108 } |
109 + String androidPackage = System.getProperty("webdriver.chrome.android_packag
e"); | 109 + String androidPackage = System.getProperty("webdriver.chrome.android_packag
e"); |
110 + if (androidPackage != null) { | 110 + if (androidPackage != null) { |
111 + options.setAndroidPackage(androidPackage); | 111 + options.setAndroidPackage(androidPackage); |
112 + } | 112 + } |
113 | 113 |
114 DesiredCapabilities capabilities = DesiredCapabilities.chrome(); | 114 DesiredCapabilities capabilities = DesiredCapabilities.chrome(); |
115 capabilities.setCapability(ChromeOptions.CAPABILITY, options); | 115 capabilities.setCapability(ChromeOptions.CAPABILITY, options); |
116 diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.
java b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java | 116 diff --git a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.
java b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java |
117 index 587cea0..c14b8fd 100644 | 117 index c04d79d..8fe0370 100644 |
118 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java | 118 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java |
119 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java | 119 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestIgnorance.java |
120 @@ -93,8 +93,28 @@ public boolean isIgnored(AnnotatedElement element) { | 120 @@ -92,8 +92,28 @@ public boolean isIgnored(AnnotatedElement element) { |
121 return ignored; | 121 return ignored; |
122 } | 122 } |
123 | 123 |
124 - // JUnit 4 | 124 - // JUnit 4 |
125 public boolean isIgnored(FrameworkMethod method, Object test) { | 125 public boolean isIgnored(FrameworkMethod method, Object test) { |
126 + String name = test.getClass().getSimpleName() + "." + method.getName(); | 126 + String name = test.getClass().getSimpleName() + "." + method.getName(); |
127 + String filter = System.getProperty("filter", ".*"); | 127 + String filter = System.getProperty("filter", ".*"); |
128 + String[] patternGroups = filter.split("-"); | 128 + String[] patternGroups = filter.split("-"); |
129 + String[] positivePatterns = patternGroups[0].split(":"); | 129 + String[] positivePatterns = patternGroups[0].split(":"); |
130 + String[] negativePatterns = new String[0]; | 130 + String[] negativePatterns = new String[0]; |
131 + if (patternGroups.length > 1) | 131 + if (patternGroups.length > 1) |
132 + negativePatterns = patternGroups[1].split(":"); | 132 + negativePatterns = patternGroups[1].split(":"); |
133 + | 133 + |
134 + for (int i = 0; i < negativePatterns.length; i++) { | 134 + for (int i = 0; i < negativePatterns.length; i++) { |
135 + if (name.matches(negativePatterns[i])) | 135 + if (name.matches(negativePatterns[i])) |
136 + return true; | 136 + return true; |
137 + } | 137 + } |
138 + for (int i = 0; i < positivePatterns.length; i++) { | 138 + for (int i = 0; i < positivePatterns.length; i++) { |
139 + if (name.matches(positivePatterns[i])) | 139 + if (name.matches(positivePatterns[i])) |
140 + return false; | 140 + return false; |
141 + } | 141 + } |
142 + return true; | 142 + return true; |
143 + } | 143 + } |
144 + | 144 + |
145 + // JUnit 4 | 145 + // JUnit 4 |
146 + public boolean isIgnoredOld(FrameworkMethod method, Object test) { | 146 + public boolean isIgnoredOld(FrameworkMethod method, Object test) { |
147 boolean ignored = ignoreComparator.shouldIgnore(test.getClass().getAnnotati
on(Ignore.class)) || | 147 boolean ignored = ignoreComparator.shouldIgnore(test.getClass().getAnnotati
on(Ignore.class)) || |
148 ignoreComparator.shouldIgnore(method.getMethod().getAnnot
ation(Ignore.class)); | 148 ignoreComparator.shouldIgnore(method.getMethod().getAnnot
ation(Ignore.class)); |
149 | 149 |
150 @@ -224,4 +244,4 @@ private void addIgnoresForBrowser(Browser browser, IgnoreCom
parator comparator) | 150 @@ -220,4 +240,4 @@ private void addIgnoresForBrowser(Browser browser, IgnoreCom
parator comparator) |
151 } | 151 } |
152 } | 152 } |
153 | 153 |
154 -} | 154 -} |
155 \ No newline at end of file | 155 \ No newline at end of file |
156 +} | 156 +} |
157 diff --git a/rake-tasks/crazy_fun/mappings/java.rb b/rake-tasks/crazy_fun/mappin
gs/java.rb | 157 diff --git a/rake-tasks/crazy_fun/mappings/java.rb b/rake-tasks/crazy_fun/mappin
gs/java.rb |
158 index c41395e..7122c6c 100644 | 158 index f723db2..5876840 100644 |
159 --- a/rake-tasks/crazy_fun/mappings/java.rb | 159 --- a/rake-tasks/crazy_fun/mappings/java.rb |
160 +++ b/rake-tasks/crazy_fun/mappings/java.rb | 160 +++ b/rake-tasks/crazy_fun/mappings/java.rb |
161 @@ -34,6 +34,7 @@ class JavaMappings | 161 @@ -34,6 +34,7 @@ class JavaMappings |
162 fun.add_mapping("java_test", CrazyFunJava::RunTests.new) | 162 fun.add_mapping("java_test", CrazyFunJava::RunTests.new) |
163 fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new) | 163 fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new) |
164 fun.add_mapping("java_test", CrazyFunJava::CreateUberJar.new) | 164 fun.add_mapping("java_test", CrazyFunJava::CreateUberJar.new) |
165 + fun.add_mapping("java_test", CrazyFunJava::CreateProjectSourceJar.new) | 165 + fun.add_mapping("java_test", CrazyFunJava::CreateProjectSourceJar.new) |
166 fun.add_mapping("java_test", CrazyFunJava::CreateProjectJar.new) | 166 fun.add_mapping("java_test", CrazyFunJava::CreateProjectJar.new) |
167 end | 167 end |
168 end | 168 end |
OLD | NEW |