summaryrefslogtreecommitdiffstats
path: root/chrome/test/pyautolib
diff options
context:
space:
mode:
authoralyssad@chromium.org <alyssad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 16:39:12 +0000
committeralyssad@chromium.org <alyssad@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-02 16:39:12 +0000
commitf89ee5d14db7fd991323911df6ab2953c2d31438 (patch)
tree7c4f4c0b594e4b044f5ed88bf8525d5c187bcffb /chrome/test/pyautolib
parent2831cf15fe881b5259f730507ad8a6517e1f2b82 (diff)
downloadchromium_src-f89ee5d14db7fd991323911df6ab2953c2d31438.zip
chromium_src-f89ee5d14db7fd991323911df6ab2953c2d31438.tar.gz
chromium_src-f89ee5d14db7fd991323911df6ab2953c2d31438.tar.bz2
New pyauto translate hook: wait until translation complete.
This hook allows tests to wait until translation has been completed after visiting a page that should be automatically translated. Review URL: http://codereview.chromium.org/3074014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@54543 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/pyautolib')
-rw-r--r--chrome/test/pyautolib/pyauto.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 2b90fd1..9225a0f 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -747,6 +747,31 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
}
self._GetResultFromJSONRequest(cmd_dict, windex=window_index)
+ def WaitUntilTranslateComplete(self, tab_index=0, window_index=0):
+ """Waits until an attempted translation has finished.
+
+ This should be called after navigating to a page that should be translated
+ automatically (because the language always-translate is on). It does not
+ need to be called after 'ClickTranslateBarTranslate'.
+
+ Do not call this function if you are not expecting a page translation - it
+ will hang. If you call it when there is no translate bar, it will return
+ False.
+
+ Args:
+ tab_index: The tab index, default is 0.
+ window_index: The window index, default is 0.
+
+ Returns:
+ True if the translation was successful, False if there was an error.
+ """
+ cmd_dict = { # Prepare command for the json interface
+ 'command': 'WaitUntilTranslateComplete',
+ 'tab_index': tab_index
+ }
+ return self._GetResultFromJSONRequest(
+ cmd_dict, windex=window_index)['translation_success']
+
def FillAutoFillProfile(self, profiles=None, credit_cards=None,
tab_index=0, window_index=0):
"""Set the autofill profile to contain the given profiles and credit cards.