Index: chrome/test/chromedriver/test/run_py_tests.py |
diff --git a/chrome/test/chromedriver/test/run_py_tests.py b/chrome/test/chromedriver/test/run_py_tests.py |
index a4da4b5200f1a31254d09b20a157f1f7f8cec4cf..c2ddc68e088244ed6944ef5906138676e8886f5c 100755 |
--- a/chrome/test/chromedriver/test/run_py_tests.py |
+++ b/chrome/test/chromedriver/test/run_py_tests.py |
@@ -557,6 +557,10 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer): |
alert_button.Click() |
self.assertTrue(self._driver.IsAlertOpen()) |
+ def testPageLoadStrategyIsNormalByDefault(self): |
+ self.assertEquals('normal', |
+ self._driver.capabilities['pageLoadStrategy']) |
+ |
def testClearElement(self): |
self._driver.Load(self.GetHttpUrlForFile('/chromedriver/empty.html')) |
text = self._driver.ExecuteScript( |
@@ -1732,6 +1736,35 @@ class MobileEmulationCapabilityTest(ChromeDriverBaseTest): |
self.assertIn('hasTouchScreen', driver.capabilities) |
self.assertTrue(driver.capabilities['hasTouchScreen']) |
+ def testDoesntWaitWhenPageLoadStrategyIsNone(self): |
+ class HandleRequest(object): |
+ def __init__(self): |
+ self.sent_hello = threading.Event() |
+ |
+ def slowPage(self, request): |
+ self.sent_hello.wait(2) |
+ return {}, """ |
+ <html> |
+ <body>hello</body> |
+ </html>""" |
+ |
+ handler = HandleRequest() |
+ self._http_server.SetCallbackForPath('/slow', handler.slowPage) |
+ |
+ driver = self.CreateDriver(page_load_strategy='none') |
+ self.assertEquals('none', driver.capabilities['pageLoadStrategy']) |
+ |
+ driver.Load(self._http_server.GetUrl() + '/chromedriver/empty.html') |
+ driver.Load(self._http_server.GetUrl() + '/slow') |
+ self.assertFalse('hello' in driver.GetPageSource()) |
+ handler.sent_hello.set() |
+ self.WaitForCondition(lambda: 'hello' in driver.GetPageSource()) |
+ self.assertTrue('hello' in driver.GetPageSource()) |
+ |
+ def testUnsupportedPageLoadStrategyRaisesException(self): |
+ self.assertRaises(chromedriver.UnknownError, |
+ self.CreateDriver, page_load_strategy="unsupported") |
+ |
def testNetworkConnectionDisabledByDefault(self): |
driver = self.CreateDriver() |
self.assertFalse(driver.capabilities['networkConnectionEnabled']) |