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

Unified Diff: chrome/test/functional/downloads.py

Issue 6159001: Modifying some downloads hooks to act per-window (so that incognito windows c... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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))
« no previous file with comments | « chrome/browser/automation/testing_automation_provider.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698