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

Unified Diff: chrome/test/functional/translate.py

Issue 3061054: New pyauto translate hooks: always and never translate button. (Closed)
Patch Set: Added max tries count 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_observers.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/functional/translate.py
diff --git a/chrome/test/functional/translate.py b/chrome/test/functional/translate.py
index b271a5b90f604c6f13507eb0d504901705b479a0..eb8f0f31a241377d9af4f236ef4c8e285d3058a6 100644
--- a/chrome/test/functional/translate.py
+++ b/chrome/test/functional/translate.py
@@ -82,7 +82,7 @@ class TranslateTest(pyauto.PyUITest):
def testNoTranslate(self):
"""Tests that a page isn't translated if the user declines translate."""
self._NavigateAndWaitForBar(self._GetDefaultSpanishURL())
- self.PerformActionOnInfobar('dismiss', 0)
+ self.SelectTranslateOption('decline_translation')
translate_info = self.GetTranslateInfo()
self.assertEqual(self.spanish, translate_info['original_language'])
self.assertFalse(translate_info['page_translated'])
@@ -329,6 +329,35 @@ class TranslateTest(pyauto.PyUITest):
self.NavigateToURL(self._GetDefaultSpanishURL())
self.assertFalse('translate_bar' in self.GetTranslateInfo())
+ def testAlwaysTranslateLanguageButton(self):
+ """Test the always translate language button."""
+ spanish_url = self._GetDefaultSpanishURL()
+ self._NavigateAndWaitForBar(spanish_url)
+
+ # The 'Always Translate' button doesn't show up until the user has clicked
+ # 'Translate' for a language several times.
+ max_tries = 10
+ curr_try = 0
+ while (curr_try < max_tries and
+ not self.GetTranslateInfo()['translate_bar']\
+ ['always_translate_lang_button_showing']):
+ self._ClickTranslateUntilSuccess()
+ self._NavigateAndWaitForBar(spanish_url)
+ curr_try = curr_try + 1
+ if curr_try == max_tries:
+ self.fail('Clicked translate %d times and always translate button never '\
+ 'showed up.' % max_tries)
+
+ # Click the 'Always Translate' button.
+ self.SelectTranslateOption('click_always_translate_lang_button')
+ # Navigate to another Spanish page and verify it was translated.
+ self._NavigateAndWaitForBar('http://www.google.com/webhp?hl=es')
+ self.WaitUntilTranslateComplete()
+ # Assert that a translation was attempted. We don't care if it was error
+ # or success.
+ self.assertNotEqual(self.before_translate,
+ self.GetTranslateInfo()['translate_bar']['bar_state'])
+
def testSeveralLanguages(self):
"""Verify translation for several languages.
« no previous file with comments | « chrome/browser/automation/automation_provider_observers.cc ('k') | chrome/test/pyautolib/pyauto.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698