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

Side by Side Diff: chrome/test/pyautolib/download_info.py

Issue 7544026: Fix for flakiness in pyauto automation hook WaitForDownloadsToComplete. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged with trunk; awaiting green trybots. Created 9 years, 4 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
« no previous file with comments | « chrome/test/functional/translate.py ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2010 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2010 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """DownloadInfo: python representation for downloads visible to Chrome. 7 """DownloadInfo: python representation for downloads visible to Chrome.
8 8
9 Obtain one of these from PyUITestSuite::GetDownloadsInfo() call. 9 Obtain one of these from PyUITestSuite::GetDownloadsInfo() call.
10 10
11 class MyDownloadsTest(pyauto.PyUITest): 11 class MyDownloadsTest(pyauto.PyUITest):
12 def testDownload(self): 12 def testDownload(self):
13 self.NavigateToURL('http://my.url/package.zip') 13 self.DownloadAndWaitForStart('http://my.url/package.zip')
14 self.WaitForDownloadsToComplete() 14 self.WaitForAllDownloadsToComplete()
15 info = self.GetDownloadsInfo() 15 info = self.GetDownloadsInfo()
16 print info.Downloads() 16 print info.Downloads()
17 self.assertEqual(info.Downloads()[0]['file_name'], 'packge.zip') 17 self.assertEqual(info.Downloads()[0]['file_name'], 'packge.zip')
18 18
19 See more tests in chrome/test/functional/downloads.py. 19 See more tests in chrome/test/functional/downloads.py.
20 """ 20 """
21 21
22 import os 22 import os
23 import simplejson as json 23 import simplejson as json
24 import sys 24 import sys
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 """ 72 """
73 return [x for x in self.Downloads() if x['state'] == 'IN_PROGRESS'] 73 return [x for x in self.Downloads() if x['state'] == 'IN_PROGRESS']
74 74
75 def DownloadsComplete(self): 75 def DownloadsComplete(self):
76 """Info about all downloads that have completed. 76 """Info about all downloads that have completed.
77 77
78 Returns: 78 Returns:
79 [downloaditem1, downloaditem2, ...] 79 [downloaditem1, downloaditem2, ...]
80 """ 80 """
81 return [x for x in self.Downloads() if x['state'] == 'COMPLETE'] 81 return [x for x in self.Downloads() if x['state'] == 'COMPLETE']
OLDNEW
« no previous file with comments | « chrome/test/functional/translate.py ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698