diff options
author | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 17:19:19 +0000 |
---|---|---|
committer | nirnimesh@chromium.org <nirnimesh@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-14 17:19:19 +0000 |
commit | 81d5136a73a508bf2445f4bbd3a84288451005c8 (patch) | |
tree | b3d388b2b61e4089fb7755c4103ad671da291269 | |
parent | 7798871888c4b3b3e0385e4b56b2ace2dd9d9106 (diff) | |
download | chromium_src-81d5136a73a508bf2445f4bbd3a84288451005c8.zip chromium_src-81d5136a73a508bf2445f4bbd3a84288451005c8.tar.gz chromium_src-81d5136a73a508bf2445f4bbd3a84288451005c8.tar.bz2 |
Work around windows handles to temp files while deleting them.
Windows is stupid and weird and stupid. Or maybe I am all those things.
Apparently, while removing a temp file after telling chrome to cancel
downloading it still leaves windows to retain some handle to it for a very small amount of time so that
removing the temp file would fail. Try to work around by maintaining a list
of items to remove *after* the browser is shut down.
BUG=
TEST=
Review URL: http://codereview.chromium.org/3414001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@59386 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/test/functional/downloads.py | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/chrome/test/functional/downloads.py b/chrome/test/functional/downloads.py index d05ff71..f7517eb 100644 --- a/chrome/test/functional/downloads.py +++ b/chrome/test/functional/downloads.py @@ -27,6 +27,7 @@ class DownloadsTest(pyauto.PyUITest): self._existing_downloads = [] if os.path.isdir(download_dir): self._existing_downloads += os.listdir(download_dir) + self.files_to_remove = [] # Files to remove after browser shutdown def tearDown(self): # Cleanup all files we created in the download dir @@ -34,8 +35,10 @@ class DownloadsTest(pyauto.PyUITest): if os.path.isdir(download_dir): for name in os.listdir(download_dir): if name not in self._existing_downloads: - pyauto_utils.RemovePath(os.path.join(download_dir, name)) + self.files_to_remove.append(os.path.join(download_dir, name)) pyauto.PyUITest.tearDown(self) + for item in self.files_to_remove: + pyauto_utils.RemovePath(item) def _GetDangerousDownload(self): """Returns the file url for a dangerous download for this OS.""" @@ -361,7 +364,7 @@ class DownloadsTest(pyauto.PyUITest): os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) self.DownloadAndWaitForStart(file_url) self.PerformActionOnDownload(self._GetDownloadId(), 'cancel') - os.path.exists(file_path) and os.remove(file_path) + self.files_to_remove.append(file_path) state = self.GetDownloadsInfo().Downloads()[0]['state'] if state == 'COMPLETE': |