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

Unified Diff: chrome/test/functional/test_utils.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/functional/test_utils.py
diff --git a/chrome/test/functional/test_utils.py b/chrome/test/functional/test_utils.py
index 45ed7a187fe2d169ef44a3e991643b30b6ad740e..2dbcfee3d8121ef2bf2514070289dcaafa361d1b 100644
--- a/chrome/test/functional/test_utils.py
+++ b/chrome/test/functional/test_utils.py
@@ -21,11 +21,11 @@ import pyauto_utils
"""Commonly used functions for PyAuto tests."""
def DownloadFileFromDownloadsDataDir(test, file_name):
- """Download a file from downloads data directory, in first tab first window.
+ """Download a file from downloads data directory, in first tab, first window.
Args:
- test: derived from pyauto.PyUITest - base class for UI test cases
- file_name: name of file to download
+ test: derived from pyauto.PyUITest - base class for UI test cases.
+ file_name: name of file to download.
"""
file_url = test.GetFileURLForDataPath(os.path.join('downloads', file_name))
downloaded_pkg = os.path.join(test.GetDownloadDirectory().value(),
@@ -33,8 +33,9 @@ def DownloadFileFromDownloadsDataDir(test, file_name):
# Check if file already exists. If so then delete it.
if os.path.exists(downloaded_pkg):
RemoveDownloadedTestFile(test, file_name)
+ pre_download_ids = [x['id'] for x in test.GetDownloadsInfo().Downloads()]
test.DownloadAndWaitForStart(file_url)
- test.WaitForAllDownloadsToComplete()
+ test.WaitForAllDownloadsToComplete(pre_download_ids)
def RemoveDownloadedTestFile(test, file_name):

Powered by Google App Engine
This is Rietveld 408576698