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

Unified Diff: chrome/test/pyautolib/download_info.py

Issue 222873002: Remove pyauto tests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: sync Created 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/pyautolib/dom_mutation_observer.js ('k') | chrome/test/pyautolib/fetch_prebuilt_pyauto.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/pyautolib/download_info.py
===================================================================
--- chrome/test/pyautolib/download_info.py (revision 261231)
+++ chrome/test/pyautolib/download_info.py (working copy)
@@ -1,78 +0,0 @@
-# Copyright (c) 2011 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-"""DownloadInfo: python representation for downloads visible to Chrome.
-
-Obtain one of these from PyUITestSuite::GetDownloadsInfo() call.
-
-class MyDownloadsTest(pyauto.PyUITest):
- def testDownload(self):
- self.DownloadAndWaitForStart('http://my.url/package.zip')
- self.WaitForAllDownloadsToComplete()
- info = self.GetDownloadsInfo()
- print info.Downloads()
- self.assertEqual(info.Downloads()[0]['file_name'], 'packge.zip')
-
-See more tests in chrome/test/functional/downloads.py.
-"""
-
-import os
-import simplejson as json
-import sys
-
-from pyauto_errors import JSONInterfaceError
-
-
-class DownloadInfo(object):
- """Represent info about Downloads.
-
- The info is represented as a list of DownloadItems. Each DownloadItem is a
- dictionary with various attributes about a download, like id, file_name,
- path, state, and so on.
- """
- def __init__(self, downloads_dict):
- """Initialize a DownloadInfo from a string of json.
-
- Args:
- downloads_dict: a dict returned by the IPC command 'GetDownloadsInfo'.
- A typical dict representing one download looks like:
- {'downloads': [{'url': 'http://blah/a_file.zip',
- 'file_name': 'a_file.zip',
- 'state': 'COMPLETED',
- ...,
- ..., } ] }
-
- Raises:
- pyauto_errors.JSONInterfaceError if the automation call returns an error.
- """
- # JSON string prepared in GetDownloadsInfo() in automation_provider.cc
- self.downloadsdict = downloads_dict
- if self.downloadsdict.has_key('error'):
- raise JSONInterfaceError(self.downloadsdict['error'])
-
- def Downloads(self):
- """Info about all downloads.
-
- This includes downloads in all states (COMPLETE, IN_PROGRESS, ...).
-
- Returns:
- [downloaditem1, downloaditem2, ...]
- """
- return self.downloadsdict.get('downloads', [])
-
- def DownloadsInProgress(self):
- """Info about all downloads in progress.
-
- Returns:
- [downloaditem1, downloaditem2, ...]
- """
- return [x for x in self.Downloads() if x['state'] == 'IN_PROGRESS']
-
- def DownloadsComplete(self):
- """Info about all downloads that have completed.
-
- Returns:
- [downloaditem1, downloaditem2, ...]
- """
- return [x for x in self.Downloads() if x['state'] == 'COMPLETE']
« no previous file with comments | « chrome/test/pyautolib/dom_mutation_observer.js ('k') | chrome/test/pyautolib/fetch_prebuilt_pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698