| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 logging.info('The download completed before pause. Stopping test.') | 362 logging.info('The download completed before pause. Stopping test.') |
| 363 return | 363 return |
| 364 | 364 |
| 365 self.assertTrue(pause_dict['is_paused']) | 365 self.assertTrue(pause_dict['is_paused']) |
| 366 self.assertTrue(pause_dict['state'] == 'IN_PROGRESS') | 366 self.assertTrue(pause_dict['state'] == 'IN_PROGRESS') |
| 367 | 367 |
| 368 # Resume the download and assert it is not paused. | 368 # Resume the download and assert it is not paused. |
| 369 resume_dict = self.PerformActionOnDownload(self._GetDownloadId(), | 369 resume_dict = self.PerformActionOnDownload(self._GetDownloadId(), |
| 370 'toggle_pause') | 370 'toggle_pause') |
| 371 self.assertFalse(resume_dict['is_paused']) | 371 self.assertFalse(resume_dict['is_paused']) |
| 372 self.WaitForAllDownloadsToComplete(timeout=10 * 60 * 1000); | 372 self.WaitForAllDownloadsToComplete(timeout=self.large_test_timeout_ms()); |
| 373 | 373 |
| 374 # Verify that the file was correctly downloaded after pause and resume. | 374 # Verify that the file was correctly downloaded after pause and resume. |
| 375 self.assertTrue(os.path.exists(downloaded_pkg), | 375 self.assertTrue(os.path.exists(downloaded_pkg), |
| 376 'Downloaded file %s missing.' % downloaded_pkg) | 376 'Downloaded file %s missing.' % downloaded_pkg) |
| 377 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg), | 377 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg), |
| 378 'Downloaded file %s does not match original' % | 378 'Downloaded file %s does not match original' % |
| 379 downloaded_pkg) | 379 downloaded_pkg) |
| 380 | 380 |
| 381 def testCancelDownload(self): | 381 def testCancelDownload(self): |
| 382 """Verify that we can cancel a download.""" | 382 """Verify that we can cancel a download.""" |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 507 # Verify download in incognito window. | 507 # Verify download in incognito window. |
| 508 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. | 508 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. |
| 509 # Using extra WaitUntil until this is resolved. | 509 # Using extra WaitUntil until this is resolved. |
| 510 self.assertTrue(self.WaitUntil( | 510 self.assertTrue(self.WaitUntil( |
| 511 lambda: os.path.exists(downloaded_pkg_incog))) | 511 lambda: os.path.exists(downloaded_pkg_incog))) |
| 512 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) | 512 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) |
| 513 | 513 |
| 514 | 514 |
| 515 if __name__ == '__main__': | 515 if __name__ == '__main__': |
| 516 pyauto_functional.Main() | 516 pyauto_functional.Main() |
| OLD | NEW |