Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Side by Side Diff: chrome/test/functional/downloads.py

Issue 6685099: Removing command_execution_timeout_ms in favor of action_max_timeout_ms. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 # Copyright (c) 2010 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
11 import sys 11 import sys
12 import tempfile 12 import tempfile
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 # Create a 1 GB file on the fly 209 # Create a 1 GB file on the fly
210 file_path = self._MakeFile(2**30) 210 file_path = self._MakeFile(2**30)
211 self._DeleteAfterShutdown(file_path) 211 self._DeleteAfterShutdown(file_path)
212 file_url = self.GetFileURLForPath(file_path) 212 file_url = self.GetFileURLForPath(file_path)
213 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(), 213 downloaded_pkg = os.path.join(self.GetDownloadDirectory().value(),
214 os.path.basename(file_path)) 214 os.path.basename(file_path))
215 self._ClearLocalDownloadState(downloaded_pkg) 215 self._ClearLocalDownloadState(downloaded_pkg)
216 self.DownloadAndWaitForStart(file_url) 216 self.DownloadAndWaitForStart(file_url)
217 self._DeleteAfterShutdown(downloaded_pkg) 217 self._DeleteAfterShutdown(downloaded_pkg)
218 # Waiting for big file to download might exceed automation timeout. 218 # Waiting for big file to download might exceed automation timeout.
219 # Temporarily increase the automation timeout. 219 # Increase timeout to 4 minutes.
220 test_utils.CallFunctionWithNewTimeout(self, 4 * 60 * 1000, # 4 min. 220 self.WaitForAllDownloadsToComplete(timeout=240000);
Paweł Hajdan Jr. 2011/03/26 10:55:12 Actually you want to get this value from TestTimeo
Huyen 2011/03/29 00:11:39 Done.
221 self.WaitForAllDownloadsToComplete)
222 # Verify that the file was correctly downloaded 221 # Verify that the file was correctly downloaded
223 self.assertTrue(os.path.exists(downloaded_pkg), 222 self.assertTrue(os.path.exists(downloaded_pkg),
224 'Downloaded file %s missing.' % downloaded_pkg) 223 'Downloaded file %s missing.' % downloaded_pkg)
225 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg), 224 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg),
226 'Downloaded file %s does not match original' % 225 'Downloaded file %s does not match original' %
227 downloaded_pkg) 226 downloaded_pkg)
228 227
229 def testFileRenaming(self): 228 def testFileRenaming(self):
230 """Test file renaming when downloading a already-existing filename.""" 229 """Test file renaming when downloading a already-existing filename."""
231 test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads') 230 test_dir = os.path.join(os.path.abspath(self.DataDir()), 'downloads')
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 353
355 self.assertTrue(pause_dict['is_paused']) 354 self.assertTrue(pause_dict['is_paused'])
356 self.assertTrue(pause_dict['state'] == 'IN_PROGRESS') 355 self.assertTrue(pause_dict['state'] == 'IN_PROGRESS')
357 356
358 # Resume the download and assert it is not paused. 357 # Resume the download and assert it is not paused.
359 resume_dict = self.PerformActionOnDownload(self._GetDownloadId(), 358 resume_dict = self.PerformActionOnDownload(self._GetDownloadId(),
360 'toggle_pause') 359 'toggle_pause')
361 self.assertFalse(resume_dict['is_paused']) 360 self.assertFalse(resume_dict['is_paused'])
362 361
363 # Waiting for big file to download might exceed automation timeout. 362 # Waiting for big file to download might exceed automation timeout.
364 # Temporarily increase the automation timeout. 363 # Increase timeout to 2 mins.
365 test_utils.CallFunctionWithNewTimeout(self, 2 * 60 * 1000, # 2 min. 364 self.WaitForAllDownloadsToComplete(timeout=120000);
Paweł Hajdan Jr. 2011/03/26 10:55:12 Same here.
Huyen 2011/03/29 00:11:39 Done.
366 self.WaitForAllDownloadsToComplete)
367 365
368 # Verify that the file was correctly downloaded after pause and resume. 366 # Verify that the file was correctly downloaded after pause and resume.
369 self.assertTrue(os.path.exists(downloaded_pkg), 367 self.assertTrue(os.path.exists(downloaded_pkg),
370 'Downloaded file %s missing.' % downloaded_pkg) 368 'Downloaded file %s missing.' % downloaded_pkg)
371 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg), 369 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg),
372 'Downloaded file %s does not match original' % 370 'Downloaded file %s does not match original' %
373 downloaded_pkg) 371 downloaded_pkg)
374 372
375 def testCancelDownload(self): 373 def testCancelDownload(self):
376 """Verify that we can cancel a download.""" 374 """Verify that we can cancel a download."""
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
578 # Verify download in incognito window. 576 # Verify download in incognito window.
579 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case. 577 # bug 69738 WaitForAllDownloadsToComplete is flaky for this test case.
580 # Using extra WaitUntil until this is resolved. 578 # Using extra WaitUntil until this is resolved.
581 self.assertTrue(self.WaitUntil( 579 self.assertTrue(self.WaitUntil(
582 lambda: os.path.exists(downloaded_pkg_incog))) 580 lambda: os.path.exists(downloaded_pkg_incog)))
583 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog)) 581 self.assertTrue(self._EqualFileContents(file_path, downloaded_pkg_incog))
584 582
585 583
586 if __name__ == '__main__': 584 if __name__ == '__main__':
587 pyauto_functional.Main() 585 pyauto_functional.Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698