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

Side by Side Diff: patch.diff

Issue 32343003: [chromedriver] Actually terminate the suite if failed to quit. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/third_party/webdriver/
Patch Set: Created 7 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 | 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 423cfe9..67e0ddb 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 String 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();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 e5beaf1..5c99be1 100755 66 index e5beaf1..5cb9047 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 @@ -28,6 +28,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 @@ -94,6 +95,18 @@ public WebDriver getWrappedDriver() { 77 @@ -86,7 +87,7 @@ protected void finished(Description description) {
78 logger.info("<<< Finished " + description);
79 }
80 };
81 -
82 +
83 public WebDriver getWrappedDriver() {
84 return storedDriver.get();
85 }
86 @@ -94,6 +95,22 @@ public WebDriver getWrappedDriver() {
78 public static WebDriver actuallyCreateDriver() { 87 public static WebDriver actuallyCreateDriver() {
79 WebDriver driver = storedDriver.get(); 88 WebDriver driver = storedDriver.get();
80 89
81 + // If the driver is left in a bad state, create a new one. 90 + // 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. 91 + // 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 92 + // Since only one instance of Chrome can run on Android at a time, the
84 + // stored driver's browser is destroyed. 93 + // stored driver's browser is destroyed.
85 + try { 94 + try {
86 + if (driver != null) 95 + if (driver != null)
87 + driver.getCurrentUrl(); 96 + driver.getCurrentUrl();
88 + } catch (WebDriverException e) { 97 + } catch (WebDriverException e) {
89 + driver.quit(); 98 + try {
99 + driver.quit();
100 + } catch (RuntimeException ignored) {
101 + System.exit(1);
102 + }
90 + driver = null; 103 + driver = null;
91 + } 104 + }
92 + 105 +
93 if (driver == null) { 106 if (driver == null) {
94 driver = new WebDriverBuilder().get(); 107 driver = new WebDriverBuilder().get();
95 storedDriver.set(driver); 108 storedDriver.set(driver);
96 @@ -107,17 +120,11 @@ public static void removeDriver() { 109 @@ -107,7 +124,6 @@ public static void removeDriver() {
97 } 110 }
98 111
99 WebDriver current = storedDriver.get(); 112 WebDriver current = storedDriver.get();
100 - 113 -
101 if (current == null) { 114 if (current == null) {
102 return; 115 return;
103 } 116 }
104 117 @@ -115,9 +131,8 @@ public static void removeDriver() {
105 - try { 118 try {
106 - current.quit(); 119 current.quit();
107 - } catch (RuntimeException ignored) { 120 } catch (RuntimeException ignored) {
108 - // fall through 121 - // fall through
109 - } 122 + System.exit(1);
123 }
110 - 124 -
111 + current.quit();
112 storedDriver.remove(); 125 storedDriver.remove();
113 } 126 }
114 127
115 @@ -126,4 +133,4 @@ protected boolean isIeDriverTimedOutException(IllegalStateEx ception e) { 128 @@ -126,4 +141,4 @@ protected boolean isIeDriverTimedOutException(IllegalStateEx ception e) {
116 return e.getClass().getName().contains("TimedOutException"); 129 return e.getClass().getName().contains("TimedOutException");
117 } 130 }
118 131
119 -} 132 -}
120 \ No newline at end of file 133 \ No newline at end of file
121 +} 134 +}
122 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 135 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
123 index f8e3e02..58bd0cc 100755 136 index f8e3e02..58bd0cc 100755
124 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java 137 --- a/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
125 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java 138 +++ b/java/client/test/org/openqa/selenium/testing/drivers/TestChromeDriver.java
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
180 --- a/rake-tasks/crazy_fun/mappings/java.rb 193 --- a/rake-tasks/crazy_fun/mappings/java.rb
181 +++ b/rake-tasks/crazy_fun/mappings/java.rb 194 +++ b/rake-tasks/crazy_fun/mappings/java.rb
182 @@ -34,6 +34,7 @@ class JavaMappings 195 @@ -34,6 +34,7 @@ class JavaMappings
183 fun.add_mapping("java_test", CrazyFunJava::RunTests.new) 196 fun.add_mapping("java_test", CrazyFunJava::RunTests.new)
184 fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new) 197 fun.add_mapping("java_test", CrazyFunJava::CreateSourceJar.new)
185 fun.add_mapping("java_test", CrazyFunJava::CreateUberJar.new) 198 fun.add_mapping("java_test", CrazyFunJava::CreateUberJar.new)
186 + fun.add_mapping("java_test", CrazyFunJava::CreateProjectSourceJar.new) 199 + fun.add_mapping("java_test", CrazyFunJava::CreateProjectSourceJar.new)
187 fun.add_mapping("java_test", CrazyFunJava::CreateProjectJar.new) 200 fun.add_mapping("java_test", CrazyFunJava::CreateProjectJar.new)
188 end 201 end
189 end 202 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