Index: chrome/test/functional/downloads.py |
=================================================================== |
--- chrome/test/functional/downloads.py (revision 71402) |
+++ chrome/test/functional/downloads.py (working copy) |
@@ -145,13 +145,15 @@ |
downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), |
'a_zip_file.zip') |
self._ClearLocalDownloadState(downloaded_pkg) |
+ self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
- self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) # open incognito window |
- # Downloads from incognito window do not figure in GetDownloadsInfo() |
- # since the download manager's list doesn't contain it. |
- # Using WaitUntil is the only resort. |
- self.NavigateToURL(file_url, 1, 0) |
- self.assertTrue(self.WaitUntil(lambda: os.path.exists(downloaded_pkg))) |
+ # Trigger download and wait in new incognito window. |
+ self.DownloadAndWaitForStart(file_url, 1) |
+ self.WaitForAllDownloadsToComplete(1) |
+ incognito_downloads = self.GetDownloadsInfo(1).Downloads() |
+ |
+ # Verify that download info exists in the correct profile. |
+ self.assertEqual(len(incognito_downloads), 1) |
self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg)) |
self.assertTrue(self.IsDownloadShelfVisible(1)) |
@@ -532,7 +534,7 @@ |
self.PerformActionOnDownload(id, 'open') |
self.WaitForAllDownloadsToComplete() |
unzip_file_name = downloaded_pkg + '.cpgz' |
- # Verify that the file was correctly downloaded |
+ # Verify that the file was correctly downloaded. |
self.assertTrue(self.WaitUntil(lambda: os.path.exists(unzip_file_name)), |
'Unzipped folder %s missing.' % unzip_file_name) |
self.assertTrue(os.path.exists(downloaded_pkg), |
@@ -562,7 +564,7 @@ |
return old_percentage == 100 or percent > old_percentage, |
self.assertTrue(self.WaitUntil(_PercentInc), |
msg='Download percentage value is not increasing') |
- # Once download is completed, percentage is 100 |
+ # Once download is completed, percentage is 100. |
self.WaitForAllDownloadsToComplete() |
downloads = self.GetDownloadsInfo().Downloads() |
self.assertEqual(downloads[0]['PercentComplete'], 100, |
@@ -584,17 +586,21 @@ |
'a_zip_file (1).zip') |
self._ClearLocalDownloadState(downloaded_pkg_regul) |
self._ClearLocalDownloadState(downloaded_pkg_incog) |
- self.NavigateToURL(file_url, 0, 0) |
+ |
+ self.DownloadAndWaitForStart(file_url, 0) |
+ self.WaitForAllDownloadsToComplete(0) |
+ |
self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
- self.NavigateToURL(file_url, 1, 0) |
- self.WaitForAllDownloadsToComplete() |
+ self.DownloadAndWaitForStart(file_url, 1) |
+ self.WaitForAllDownloadsToComplete(1) |
- # Verify download in regular Window. |
+ # Verify download in regular window. |
self.assertTrue(os.path.exists(downloaded_pkg_regul)) |
self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_regul)) |
- # Verify download in Incognito Window. |
- # WaitForAllDownloadsToComplete does not wait for incognito downloads |
+ # Verify download in incognito window. |
+ # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. |
+ # Using extra WaitUntil until this is resolved. |
self.assertTrue(self.WaitUntil( |
lambda: os.path.exists(downloaded_pkg_incog))) |
self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) |