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

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

Issue 3201004: Fix for pyauto dangerous downloads functional test. (Closed)
Patch Set: Real dmg Created 10 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
« no previous file with comments | « chrome/test/data/downloads/dangerous/dangerous.exe ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/downloads.py
diff --git a/chrome/test/functional/downloads.py b/chrome/test/functional/downloads.py
index e4dd243accd63b7855901f92004026bcaf9140d8..f998b3654e009d119472d9c94f32483b5d294a20 100644
--- a/chrome/test/functional/downloads.py
+++ b/chrome/test/functional/downloads.py
@@ -19,6 +19,13 @@ import pyauto
class DownloadsTest(pyauto.PyUITest):
"""TestCase for Downloads."""
+ def _GetDangerousDownload(self):
+ """Returns the file url for a dangerous download for this OS."""
+ sub_path = os.path.join(self.DataDir(), 'downloads', 'dangerous')
+ if self.IsMac():
+ return os.path.join(sub_path, 'dangerous.dmg')
+ return os.path.join(sub_path, 'dangerous.exe')
+
def _EqualFileContents(self, file1, file2):
"""Determine if 2 given files have the same contents."""
if not (os.path.exists(file1) and os.path.exists(file2)):
@@ -67,12 +74,10 @@ class DownloadsTest(pyauto.PyUITest):
def testDownloadDangerousFiles(self):
"""Verify that we can download and save dangerous files."""
- test_dir = os.path.abspath('.')
- # This file is a .py file which is "dangerous"
- file_path = os.path.join(test_dir, 'downloads.py')
+ file_path = self._GetDangerousDownload()
file_url = self.GetFileURLForPath(file_path)
downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),
- 'downloads.py')
+ os.path.basename(file_path))
os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg)
self.DownloadAndWaitForStart(file_url)
« no previous file with comments | « chrome/test/data/downloads/dangerous/dangerous.exe ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698