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

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

Issue 3078026: New translate pyauto hook: select translate target language (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Final Created 10 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/pyautolib/pyauto.py
diff --git a/chrome/test/pyautolib/pyauto.py b/chrome/test/pyautolib/pyauto.py
index 3c3f9796e64d79a94506397ae0eb198040ebe73c..89b3c288dcaf1cab246c5d69e502609e7b741010 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -720,6 +720,35 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
}
self._GetResultFromJSONRequest(cmd_dict, windex=window_index)
+ def ChangeTranslateToLanguage(self, new_language, tab_index=0,
+ window_index=0):
+ """Set the target language to be a new language.
+
+ This is equivalent to selecting a different language from the 'to'
+ drop-down menu on the translate bar. If the page was already translated
+ before calling this function, this will trigger a re-translate to the
+ new language.
+
+ Args:
+ new_language: The new target language. The string should be equivalent
+ to the text seen in the translate bar options.
+ Example: 'English'.
+ tab_index: The tab index - default is 0.
+ window_index: The window index - default is 0.
+
+ Returns:
+ False, if a new translation was triggered and the translation failed.
+ True on success.
+ """
+ cmd_dict = { # Prepare command for the json interface
+ 'command': 'SelectTranslateOption',
+ 'tab_index': tab_index,
+ 'option': 'set_target_language',
+ 'target_language': new_language
+ }
+ return self._GetResultFromJSONRequest(
+ cmd_dict, windex=window_index)['translation_success']
+
def GetExtensionsInfo(self):
"""Returns information about all installed extensions.
« no previous file with comments | « chrome/browser/automation/automation_provider.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698