Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5485)

Unified Diff: chrome/test/pyautolib/pyauto.py

Issue 7544026: Fix for flakiness in pyauto automation hook WaitForDownloadsToComplete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Re-wrote the first patch set. Created 9 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/test/pyautolib/pyauto.py
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index beef73695bf7882f7ad1a687684be6b306e7fe3e..4770ceece8f3c3301394f84f714a872d96cdd392 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -1046,30 +1046,27 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
# Sending request for a char.
self._GetResultFromJSONRequest(cmd_dict, windex=-1)
- def WaitForAllDownloadsToComplete(self, windex=0, timeout=-1):
- """Wait for all downloads to complete.
+ def WaitForAllDownloadsToComplete(self, pre_download_ids, windex=0,
Nirnimesh 2011/08/08 17:26:17 pre_download_ids should default to [] so that most
dennis_jeffrey 2011/08/08 22:29:51 Great idea.
+ timeout=-1):
+ """Wait for all pending downloads to complete.
- Note: This method does not work for dangerous downloads. Use
- WaitForGivenDownloadsToComplete (below) instead.
- """
- cmd_dict = {'command': 'WaitForAllDownloadsToComplete'}
- self._GetResultFromJSONRequest(cmd_dict, windex=windex, timeout=timeout)
-
- def WaitForDownloadToComplete(self, download_path, timeout=-1):
- """Wait for the given downloads to complete.
-
- This method works for dangerous downloads as well as regular downloads.
+ This function assumes that any downloads to wait for have already been
+ triggered and have started (it is ok if those downloads complete before this
+ function is called).
Args:
- download_path: The path to the final download. This is only necessary for
- the workaround described in the comments below and should
- be removed when downloads are re-implemented.
- timeout: The timeout to use - default is WaitUntil's default timeout.
- """
- # TODO(alyssad): Remove this wait when downloads are re-implemented in a
- # testable way.
- self.WaitUntil(lambda path: os.path.exists(path), timeout=timeout,
- args=[download_path])
+ pre_download_ids: A list of numbers representing the IDs of downloads that
+ exist *before* downloads to wait for have been
+ triggered. Use GetDownloadsInfo() to get these IDs.
+ windex: The window index, defaults to 0 (the first window).
+ timeout: The maximum amount of time (in milliseconds) to wait for
+ downloads to complete.
+ """
+ cmd_dict = {
+ 'command': 'WaitForAllDownloadsToComplete',
+ 'pre_download_ids': pre_download_ids,
+ }
+ self._GetResultFromJSONRequest(cmd_dict, windex=windex, timeout=timeout)
def PerformActionOnDownload(self, id, action, window_index=0):
"""Perform the given action on the download with the given id.
« chrome/test/functional/downloads.py ('K') | « chrome/test/pyautolib/download_info.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698