Commit 4b436bc6 authored by aocampo@chromium.org's avatar aocampo@chromium.org

Added code to check for translate if policy is set.

BUG=59767

Review URL: http://codereview.chromium.org/7671009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@97087 0039d316-1c4b-4281-b951-d872f2087c98
parent 29247344
......@@ -336,6 +336,21 @@ class EnterpriseTest(pyauto.PyUITest):
self.assertRaises(pyauto.JSONInterfaceError,
lambda: self.SetPrefs(pyauto.kManagedDefaultPopupsSetting, 1))
def testTranslateEnabled(self):
"""Verify that translate happens if policy enables it."""
if self.GetBrowserInfo()['properties']['branding'] != 'Google Chrome':
return
self.assertTrue(self.GetPrefsInfo().Prefs(pyauto.kEnableTranslate))
url = self.GetFileURLForDataPath('translate', 'es', 'google.html')
self.NavigateToURL(url)
self.assertTrue(self.WaitForInfobarCount(1))
translate_info = self.GetTranslateInfo()
self.assertEqual('es', translate_info['original_language'])
self.assertFalse(translate_info['page_translated'])
self.assertTrue(translate_info['can_translate_page'])
self.assertTrue('translate_bar' in translate_info)
self._CheckIfPrefCanBeModified(pyauto.kEnableTranslate, True, False)
class EnterpriseTestReverse(pyauto.PyUITest):
"""Test for the Enterprise features that uses the opposite values of the
policies used by above test class 'EnterpriseTest'.
......@@ -608,6 +623,16 @@ class EnterpriseTestReverse(pyauto.PyUITest):
self.assertRaises(pyauto.JSONInterfaceError,
lambda: self.SetPrefs(pyauto.kManagedDefaultPopupsSetting, 2))
def testTranslateDisabled(self):
"""Verify that translate does not happen if policy disables it."""
if self.GetBrowserInfo()['properties']['branding'] != 'Google Chrome':
return
self.assertFalse(self.GetPrefsInfo().Prefs(pyauto.kEnableTranslate))
url = self.GetFileURLForDataPath('translate', 'es', 'google.html')
self.NavigateToURL(url)
self.assertFalse(self.WaitForInfobarCount(1))
self._CheckIfPrefCanBeModified(pyauto.kEnableTranslate, False, True)
if __name__ == '__main__':
pyauto_functional.Main()
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment