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

Side by Side Diff: chrome/test/pyautolib/pyauto.py

Issue 7067033: Add pyauto commands to access local state. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 7 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/test/pyautolib/prefs_info.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 3 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """PyAuto: Python Interface to Chromium's Automation Proxy. 7 """PyAuto: Python Interface to Chromium's Automation Proxy.
8 8
9 PyAuto uses swig to expose Automation Proxy interfaces to Python. 9 PyAuto uses swig to expose Automation Proxy interfaces to Python.
10 For complete documentation on the functionality available, 10 For complete documentation on the functionality available,
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 809
810 Args: 810 Args:
811 keyword: the keyword string of the search engine to make default. 811 keyword: the keyword string of the search engine to make default.
812 """ 812 """
813 # Ensure that the search engine profile is loaded into data model. 813 # Ensure that the search engine profile is loaded into data model.
814 self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'}) 814 self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'})
815 cmd_dict = {'command': 'PerformActionOnSearchEngine', 'keyword': keyword, 815 cmd_dict = {'command': 'PerformActionOnSearchEngine', 'keyword': keyword,
816 'action': 'default'} 816 'action': 'default'}
817 self._GetResultFromJSONRequest(cmd_dict) 817 self._GetResultFromJSONRequest(cmd_dict)
818 818
819
820 def GetLocalStatePrefsInfo(self):
821 """Return info about preferences.
822
823 This represents a snapshot of the local state preferences. If you expect
824 local state preferences to have changed, you need to call this method again
825 to get a fresh snapshot.
826
827 Returns:
828 an instance of prefs_info.PrefsInfo
829 """
830 return prefs_info.PrefsInfo(
831 self._SendJSONRequest(0,
832 json.dumps({'command': 'GetLocalStatePrefsInfo'}),
833 self.action_max_timeout_ms()))
834
835 def SetLocalStatePrefs(self, path, value):
836 """Set local state preference for the given path.
837
838 Preferences are stored by Chromium as a hierarchical dictionary.
839 dot-separated paths can be used to refer to a particular preference.
840 example: "session.restore_on_startup"
841
842 Some preferences are managed, that is, they cannot be changed by the
843 user. It's up to the user to know which ones can be changed. Typically,
844 the options available via Chromium preferences can be changed.
845
846 Args:
847 path: the path the preference key that needs to be changed
848 example: "session.restore_on_startup"
849 One of the equivalent names in chrome/common/pref_names.h could
850 also be used.
851 value: the value to be set. It could be plain values like int, bool,
852 string or complex ones like list.
853 The user has to ensure that the right value is specified for the
854 right key. It's useful to dump the preferences first to determine
855 what type is expected for a particular preference path.
856 """
857 cmd_dict = {
858 'command': 'SetLocalStatePrefs',
859 'path': path,
860 'value': value,
861 }
862 self._GetResultFromJSONRequest(cmd_dict)
863
819 def GetPrefsInfo(self): 864 def GetPrefsInfo(self):
820 """Return info about preferences. 865 """Return info about preferences.
821 866
822 This represents a snapshot of the preferences. If you expect preferences 867 This represents a snapshot of the preferences. If you expect preferences
823 to have changed, you need to call this method again to get a fresh 868 to have changed, you need to call this method again to get a fresh
824 snapshot. 869 snapshot.
825 870
826 Returns: 871 Returns:
827 an instance of prefs_info.PrefsInfo 872 an instance of prefs_info.PrefsInfo
828 """ 873 """
(...skipping 2741 matching lines...) Expand 10 before | Expand all | Expand 10 after
3570 if self._options.verbose: 3615 if self._options.verbose:
3571 verbosity = 2 3616 verbosity = 2
3572 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite) 3617 result = PyAutoTextTestRuner(verbosity=verbosity).run(pyauto_suite)
3573 del loaded_tests # Need to destroy test cases before the suite 3618 del loaded_tests # Need to destroy test cases before the suite
3574 del pyauto_suite 3619 del pyauto_suite
3575 sys.exit(not result.wasSuccessful()) 3620 sys.exit(not result.wasSuccessful())
3576 3621
3577 3622
3578 if __name__ == '__main__': 3623 if __name__ == '__main__':
3579 Main() 3624 Main()
OLDNEW
« no previous file with comments | « chrome/test/pyautolib/prefs_info.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698