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

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

Issue 9111022: Removed ConfigurationPolicyType and extended PolicyMap. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 11 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 3316 matching lines...) Expand 10 before | Expand all | Expand 10 after
3327 3327
3328 Raises: 3328 Raises:
3329 pyauto_errors.JSONInterfaceError if the automation call returns an error. 3329 pyauto_errors.JSONInterfaceError if the automation call returns an error.
3330 """ 3330 """
3331 cmd_dict = { # Prepare command for the json interface 3331 cmd_dict = { # Prepare command for the json interface
3332 'command': 'GetMultiProfileInfo' 3332 'command': 'GetMultiProfileInfo'
3333 } 3333 }
3334 return self._GetResultFromJSONRequest(cmd_dict, windex=-1) 3334 return self._GetResultFromJSONRequest(cmd_dict, windex=-1)
3335 3335
3336 def SetPolicies(self, managed_platform=None, recommended_platform=None, 3336 def SetPolicies(self, managed_platform=None, recommended_platform=None,
3337 managed_cloud=None, recommended_cloud=None): 3337 managed_cloud=None, recommended_cloud=None,
3338 machine_scope=False):
3338 """Sets the policies on the browser. Always fails on official builds. 3339 """Sets the policies on the browser. Always fails on official builds.
3339 3340
3340 Args: 3341 Args:
3341 managed_platform: a dictionary with the policy values for the managed 3342 managed_platform: a dictionary with the policy values for the managed
3342 platform provider. 3343 platform provider.
3343 recommended_platform: a dictionary with the policy values for the 3344 recommended_platform: a dictionary with the policy values for the
3344 recommended platform provider. 3345 recommended platform provider.
3345 managed_cloud: a dictionary with the policy values for the managed 3346 managed_cloud: a dictionary with the policy values for the managed
3346 cloud provider. 3347 cloud provider.
3347 recommended_cloud: a dictionary with the policy values for the recommended 3348 recommended_cloud: a dictionary with the policy values for the recommended
3348 cloud provider. 3349 cloud provider.
3350 machine_scope: True to set the policies as machine policies, False to set
3351 them as user policies.
3349 3352
3350 Leaving an argument to None will restore the default behavior for that 3353 Leaving an argument to None will restore the default behavior for that
3351 provider. 3354 provider.
3352 """ 3355 """
3353 assert not self.GetBrowserInfo()['properties']['is_official'] 3356 assert not self.GetBrowserInfo()['properties']['is_official']
3354 cmd_dict = { 3357 cmd_dict = {
3355 'command': 'SetPolicies', 3358 'command': 'SetPolicies',
3356 'managed_cloud': managed_cloud, 3359 'managed_cloud': managed_cloud,
3357 'managed_platform': managed_platform, 3360 'managed_platform': managed_platform,
3358 'recommended_cloud': recommended_cloud, 3361 'recommended_cloud': recommended_cloud,
3359 'recommended_platform': recommended_platform 3362 'recommended_platform': recommended_platform,
3363 'machine_scope': machine_scope
3360 } 3364 }
3361 return self._GetResultFromJSONRequest(cmd_dict) 3365 return self._GetResultFromJSONRequest(cmd_dict)
3362 3366
3363 def GetPolicyDefinitionList(self): 3367 def GetPolicyDefinitionList(self):
3364 """Gets a dictionary of existing policies mapped to their value types. 3368 """Gets a dictionary of existing policies mapped to their value types.
3365 3369
3366 SAMPLE OUTPUT: 3370 SAMPLE OUTPUT:
3367 { 3371 {
3368 'ShowHomeButton': 'bool', 3372 'ShowHomeButton': 'bool',
3369 'DefaultSearchProviderSearchURL': 'str', 3373 'DefaultSearchProviderSearchURL': 'str',
(...skipping 1483 matching lines...) Expand 10 before | Expand all | Expand 10 after
4853 successful = result.wasSuccessful() 4857 successful = result.wasSuccessful()
4854 if not successful: 4858 if not successful:
4855 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 4859 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
4856 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 4860 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
4857 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 4861 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
4858 sys.exit(not successful) 4862 sys.exit(not successful)
4859 4863
4860 4864
4861 if __name__ == '__main__': 4865 if __name__ == '__main__':
4862 Main() 4866 Main()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698