| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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() |
| OLD | NEW |