Revision: 5352
Author: [email protected]
Date: Mon Apr 15 14:18:10 2013
Log: call webdriver.quit() to clean up
https://codereview.appspot.com/8641045
If we don't call webdriver.quit(), the 'chromedriver' process never
exits, and each chrome browser test run (successful or not) will leave
four new chromedriver processes hanging around indefinitely.
R=kpreid2
http://code.google.com/p/google-caja/source/detail?r=5352
Modified:
/trunk/tests/com/google/caja/plugin/BrowserTestCase.java
/trunk/tests/com/google/caja/plugin/WebDriverHandle.java
=======================================
--- /trunk/tests/com/google/caja/plugin/BrowserTestCase.java Mon Apr 8
18:32:43 2013
+++ /trunk/tests/com/google/caja/plugin/BrowserTestCase.java Mon Apr 15
14:18:10 2013
@@ -210,7 +210,9 @@
} finally {
localServer.stop();
// It's helpful for debugging to keep failed windows open.
- if (passed || isKnownFailure() || flag(CLOSE_BROWSER)) {
+ if (!passed && !isKnownFailure() && !flag(CLOSE_BROWSER)) {
+ wdh.keepOpen();
+ } else {
wdh.closeWindow();
}
}
=======================================
--- /trunk/tests/com/google/caja/plugin/WebDriverHandle.java Wed Mar 13
12:54:56 2013
+++ /trunk/tests/com/google/caja/plugin/WebDriverHandle.java Mon Apr 15
14:18:10 2013
@@ -55,6 +55,7 @@
private static int refCount = 0;
private static String firstWindow = null;
private static int windowSeq = 1;
+ private static int keptWindows = 0;
private final static String browserType =
System.getProperty(BROWSER, "firefox");
@@ -92,6 +93,10 @@
driver.close();
driver.switchTo().window(firstWindow);
}
+
+ void keepOpen() {
+ keptWindows++;
+ }
void release() {
refCount -= 1;
@@ -102,7 +107,13 @@
driver.switchTo().window(firstWindow);
firstWindow = null;
}
- driver.close();
+ if (0 < keptWindows) {
+ // .close() quits the browser if there are no more windows, but
+ // helpers like chromedriver stay running.
+ driver.close();
+ } else {
+ driver.quit();
+ }
driver = null;
}
}
--
---
You received this message because you are subscribed to the Google Groups "Google Caja Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.