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

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

Issue 9467013: Add prefs UI tests for Incognito exceptions for new Settings UI. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 9 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
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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after
1287 an instance of prefs_info.PrefsInfo 1287 an instance of prefs_info.PrefsInfo
1288 """ 1288 """
1289 cmd_dict = { 1289 cmd_dict = {
1290 'command': 'GetPrefsInfo', 1290 'command': 'GetPrefsInfo',
1291 'windex': 0, 1291 'windex': 0,
1292 } 1292 }
1293 return prefs_info.PrefsInfo( 1293 return prefs_info.PrefsInfo(
1294 self._SendJSONRequest(-1, json.dumps(cmd_dict), 1294 self._SendJSONRequest(-1, json.dumps(cmd_dict),
1295 self.action_max_timeout_ms())) 1295 self.action_max_timeout_ms()))
1296 1296
1297 def SetPrefs(self, path, value): 1297 def SetPrefs(self, path, value, windex=0):
1298 """Set preference for the given path. 1298 """Set preference for the given path.
1299 1299
1300 Preferences are stored by Chromium as a hierarchical dictionary. 1300 Preferences are stored by Chromium as a hierarchical dictionary.
1301 dot-separated paths can be used to refer to a particular preference. 1301 dot-separated paths can be used to refer to a particular preference.
1302 example: "session.restore_on_startup" 1302 example: "session.restore_on_startup"
1303 1303
1304 Some preferences are managed, that is, they cannot be changed by the 1304 Some preferences are managed, that is, they cannot be changed by the
1305 user. It's up to the user to know which ones can be changed. Typically, 1305 user. It's up to the user to know which ones can be changed. Typically,
1306 the options available via Chromium preferences can be changed. 1306 the options available via Chromium preferences can be changed.
1307 1307
1308 Args: 1308 Args:
1309 path: the path the preference key that needs to be changed 1309 path: the path the preference key that needs to be changed
1310 example: "session.restore_on_startup" 1310 example: "session.restore_on_startup"
1311 One of the equivalent names in chrome/common/pref_names.h could 1311 One of the equivalent names in chrome/common/pref_names.h could
1312 also be used. 1312 also be used.
1313 value: the value to be set. It could be plain values like int, bool, 1313 value: the value to be set. It could be plain values like int, bool,
1314 string or complex ones like list. 1314 string or complex ones like list.
1315 The user has to ensure that the right value is specified for the 1315 The user has to ensure that the right value is specified for the
1316 right key. It's useful to dump the preferences first to determine 1316 right key. It's useful to dump the preferences first to determine
1317 what type is expected for a particular preference path. 1317 what type is expected for a particular preference path.
1318 windex: window index to work on. Defaults to 0 (first window).
1318 """ 1319 """
1319 cmd_dict = { 1320 cmd_dict = {
1320 'command': 'SetPrefs', 1321 'command': 'SetPrefs',
1321 'windex': 0, 1322 'windex': windex,
1322 'path': path, 1323 'path': path,
1323 'value': value, 1324 'value': value,
1324 } 1325 }
1325 self._GetResultFromJSONRequest(cmd_dict, windex=None) 1326 self._GetResultFromJSONRequest(cmd_dict, windex=None)
1326 1327
1327 def SendWebkitKeyEvent(self, key_type, key_code, tab_index=0, windex=0): 1328 def SendWebkitKeyEvent(self, key_type, key_code, tab_index=0, windex=0):
1328 """Send a webkit key event to the browser. 1329 """Send a webkit key event to the browser.
1329 1330
1330 Args: 1331 Args:
1331 key_type: the raw key type such as 0 for up and 3 for down. 1332 key_type: the raw key type such as 0 for up and 3 for down.
(...skipping 3715 matching lines...) Expand 10 before | Expand all | Expand 10 after
5047 successful = result.wasSuccessful() 5048 successful = result.wasSuccessful()
5048 if not successful: 5049 if not successful:
5049 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 5050 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
5050 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 5051 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
5051 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 5052 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
5052 sys.exit(not successful) 5053 sys.exit(not successful)
5053 5054
5054 5055
5055 if __name__ == '__main__': 5056 if __name__ == '__main__':
5056 Main() 5057 Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698