Commit 9752d65b authored by gmanikpure's avatar gmanikpure Committed by Commit bot

[Chromedriver] Reland of Add testcase for testing alert on new window.

And disable it for all desktop & android chrome until the issue is fixed.

This is a reland of crrev.com/459971.

BUG=chromedriver:833

Review-Url: https://codereview.chromium.org/1882603003
Cr-Commit-Position: refs/heads/master@{#459971}
Committed: https://chromium.googlesource.com/chromium/src/+/1512539632abf713b55f5a16fe7b709fb1f4a57d

patch from issue 1882603003 at patchset 40001 (http://crrev.com/1882603003#ps40001)

Review-Url: https://codereview.chromium.org/2779243003
Cr-Commit-Position: refs/heads/master@{#460529}
parent 06ed92ef
...@@ -67,6 +67,8 @@ _NEGATIVE_FILTER = [ ...@@ -67,6 +67,8 @@ _NEGATIVE_FILTER = [
'ChromeDriverTest.testShadowDomHover', 'ChromeDriverTest.testShadowDomHover',
'ChromeDriverTest.testMouseMoveTo', 'ChromeDriverTest.testMouseMoveTo',
'ChromeDriverTest.testHoverOverElement', 'ChromeDriverTest.testHoverOverElement',
# https://bugs.chromium.org/p/chromedriver/issues/detail?id=833
'ChromeDriverTest.testAlertOnNewWindow',
] ]
_VERSION_SPECIFIC_FILTER = {} _VERSION_SPECIFIC_FILTER = {}
...@@ -211,6 +213,7 @@ _ANDROID_NEGATIVE_FILTER['chromedriver_webview_shell'] = ( ...@@ -211,6 +213,7 @@ _ANDROID_NEGATIVE_FILTER['chromedriver_webview_shell'] = (
'testHistoryNavigationWithPageLoadTimeout', 'testHistoryNavigationWithPageLoadTimeout',
# Webview shell doesn't support Alerts. # Webview shell doesn't support Alerts.
'ChromeDriverTest.testAlert', 'ChromeDriverTest.testAlert',
'ChromeDriverTest.testAlertOnNewWindow',
'ChromeDesiredCapabilityTest.testUnexpectedAlertBehaviour', 'ChromeDesiredCapabilityTest.testUnexpectedAlertBehaviour',
'ChromeDriverTest.testAlertHandlingOnPageUnload', 'ChromeDriverTest.testAlertHandlingOnPageUnload',
] ]
...@@ -787,6 +790,18 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer): ...@@ -787,6 +790,18 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
self.assertEquals(False, self.assertEquals(False,
self._driver.ExecuteScript('return window.confirmed')) self._driver.ExecuteScript('return window.confirmed'))
def testAlertOnNewWindow(self):
self._driver.Load(self.GetHttpUrlForFile('/chromedriver/empty.html'))
old_windows = self._driver.GetWindowHandles()
self._driver.ExecuteScript("window.open('%s')" %
self.GetHttpUrlForFile('/chromedriver/alert_onload.html'))
new_window = self.WaitForNewWindow(self._driver, old_windows)
self.assertNotEqual(None, new_window)
self._driver.SwitchToWindow(new_window)
self.assertTrue(self._driver.IsAlertOpen())
self._driver.HandleAlert(False)
self.assertFalse(self._driver.IsAlertOpen())
def testShouldHandleNewWindowLoadingProperly(self): def testShouldHandleNewWindowLoadingProperly(self):
"""Tests that ChromeDriver determines loading correctly for new windows.""" """Tests that ChromeDriver determines loading correctly for new windows."""
self._http_server.SetDataForPath( self._http_server.SetDataForPath(
......
<!DOCTYPE html>
<html>
<body>
<script>alert('This is a javascript alert.');</script>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment