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

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

Issue 8622007: Fix testSaveDangerousFile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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/dangerous.com ('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.IsWin():
68 return os.path.join(sub_path, 'dangerous.com')
67 return os.path.join(sub_path, 'dangerous.jar') 69 return os.path.join(sub_path, 'dangerous.jar')
68 70
69 def _EqualFileContents(self, file1, file2): 71 def _EqualFileContents(self, file1, file2):
70 """Determine if 2 given files have the same contents.""" 72 """Determine if 2 given files have the same contents."""
71 if not (os.path.exists(file1) and os.path.exists(file2)): 73 if not (os.path.exists(file1) and os.path.exists(file2)):
72 return False 74 return False
73 return filecmp.cmp(file1, file2, shallow=False) 75 return filecmp.cmp(file1, file2, shallow=False)
74 76
75 def _GetDownloadId(self, download_index=0): 77 def _GetDownloadId(self, download_index=0):
76 """Return the download id for the download at the given index. 78 """Return the download id for the download at the given index.
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 # Verify download in incognito window. 499 # Verify download in incognito window.
498 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. 500 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case.
499 # Using extra WaitUntil until this is resolved. 501 # Using extra WaitUntil until this is resolved.
500 self.assertTrue(self.WaitUntil( 502 self.assertTrue(self.WaitUntil(
501 lambda: os.path.exists(downloaded_pkg_incog))) 503 lambda: os.path.exists(downloaded_pkg_incog)))
502 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) 504 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog))
503 505
504 506
505 if __name__ == '__main__': 507 if __name__ == '__main__':
506 pyauto_functional.Main() 508 pyauto_functional.Main()
OLDNEW
« no previous file with comments | « chrome/test/data/downloads/dangerous/dangerous.com ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698