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