OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/python |
2 # Copyright (c) 2010 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2010 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 filecmp | 6 import filecmp |
7 import logging | 7 import logging |
8 import os | 8 import os |
9 import shutil | 9 import shutil |
10 import sys | 10 import sys |
(...skipping 26 matching lines...) Expand all Loading... |
37 if name not in self._existing_downloads: | 37 if name not in self._existing_downloads: |
38 self.files_to_remove.append(os.path.join(download_dir, name)) | 38 self.files_to_remove.append(os.path.join(download_dir, name)) |
39 pyauto.PyUITest.tearDown(self) | 39 pyauto.PyUITest.tearDown(self) |
40 for item in self.files_to_remove: | 40 for item in self.files_to_remove: |
41 pyauto_utils.RemovePath(item) | 41 pyauto_utils.RemovePath(item) |
42 | 42 |
43 def _GetDangerousDownload(self): | 43 def _GetDangerousDownload(self): |
44 """Returns the file url for a dangerous download for this OS.""" | 44 """Returns the file url for a dangerous download for this OS.""" |
45 sub_path = os.path.join(self.DataDir(), 'downloads', 'dangerous') | 45 sub_path = os.path.join(self.DataDir(), 'downloads', 'dangerous') |
46 if self.IsMac(): | 46 if self.IsMac(): |
47 return os.path.join(sub_path, 'dangerous.dmg') | 47 return os.path.join(sub_path, 'invalid-dummy.dmg') |
48 return os.path.join(sub_path, 'dangerous.exe') | 48 return os.path.join(sub_path, 'dangerous.exe') |
49 | 49 |
50 def _EqualFileContents(self, file1, file2): | 50 def _EqualFileContents(self, file1, file2): |
51 """Determine if 2 given files have the same contents.""" | 51 """Determine if 2 given files have the same contents.""" |
52 if not (os.path.exists(file1) and os.path.exists(file2)): | 52 if not (os.path.exists(file1) and os.path.exists(file2)): |
53 return False | 53 return False |
54 return filecmp.cmp(file1, file2, shallow=False) | 54 return filecmp.cmp(file1, file2, shallow=False) |
55 | 55 |
56 def _GetDownloadId(self, download_index=0): | 56 def _GetDownloadId(self, download_index=0): |
57 """Return the download id for the download at the given index. | 57 """Return the download id for the download at the given index. |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 self.PerformActionOnDownload(self._GetDownloadId(), | 413 self.PerformActionOnDownload(self._GetDownloadId(), |
414 'save_dangerous_download') | 414 'save_dangerous_download') |
415 # Wait for the theme to be set automatically. | 415 # Wait for the theme to be set automatically. |
416 self.assertTrue(self.WaitUntilDownloadedThemeSet('camo theme')) | 416 self.assertTrue(self.WaitUntilDownloadedThemeSet('camo theme')) |
417 self.assertTrue(self.WaitUntil(lambda path: not os.path.exists(path), | 417 self.assertTrue(self.WaitUntil(lambda path: not os.path.exists(path), |
418 args=[downloaded_pkg])) | 418 args=[downloaded_pkg])) |
419 | 419 |
420 | 420 |
421 if __name__ == '__main__': | 421 if __name__ == '__main__': |
422 pyauto_functional.Main() | 422 pyauto_functional.Main() |
OLD | NEW |