| 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 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 # Create a 1 GB file on the fly | 193 # Create a 1 GB file on the fly |
| 194 file_path = self._MakeFile(2**30) | 194 file_path = self._MakeFile(2**30) |
| 195 try: | 195 try: |
| 196 file_url = self.GetFileURLForPath(file_path) | 196 file_url = self.GetFileURLForPath(file_path) |
| 197 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), | 197 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), |
| 198 os.path.basename(file_path)) | 198 os.path.basename(file_path)) |
| 199 os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) | 199 os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) |
| 200 self.DownloadAndWaitForStart(file_url) | 200 self.DownloadAndWaitForStart(file_url) |
| 201 # Waiting for big file to download might exceed automation timeout. | 201 # Waiting for big file to download might exceed automation timeout. |
| 202 # Temporarily increase the automation timeout. | 202 # Temporarily increase the automation timeout. |
| 203 self._CallFunctionWithNewTimeout(4 * 60 * 1000, # 4 min. | 203 |
| 204 self.WaitForAllDownloadsToComplete) | 204 # Temp workaround for crbug.com/54131 |
| 205 # self._CallFunctionWithNewTimeout(4 * 60 * 1000, # 4 min. |
| 206 # self.WaitForAllDownloadsToComplete) |
| 207 self.WaitForAllDownloadsToComplete(timeout=4*60*1000) |
| 208 # -- End workaround |
| 205 # Verify that the file was correctly downloaded | 209 # Verify that the file was correctly downloaded |
| 206 self.assertTrue(os.path.exists(downloaded_pkg), | 210 self.assertTrue(os.path.exists(downloaded_pkg), |
| 207 'Downloaded file %s missing.' % downloaded_pkg) | 211 'Downloaded file %s missing.' % downloaded_pkg) |
| 208 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg), | 212 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg), |
| 209 'Downloaded file %s does not match original' % | 213 'Downloaded file %s does not match original' % |
| 210 downloaded_pkg) | 214 downloaded_pkg) |
| 211 finally: # Cleanup. Remove all big files. | 215 finally: # Cleanup. Remove all big files. |
| 212 os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) | 216 os.path.exists(downloaded_pkg) and os.remove(downloaded_pkg) |
| 213 os.path.exists(file_path) and os.remove(file_path) | 217 os.path.exists(file_path) and os.remove(file_path) |
| 214 | 218 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 self.PerformActionOnDownload(self._GetDownloadId(), | 412 self.PerformActionOnDownload(self._GetDownloadId(), |
| 409 'save_dangerous_download') | 413 'save_dangerous_download') |
| 410 # Wait for the theme to be set automatically. | 414 # Wait for the theme to be set automatically. |
| 411 self.assertTrue(self.WaitUntilDownloadedThemeSet('camo theme')) | 415 self.assertTrue(self.WaitUntilDownloadedThemeSet('camo theme')) |
| 412 self.assertTrue(self.WaitUntil(lambda path: not os.path.exists(path), | 416 self.assertTrue(self.WaitUntil(lambda path: not os.path.exists(path), |
| 413 args=[downloaded_pkg])) | 417 args=[downloaded_pkg])) |
| 414 | 418 |
| 415 | 419 |
| 416 if __name__ == '__main__': | 420 if __name__ == '__main__': |
| 417 pyauto_functional.Main() | 421 pyauto_functional.Main() |
| OLD | NEW |