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 34e5c03274ef1675bd4f7c2bc4b9c5610a9be467..a26e3f45824ccba1dc982e81578d7de3162d2df3 100755 |
--- a/chrome/test/chromedriver/test/run_py_tests.py |
+++ b/chrome/test/chromedriver/test/run_py_tests.py |
@@ -551,6 +551,11 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer): |
alert_button.Click() |
self.assertTrue(self._driver.IsAlertOpen()) |
+ def testPageLoadCapabilityDefault(self): |
samuong
2016/07/29 23:33:47
instead of a comment, just name the function so th
evajiang
2016/08/01 16:35:47
Done.
|
+ # normal by default |
+ self.assertEquals('normal', |
+ self._driver.capabilities['pageLoadStrategy']) |
+ |
def testClearElement(self): |
self._driver.Load(self.GetHttpUrlForFile('/chromedriver/empty.html')) |
text = self._driver.ExecuteScript( |
@@ -1710,6 +1715,35 @@ class MobileEmulationCapabilityTest(ChromeDriverBaseTest): |
self.assertIn('hasTouchScreen', driver.capabilities) |
self.assertTrue(driver.capabilities['hasTouchScreen']) |
+ def testPageLoadCapabilityNone(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 testPageLoadStrategyUnsupported(self): |
+ self.assertRaises(chromedriver.UnknownError, |
+ self.CreateDriver, page_load_strategy="unsupported") |
+ |
def testNetworkConnectionDisabledByDefault(self): |
driver = self.CreateDriver() |
self.assertFalse(driver.capabilities['networkConnectionEnabled']) |