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

Side by Side Diff: patch.diff

Issue 13925005: [chromedriver] Fix Android test runner by creating a new driver when needed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webdriver/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | test-nodeps-srcs.jar » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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..bb3918b 100644 2 index 322ca9f..79a7109 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 File 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();
(...skipping 12 matching lines...) Expand all
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 @@ -165,6 +176,10 @@ public JSONObject toJson() throws IOException, JSONExceptio n {
31 options.put("binary", binary.getPath()); 31 options.put("binary", binary.getPath());
32 } 32 }
33 33
34 + if (androidPackage != null) { 34 + if (androidPackage != null) {
35 + options.put("android_package", 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/test/org/openqa/selenium/testing/drivers/ReflectionBack edDriverSupplier.java b/java/client/test/org/openqa/selenium/testing/drivers/Ref lectionBackedDriverSupplier.java 41 diff --git a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java b/ java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
42 index 3cc5799..7316a41 100644 42 index ac6efbf..7fbad26 100644
43 --- a/java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDrive rSupplier.java 43 --- a/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
44 +++ b/java/client/test/org/openqa/selenium/testing/drivers/ReflectionBackedDrive rSupplier.java 44 +++ b/java/client/test/org/openqa/selenium/testing/JUnit4TestBase.java
45 @@ -29,6 +29,7 @@ 45 @@ -27,6 +27,7 @@
46 import org.junit.runner.RunWith;
47 import org.openqa.selenium.Pages;
46 import org.openqa.selenium.WebDriver; 48 import org.openqa.selenium.WebDriver;
47 import org.openqa.selenium.firefox.FirefoxDriver; 49 +import org.openqa.selenium.WebDriverException;
48 import org.openqa.selenium.firefox.FirefoxProfile; 50 import org.openqa.selenium.environment.GlobalTestEnvironment;
49 +import org.openqa.selenium.remote.Augmenter; 51 import org.openqa.selenium.environment.InProcessTestEnvironment;
50 import org.openqa.selenium.remote.DesiredCapabilities; 52 import org.openqa.selenium.environment.TestEnvironment;
51 import org.openqa.selenium.testing.InProject; 53 @@ -90,6 +91,16 @@ public WebDriver getWrappedDriver() {
54 public static WebDriver actuallyCreateDriver() {
55 WebDriver driver = storedDriver.get();
52 56
53 @@ -76,7 +77,8 @@ public WebDriver get() { 57 + // If the driver is left in a bad state, create a new one.
54 } 58 + // This happens on Android after any test that creates its own driver.
59 + // Since only one instance of Chrome can run on Android at a time, the
60 + // stored driver's browser is destroyed.
61 + try {
62 + if (driver != null)
63 + driver.getCurrentUrl();
64 + } catch (WebDriverException e) {
65 + driver = null;
66 + }
67 if (driver == null) {
68 driver = new WebDriverBuilder().get();
69 storedDriver.set(driver);
70 @@ -122,4 +133,4 @@ protected boolean isIeDriverTimedOutException(IllegalStateEx ception e) {
71 return e.getClass().getName().contains("TimedOutException");
72 }
55 73
56 //TODO: Call constructor with two Capabilities arguments for all driver c lasses 74 -}
57 - return driverClass.getConstructor(Capabilities.class).newInstance(desired CapsToUse); 75 \ No newline at end of file
58 + WebDriver d = driverClass.getConstructor(Capabilities.class).newInstance( desiredCapsToUse); 76 +}
59 + return new Augmenter().augment(d);
60 } catch (InvocationTargetException e) {
61 throw Throwables.propagate(e.getTargetException());
62 } catch (Exception e) {
63 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 77 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
64 index e8a1c22..1629284 100644 78 index e8a1c22..1629284 100644
65 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java 79 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
66 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java 80 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
67 @@ -73,6 +73,10 @@ private static DesiredCapabilities chromeWithCustomCapabiliti es( 81 @@ -73,6 +73,10 @@ private static DesiredCapabilities chromeWithCustomCapabiliti es(
68 if (chromePath != null) { 82 if (chromePath != null) {
69 options.setBinary(new File(chromePath)); 83 options.setBinary(new File(chromePath));
70 } 84 }
71 + String androidPackage = System.getProperty("webdriver.chrome.android_packag e"); 85 + String androidPackage = System.getProperty("webdriver.chrome.android_packag e");
72 + if (androidPackage != null) { 86 + if (androidPackage != null) {
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 --- a/rake-tasks/crazy_fun/mappings/java.rb 135 --- a/rake-tasks/crazy_fun/mappings/java.rb
122 +++ b/rake-tasks/crazy_fun/mappings/java.rb 136 +++ b/rake-tasks/crazy_fun/mappings/java.rb
123 @@ -34,6 +34,7 @@ class JavaMappings 137 @@ -34,6 +34,7 @@ class JavaMappings
124 fun.add_mapping("java_test", CrazyFunJava::RunTests.new) 138 fun.add_mapping("java_test", CrazyFunJava::RunTests.new)
125 fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new) 139 fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new)
126 fun.add_mapping("java_test", CrazyFunJava::CreateUberJar.new) 140 fun.add_mapping("java_test", CrazyFunJava::CreateUberJar.new)
127 + fun.add_mapping("java_test", CrazyFunJava::CreateProjectSourceJar.new) 141 + fun.add_mapping("java_test", CrazyFunJava::CreateProjectSourceJar.new)
128 fun.add_mapping("java_test", CrazyFunJava::CreateProjectJar.new) 142 fun.add_mapping("java_test", CrazyFunJava::CreateProjectJar.new)
129 end 143 end
130 end 144 end
OLDNEW
« no previous file with comments | « no previous file | test-nodeps-srcs.jar » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698