| OLD | NEW |
| 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 4419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4430 Profiles will be listed in the same order as visible in preferences. | 4430 Profiles will be listed in the same order as visible in preferences. |
| 4431 | 4431 |
| 4432 Raises: | 4432 Raises: |
| 4433 pyauto_errors.JSONInterfaceError if the automation call returns an error. | 4433 pyauto_errors.JSONInterfaceError if the automation call returns an error. |
| 4434 """ | 4434 """ |
| 4435 cmd_dict = { # Prepare command for the json interface | 4435 cmd_dict = { # Prepare command for the json interface |
| 4436 'command': 'GetMultiProfileInfo' | 4436 'command': 'GetMultiProfileInfo' |
| 4437 } | 4437 } |
| 4438 return self._GetResultFromJSONRequest(cmd_dict, windex=None) | 4438 return self._GetResultFromJSONRequest(cmd_dict, windex=None) |
| 4439 | 4439 |
| 4440 def GetPolicyDefinitionList(self): | |
| 4441 """Gets a dictionary of existing policies mapped to their definitions. | |
| 4442 | |
| 4443 SAMPLE OUTPUT: | |
| 4444 { | |
| 4445 'ShowHomeButton': ['bool', false], | |
| 4446 'DefaultSearchProviderSearchURL': ['str', false], | |
| 4447 ... | |
| 4448 } | |
| 4449 | |
| 4450 Returns: | |
| 4451 A dictionary mapping each policy name to its value type and a Boolean flag | |
| 4452 indicating whether it is a device policy. | |
| 4453 """ | |
| 4454 cmd_dict = { | |
| 4455 'command': 'GetPolicyDefinitionList' | |
| 4456 } | |
| 4457 return self._GetResultFromJSONRequest(cmd_dict) | |
| 4458 | |
| 4459 def RefreshPolicies(self): | 4440 def RefreshPolicies(self): |
| 4460 """Refreshes all the available policy providers. | 4441 """Refreshes all the available policy providers. |
| 4461 | 4442 |
| 4462 Each policy provider will reload its policy source and push the updated | 4443 Each policy provider will reload its policy source and push the updated |
| 4463 policies. This call waits for the new policies to be applied; any policies | 4444 policies. This call waits for the new policies to be applied; any policies |
| 4464 installed before this call is issued are guaranteed to be ready after it | 4445 installed before this call is issued are guaranteed to be ready after it |
| 4465 returns. | 4446 returns. |
| 4466 """ | 4447 """ |
| 4467 # TODO(craigdh): Determine the root cause of RefreshPolicies' flakiness. | 4448 # TODO(craigdh): Determine the root cause of RefreshPolicies' flakiness. |
| 4468 # See crosbug.com/30221 | 4449 # See crosbug.com/30221 |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6476 successful = result.wasSuccessful() | 6457 successful = result.wasSuccessful() |
| 6477 if not successful: | 6458 if not successful: |
| 6478 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 6459 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
| 6479 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 6460 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
| 6480 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 6461 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
| 6481 sys.exit(not successful) | 6462 sys.exit(not successful) |
| 6482 | 6463 |
| 6483 | 6464 |
| 6484 if __name__ == '__main__': | 6465 if __name__ == '__main__': |
| 6485 Main() | 6466 Main() |
| OLD | NEW |