| 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 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 file_path = os.path.join(test_dir, 'a_zip_file.zip') | 131 file_path = os.path.join(test_dir, 'a_zip_file.zip') |
| 132 file_url = self.GetFileURLForPath(file_path) | 132 file_url = self.GetFileURLForPath(file_path) |
| 133 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), | 133 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), |
| 134 'a_zip_file.zip') | 134 'a_zip_file.zip') |
| 135 self._ClearLocalDownloadState(downloaded_pkg) | 135 self._ClearLocalDownloadState(downloaded_pkg) |
| 136 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) | 136 self.RunCommand(pyauto.IDC_NEW_INCOGNITO_WINDOW) |
| 137 | 137 |
| 138 # Trigger download and wait in new incognito window. | 138 # Trigger download and wait in new incognito window. |
| 139 self.DownloadAndWaitForStart(file_url, 1) | 139 self.DownloadAndWaitForStart(file_url, 1) |
| 140 self.WaitForAllDownloadsToComplete(1) | 140 self.WaitForAllDownloadsToComplete(1) |
| 141 # Remove next line when WaitForAllDownloadsToComplete can reliably wait |
| 142 # for downloads in incognito window. crbug.com/69738 |
| 143 self.WaitForDownloadToComplete(downloaded_pkg) |
| 141 incognito_downloads = self.GetDownloadsInfo(1).Downloads() | 144 incognito_downloads = self.GetDownloadsInfo(1).Downloads() |
| 142 | 145 |
| 143 # Verify that download info exists in the correct profile. | 146 # Verify that download info exists in the correct profile. |
| 144 self.assertEqual(len(incognito_downloads), 1) | 147 self.assertEqual(len(incognito_downloads), 1) |
| 145 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg), | 148 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg), |
| 146 msg='%s (size %d) and %s (size %d) do not match' % ( | 149 msg='%s (size %d) and %s (size %d) do not match' % ( |
| 147 file_path, os.path.getsize(file_path), | 150 file_path, os.path.getsize(file_path), |
| 148 downloaded_pkg, os.path.getsize(downloaded_pkg))) | 151 downloaded_pkg, os.path.getsize(downloaded_pkg))) |
| 149 self.assertTrue(self.IsDownloadShelfVisible(1)) | 152 self.assertTrue(self.IsDownloadShelfVisible(1)) |
| 150 | 153 |
| (...skipping 439 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 # Verify download in incognito window. | 593 # Verify download in incognito window. |
| 591 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. | 594 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. |
| 592 # Using extra WaitUntil until this is resolved. | 595 # Using extra WaitUntil until this is resolved. |
| 593 self.assertTrue(self.WaitUntil( | 596 self.assertTrue(self.WaitUntil( |
| 594 lambda: os.path.exists(downloaded_pkg_incog))) | 597 lambda: os.path.exists(downloaded_pkg_incog))) |
| 595 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) | 598 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) |
| 596 | 599 |
| 597 | 600 |
| 598 if __name__ == '__main__': | 601 if __name__ == '__main__': |
| 599 pyauto_functional.Main() | 602 pyauto_functional.Main() |
| OLD | NEW |