summaryrefslogtreecommitdiffstats
path: root/chrome/test/pyautolib
diff options
context:
space:
mode:
authoralyssad@google.com <alyssad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-30 16:35:31 +0000
committeralyssad@google.com <alyssad@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-30 16:35:31 +0000
commitc48d8fada025ccfabd3e95e22b150d66fc98cb39 (patch)
treedd0d2ab4384c8b213147fcda476af7c724b0668c /chrome/test/pyautolib
parent359af188d36cc374076147f9808372a46a55baa7 (diff)
downloadchromium_src-c48d8fada025ccfabd3e95e22b150d66fc98cb39.zip
chromium_src-c48d8fada025ccfabd3e95e22b150d66fc98cb39.tar.gz
chromium_src-c48d8fada025ccfabd3e95e22b150d66fc98cb39.tar.bz2
Fix pyauto wait until hooks to use client-side WaitUntil BUG=53647
Some hooks have small chances of race conditions that can cause hangs and test failures. Fix this by using the client-side WaitUntil for now. Review URL: http://codereview.chromium.org/3222002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57865 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/pyautolib')
-rw-r--r--chrome/test/pyautolib/pyauto.py30
1 files changed, 12 insertions, 18 deletions
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 6aa64a2..0d4f667 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -560,21 +560,6 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
}
return self._GetResultFromJSONRequest(cmd_dict, windex=window_index)
- def WaitForAlwaysOpenDownloadTypeToOpen(self, id):
- """Wait for the given download to open.
-
- Note: This method should not be used after PerformActionOnDownload('open').
- It is used for files that are auto-downloaded based on the file type.
-
- Args:
- id: The id of the download.
- """
- cmd_dict = { # Prepare command for the json interface
- 'command': 'WaitForAlwaysOpenDownloadTypeToOpen',
- 'id': id
- }
- self._GetResultFromJSONRequest(cmd_dict)
-
def DownloadAndWaitForStart(self, file_url):
"""Trigger download for the given url and wait for downloads to start.
@@ -636,7 +621,12 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
'count': count,
'tab_index': tab_index,
}
- self._GetResultFromJSONRequest(cmd_dict, windex=windex)
+ # TODO(phajdan.jr): We need a solid automation infrastructure to handle
+ # these cases. See crbug.com/53647.
+ return self.WaitUntil(
+ lambda(count): len(self.GetBrowserInfo()\
+ ['windows'][windex]['tabs'][tab_index]['infobars']) == count,
+ args=[count])
def PerformActionOnInfobar(
self, action, infobar_index, windex=0, tab_index=0):
@@ -957,8 +947,12 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
'command': 'WaitUntilTranslateComplete',
'tab_index': tab_index
}
- return self._GetResultFromJSONRequest(
- cmd_dict, windex=window_index)['translation_success']
+ # TODO(phajdan.jr): We need a solid automation infrastructure to handle
+ # these cases. See crbug.com/53647.
+ return self.WaitUntil(
+ lambda tab_index, window_index: self.GetTranslateInfo(
+ tab_index=tab_index, window_index=window_index)['page_translated'],
+ args=[tab_index, window_index])
def FillAutoFillProfile(self, profiles=None, credit_cards=None,
tab_index=0, window_index=0):