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

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

Issue 6159001: Modifying some downloads hooks to act per-window (so that incognito windows c... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 11 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/functional/downloads.py ('k') | chrome/test/pyautolib/pyautolib.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/pyautolib/pyauto.py
===================================================================
--- chrome/test/pyautolib/pyauto.py (revision 71402)
+++ chrome/test/pyautolib/pyauto.py (working copy)
@@ -388,7 +388,7 @@
"""
return bookmark_model.BookmarkModel(self._GetBookmarksAsJSON())
- def GetDownloadsInfo(self):
+ def GetDownloadsInfo(self, windex=0):
"""Return info about downloads.
This includes all the downloads recognized by the history system.
@@ -397,7 +397,8 @@
an instance of downloads_info.DownloadInfo
"""
return download_info.DownloadInfo(
- self._SendJSONRequest(0, json.dumps({'command': 'GetDownloadsInfo'})))
+ self._SendJSONRequest(
+ windex, json.dumps({'command': 'GetDownloadsInfo'})))
def GetOmniboxInfo(self, windex=0):
"""Return info about Omnibox.
@@ -657,13 +658,14 @@
}
self._GetResultFromJSONRequest(cmd_dict)
- def WaitForAllDownloadsToComplete(self):
+ def WaitForAllDownloadsToComplete(self, windex=0):
"""Wait for all downloads to complete.
Note: This method does not work for dangerous downloads. Use
WaitForGivenDownloadsToComplete (below) instead.
"""
- self._GetResultFromJSONRequest({'command': 'WaitForAllDownloadsToComplete'})
+ cmd_dict = {'command': 'WaitForAllDownloadsToComplete'}
+ self._GetResultFromJSONRequest(cmd_dict, windex=windex)
def WaitForDownloadToComplete(self, download_path, timeout=-1):
"""Wait for the given downloads to complete.
@@ -728,7 +730,7 @@
}
return self._GetResultFromJSONRequest(cmd_dict, windex=window_index)
- def DownloadAndWaitForStart(self, file_url):
+ def DownloadAndWaitForStart(self, file_url, windex=0):
"""Trigger download for the given url and wait for downloads to start.
It waits for download by looking at the download info from Chrome, so
@@ -738,11 +740,16 @@
download, it's fine to start another one even if the first one hasn't
completed.
"""
- num_downloads = len(self.GetDownloadsInfo().Downloads())
- self.NavigateToURL(file_url) # Trigger download.
+ try:
+ num_downloads = len(self.GetDownloadsInfo(windex).Downloads())
+ except JSONInterfaceError:
+ num_downloads = 0
+
+ self.NavigateToURL(file_url, windex) # Trigger download.
# It might take a while for the download to kick in, hold on until then.
self.assertTrue(self.WaitUntil(
- lambda: len(self.GetDownloadsInfo().Downloads()) == num_downloads + 1))
+ lambda: len(self.GetDownloadsInfo(windex).Downloads()) >
+ num_downloads))
def SetWindowDimensions(
self, x=None, y=None, width=None, height=None, windex=0):
« no previous file with comments | « chrome/test/functional/downloads.py ('k') | chrome/test/pyautolib/pyautolib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698