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

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

Issue 2827048: PyAuto: Automation hooks to get/set theme (Closed)
Patch Set: use existing ResetToDefaultTheme Created 10 years, 5 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/test/functional/themes.py ('k') | chrome/test/pyautolib/pyautolib.h » ('j') | 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 661b7c3ee2d7916824dc9b7e221dc0ef161ea217..76fd2682edb2d120576451387eef6a00cee79948 100644
--- a/chrome/test/pyautolib/pyauto.py
+++ b/chrome/test/pyautolib/pyauto.py
@@ -651,6 +651,68 @@ class PyUITest(pyautolib.PyUITestBase, unittest.TestCase):
finally:
shutil.rmtree(tempdir)
+ def SetTheme(self, crx_file_path):
+ """Installs the given theme synchronously.
+
+ A theme file is file with .crx suffix, like an extension.
+ This method call waits until theme is installed and will trigger the
+ "theme installed" infobar.
+
+ Uses InstallExtension().
+
+ Returns:
+ True, on success.
+ """
+ return self.InstallExtension(crx_file_path, True)
+
+ def ClearTheme(self):
+ """Clear the theme. Resets to default.
+
+ Has no effect when the theme is already the default one.
+ This is a blocking call.
+
+ Raises:
+ pyauto_errors.JSONInterfaceError if the automation call returns an error.
+ """
+ cmd_dict = {
+ 'command': 'ClearTheme',
+ }
+ ret_dict = json.loads(self._SendJSONRequest(0, json.dumps(cmd_dict)))
+ if ret_dict.has_key('error'):
+ raise JSONInterfaceError(ret_dict['error'])
+ return ret_dict
+
+ def GetThemeInfo(self):
+ """Get info about theme.
+
+ This includes info about the theme name, its colors, images, etc.
+
+ Returns:
+ a dictionary containing info about the theme.
+ empty dictionary if no theme has been applied (default theme).
+ SAMPLE:
+ { u'colors': { u'frame': [71, 105, 91],
+ u'ntp_link': [36, 70, 0],
+ u'ntp_section': [207, 221, 192],
+ u'ntp_text': [20, 40, 0],
+ u'toolbar': [207, 221, 192]},
+ u'images': { u'theme_frame': u'images/theme_frame_camo.png',
+ u'theme_ntp_background': u'images/theme_ntp_background.png',
+ u'theme_toolbar': u'images/theme_toolbar_camo.png'},
+ u'name': u'camo theme',
+ u'tints': {u'buttons': [0.33000000000000002, 0.5, 0.46999999999999997]}}
+
+ Raises:
+ pyauto_errors.JSONInterfaceError if the automation call returns an error.
+ """
+ cmd_dict = {
+ 'command': 'GetThemeInfo',
+ }
+ ret_dict = json.loads(self._SendJSONRequest(0, json.dumps(cmd_dict)))
+ if ret_dict.has_key('error'):
+ raise JSONInterfaceError(ret_dict['error'])
+ return ret_dict
+
class PyUITestSuite(pyautolib.PyUITestSuiteBase, unittest.TestSuite):
"""Base TestSuite for PyAuto UI tests."""
« no previous file with comments | « chrome/test/functional/themes.py ('k') | chrome/test/pyautolib/pyautolib.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698