Commit 0bd3fb60 authored by Tatiana Buldina's avatar Tatiana Buldina Committed by Commit Bot

[ChromeDriver] Fix testWindowMinimize and remove old code

Fix a test failure in Python test case testWindowMinimize, and
clean up code related to not supported version.

Change-Id: I076cdc90cdaca322bc64530c6bb9eabe6ae9069a
Reviewed-on: https://chromium-review.googlesource.com/1171805Reviewed-by: default avatarJohn Chen <johnchen@chromium.org>
Commit-Queue: Tatiana Buldina <buldina@chromium.org>
Cr-Commit-Position: refs/heads/master@{#582400}
parent 24be1234
...@@ -1000,8 +1000,8 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer): ...@@ -1000,8 +1000,8 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
handle_prefix = "CDwindow-" handle_prefix = "CDwindow-"
handle = self._driver.GetCurrentWindowHandle() handle = self._driver.GetCurrentWindowHandle()
target = handle[len(handle_prefix):] target = handle[len(handle_prefix):]
self._driver.SetWindowPosition(100, 200)
self._driver.SetWindowSize(640, 400) self._driver.SetWindowSize(640, 400)
self._driver.SetWindowPosition(100, 200)
rect = self._driver.MinimizeWindow() rect = self._driver.MinimizeWindow()
expected_rect = {u'y': 200, u'width': 640, u'height': 400, u'x': 100} expected_rect = {u'y': 200, u'width': 640, u'height': 400, u'x': 100}
...@@ -1358,13 +1358,8 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer): ...@@ -1358,13 +1358,8 @@ class ChromeDriverTest(ChromeDriverBaseTestWithWebServer):
def testTouchScrollElement(self): def testTouchScrollElement(self):
self._driver.Load(self.GetHttpUrlForFile( self._driver.Load(self.GetHttpUrlForFile(
'/chromedriver/touch_action_tests.html')) '/chromedriver/touch_action_tests.html'))
major_version = int(self._driver.capabilities['version'].split('.')[0])
if major_version >= 61:
scroll_left = 'return document.documentElement.scrollLeft;' scroll_left = 'return document.documentElement.scrollLeft;'
scroll_top = 'return document.documentElement.scrollTop;' scroll_top = 'return document.documentElement.scrollTop;'
else:
scroll_left = 'return document.body.scrollLeft;'
scroll_top = 'return document.body.scrollTop;'
self.assertEquals(0, self._driver.ExecuteScript(scroll_left)) self.assertEquals(0, self._driver.ExecuteScript(scroll_left))
self.assertEquals(0, self._driver.ExecuteScript(scroll_top)) self.assertEquals(0, self._driver.ExecuteScript(scroll_top))
target = self._driver.FindElement('id', 'target') target = self._driver.FindElement('id', 'target')
...@@ -2010,11 +2005,6 @@ class ChromeDownloadDirTest(ChromeDriverBaseTest): ...@@ -2010,11 +2005,6 @@ class ChromeDownloadDirTest(ChromeDriverBaseTest):
original_url = driver.GetCurrentUrl() original_url = driver.GetCurrentUrl()
driver.Load(ChromeDriverTest.GetHttpUrlForFile('/abc.csv')) driver.Load(ChromeDriverTest.GetHttpUrlForFile('/abc.csv'))
self.WaitForFileToDownload(os.path.join(download_dir, 'abc.csv')) self.WaitForFileToDownload(os.path.join(download_dir, 'abc.csv'))
major_version = int(driver.capabilities['version'].split('.')[0])
if major_version > 43:
# For some reason, the URL in M43 changes from 'data:,' to '', so we
# need to avoid doing this assertion unless we're on M44+.
# TODO(samuong): Assert unconditionally once we stop supporting M43.
self.assertEqual(original_url, driver.GetCurrentUrl()) self.assertEqual(original_url, driver.GetCurrentUrl())
def testDownloadDirectoryOverridesExistingPreferences(self): def testDownloadDirectoryOverridesExistingPreferences(self):
......
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