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

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

Issue 11493003: Remove the protector service. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix implicit ExtensionSystem -> TemplateURLService dependency Created 8 years 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/functional/protector.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/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """PyAuto: Python Interface to Chromium's Automation Proxy. 6 """PyAuto: Python Interface to Chromium's Automation Proxy.
7 7
8 PyAuto uses swig to expose Automation Proxy interfaces to Python. 8 PyAuto uses swig to expose Automation Proxy interfaces to Python.
9 For complete documentation on the functionality available, 9 For complete documentation on the functionality available,
10 run pydoc on this file. 10 run pydoc on this file.
(...skipping 2112 matching lines...) Expand 10 before | Expand all | Expand 10 after
2123 keyword: the keyword string of the search engine to make default. 2123 keyword: the keyword string of the search engine to make default.
2124 windex: The window index, default is 0. 2124 windex: The window index, default is 0.
2125 """ 2125 """
2126 # Ensure that the search engine profile is loaded into data model. 2126 # Ensure that the search engine profile is loaded into data model.
2127 self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'}, 2127 self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'},
2128 windex=windex) 2128 windex=windex)
2129 cmd_dict = {'command': 'PerformActionOnSearchEngine', 'keyword': keyword, 2129 cmd_dict = {'command': 'PerformActionOnSearchEngine', 'keyword': keyword,
2130 'action': 'default'} 2130 'action': 'default'}
2131 self._GetResultFromJSONRequest(cmd_dict, windex=windex) 2131 self._GetResultFromJSONRequest(cmd_dict, windex=windex)
2132 2132
2133 def _EnsureProtectorCheck(self):
2134 """Ensure that Protector check for changed settings has been performed in
2135 the current browser session.
2136
2137 No-op if Protector is disabled.
2138 """
2139 # Ensure that check for default search engine change has been performed.
2140 self._GetResultFromJSONRequest({'command': 'LoadSearchEngineInfo'})
2141
2142 def GetProtectorState(self, window_index=0):
2143 """Returns current Protector state.
2144
2145 This will trigger Protector's check for changed settings if it hasn't been
2146 performed yet.
2147
2148 Args:
2149 window_index: The window index, default is 0.
2150
2151 Returns:
2152 A dictionary.
2153 Example:
2154 { u'enabled': True,
2155 u'showing_change': False }
2156 """
2157 self._EnsureProtectorCheck()
2158 cmd_dict = {'command': 'GetProtectorState'}
2159 return self._GetResultFromJSONRequest(cmd_dict, windex=window_index)
2160
2161 def ApplyProtectorChange(self):
2162 """Applies the change shown by Protector and closes the bubble.
2163
2164 No-op if Protector is not showing any change.
2165 """
2166 cmd_dict = {'command': 'PerformProtectorAction',
2167 'action': 'apply_change'}
2168 self._GetResultFromJSONRequest(cmd_dict)
2169
2170 def DiscardProtectorChange(self):
2171 """Discards the change shown by Protector and closes the bubble.
2172
2173 No-op if Protector is not showing any change.
2174 """
2175 cmd_dict = {'command': 'PerformProtectorAction',
2176 'action': 'discard_change'}
2177 self._GetResultFromJSONRequest(cmd_dict)
2178
2179 def GetLocalStatePrefsInfo(self): 2133 def GetLocalStatePrefsInfo(self):
2180 """Return info about preferences. 2134 """Return info about preferences.
2181 2135
2182 This represents a snapshot of the local state preferences. If you expect 2136 This represents a snapshot of the local state preferences. If you expect
2183 local state preferences to have changed, you need to call this method again 2137 local state preferences to have changed, you need to call this method again
2184 to get a fresh snapshot. 2138 to get a fresh snapshot.
2185 2139
2186 Returns: 2140 Returns:
2187 an instance of prefs_info.PrefsInfo 2141 an instance of prefs_info.PrefsInfo
2188 """ 2142 """
(...skipping 4345 matching lines...) Expand 10 before | Expand all | Expand 10 after
6534 successful = result.wasSuccessful() 6488 successful = result.wasSuccessful()
6535 if not successful: 6489 if not successful:
6536 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 6490 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
6537 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 6491 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
6538 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 6492 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
6539 sys.exit(not successful) 6493 sys.exit(not successful)
6540 6494
6541 6495
6542 if __name__ == '__main__': 6496 if __name__ == '__main__':
6543 Main() 6497 Main()
OLDNEW
« no previous file with comments | « chrome/test/functional/protector.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698