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 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 self.assertFalse(os.path.exists(downloaded_pkg)) | 387 self.assertFalse(os.path.exists(downloaded_pkg)) |
388 | 388 |
389 def testDownloadsPersistence(self): | 389 def testDownloadsPersistence(self): |
390 """Verify that download history persists on session restart.""" | 390 """Verify that download history persists on session restart.""" |
391 test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') | 391 test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') |
392 file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) | 392 file_url = self.GetFileURLForPath(os.path.join(test_dir, 'a_zip_file.zip')) |
393 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), | 393 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), |
394 'a_zip_file.zip') | 394 'a_zip_file.zip') |
395 self._ClearLocalDownloadState(downloaded_pkg) | 395 self._ClearLocalDownloadState(downloaded_pkg) |
396 self.DownloadAndWaitForStart(file_url) | 396 self.DownloadAndWaitForStart(file_url) |
| 397 self.WaitForDownloadToComplete(downloaded_pkg) |
397 downloads = self.GetDownloadsInfo().Downloads() | 398 downloads = self.GetDownloadsInfo().Downloads() |
398 self.assertEqual(1, len(downloads)) | 399 self.assertEqual(1, len(downloads)) |
399 self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) | 400 self.assertEqual('a_zip_file.zip', downloads[0]['file_name']) |
400 file_url = downloads[0]['url'] | 401 file_url = downloads[0]['url'] |
401 self.RestartBrowser(clear_profile=False) | 402 self.RestartBrowser(clear_profile=False) |
402 # Trigger the download service to get loaded after restart. | 403 # Trigger the download service to get loaded after restart. |
403 self.NavigateToURL('chrome://downloads/') | 404 self.NavigateToURL('chrome://downloads/') |
404 # Verify that there's no download shelf anymore. | 405 # Verify that there's no download shelf anymore. |
405 self.assertFalse(self.IsDownloadShelfVisible(), | 406 self.assertFalse(self.IsDownloadShelfVisible(), |
406 'Download shelf persisted browser restart.') | 407 'Download shelf persisted browser restart.') |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
569 # Verify download in incognito window. | 570 # Verify download in incognito window. |
570 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. | 571 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. |
571 # Using extra WaitUntil until this is resolved. | 572 # Using extra WaitUntil until this is resolved. |
572 self.assertTrue(self.WaitUntil( | 573 self.assertTrue(self.WaitUntil( |
573 lambda: os.path.exists(downloaded_pkg_incog))) | 574 lambda: os.path.exists(downloaded_pkg_incog))) |
574 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) | 575 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) |
575 | 576 |
576 | 577 |
577 if __name__ == '__main__': | 578 if __name__ == '__main__': |
578 pyauto_functional.Main() | 579 pyauto_functional.Main() |
OLD | NEW |