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

Side by Side Diff: chrome/test/functional/downloads.py

Issue 8598026: Changed dangerous downloading to use .jar files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Deleted unused invalid-dummy.dmg. Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/data/downloads/dangerous/invalid-dummy.dmg ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import commands 6 import commands
7 import filecmp 7 import filecmp
8 import logging 8 import logging
9 import os 9 import os
10 import shutil 10 import shutil
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 Clears the given path and the corresponding .crdownload, to prepare it to 57 Clears the given path and the corresponding .crdownload, to prepare it to
58 be downloaded. 58 be downloaded.
59 """ 59 """
60 os.path.exists(path) and os.remove(path) 60 os.path.exists(path) and os.remove(path)
61 crdownload = path + '.crdownload' 61 crdownload = path + '.crdownload'
62 os.path.exists(crdownload) and os.remove(crdownload) 62 os.path.exists(crdownload) and os.remove(crdownload)
63 63
64 def _GetDangerousDownload(self): 64 def _GetDangerousDownload(self):
65 """Returns the file path for a dangerous download for this OS.""" 65 """Returns the file path for a dangerous download for this OS."""
66 sub_path = os.path.join(self.DataDir(), 'downloads', 'dangerous') 66 sub_path = os.path.join(self.DataDir(), 'downloads', 'dangerous')
67 if self.IsMac(): 67 return os.path.join(sub_path, 'dangerous.jar')
68 return os.path.join(sub_path, 'invalid-dummy.dmg')
69 return os.path.join(sub_path, 'dangerous.exe')
70 68
71 def _EqualFileContents(self, file1, file2): 69 def _EqualFileContents(self, file1, file2):
72 """Determine if 2 given files have the same contents.""" 70 """Determine if 2 given files have the same contents."""
73 if not (os.path.exists(file1) and os.path.exists(file2)): 71 if not (os.path.exists(file1) and os.path.exists(file2)):
74 return False 72 return False
75 return filecmp.cmp(file1, file2, shallow=False) 73 return filecmp.cmp(file1, file2, shallow=False)
76 74
77 def _GetDownloadId(self, download_index=0): 75 def _GetDownloadId(self, download_index=0):
78 """Return the download id for the download at the given index. 76 """Return the download id for the download at the given index.
79 77
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 # Verify download in incognito window. 497 # Verify download in incognito window.
500 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. 498 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case.
501 # Using extra WaitUntil until this is resolved. 499 # Using extra WaitUntil until this is resolved.
502 self.assertTrue(self.WaitUntil( 500 self.assertTrue(self.WaitUntil(
503 lambda: os.path.exists(downloaded_pkg_incog))) 501 lambda: os.path.exists(downloaded_pkg_incog)))
504 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) 502 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog))
505 503
506 504
507 if __name__ == '__main__': 505 if __name__ == '__main__':
508 pyauto_functional.Main() 506 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/data/downloads/dangerous/invalid-dummy.dmg ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698