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 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
441 def CleanupFlimflamDirsOnChromeOS(): | 441 def CleanupFlimflamDirsOnChromeOS(): |
442 """Clean the contents of flimflam profiles and restart flimflam.""" | 442 """Clean the contents of flimflam profiles and restart flimflam.""" |
443 PyUITest.RunSuperuserActionOnChromeOS('CleanFlimflamDirs') | 443 PyUITest.RunSuperuserActionOnChromeOS('CleanFlimflamDirs') |
444 | 444 |
445 @staticmethod | 445 @staticmethod |
446 def RemoveAllCryptohomeVaultsOnChromeOS(): | 446 def RemoveAllCryptohomeVaultsOnChromeOS(): |
447 """Remove any existing cryptohome vaults.""" | 447 """Remove any existing cryptohome vaults.""" |
448 PyUITest.RunSuperuserActionOnChromeOS('RemoveAllCryptohomeVaults') | 448 PyUITest.RunSuperuserActionOnChromeOS('RemoveAllCryptohomeVaults') |
449 | 449 |
450 @staticmethod | 450 @staticmethod |
451 def DisableLocalStateAutoClearingOnChromeOS(): | |
452 """Disable clearing of the local state on session manager startup.""" | |
453 PyUITest.RunSuperuserActionOnChromeOS('DisableLocalStateAutoClearing') | |
454 | |
455 @staticmethod | |
456 def EnableLocalStateAutoClearingOnChromeOS(): | |
457 """Enable clearing of the local state on session manager startup.""" | |
458 PyUITest.RunSuperuserActionOnChromeOS('EnableLocalStateAutoClearing') | |
459 | |
460 @staticmethod | |
451 def _IsInodeNew(path, old_inode): | 461 def _IsInodeNew(path, old_inode): |
452 """Determine whether an inode has changed. POSIX only. | 462 """Determine whether an inode has changed. POSIX only. |
453 | 463 |
454 Args: | 464 Args: |
455 path: The file path to check for changes. | 465 path: The file path to check for changes. |
456 old_inode: The old inode number. | 466 old_inode: The old inode number. |
457 | 467 |
458 Returns: | 468 Returns: |
459 True if the path exists and its inode number is different from old_inode. | 469 True if the path exists and its inode number is different from old_inode. |
460 False otherwise. | 470 False otherwise. |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1285 """Return info about preferences. | 1295 """Return info about preferences. |
1286 | 1296 |
1287 This represents a snapshot of the local state preferences. If you expect | 1297 This represents a snapshot of the local state preferences. If you expect |
1288 local state preferences to have changed, you need to call this method again | 1298 local state preferences to have changed, you need to call this method again |
1289 to get a fresh snapshot. | 1299 to get a fresh snapshot. |
1290 | 1300 |
1291 Returns: | 1301 Returns: |
1292 an instance of prefs_info.PrefsInfo | 1302 an instance of prefs_info.PrefsInfo |
1293 """ | 1303 """ |
1294 return prefs_info.PrefsInfo( | 1304 return prefs_info.PrefsInfo( |
1295 self._SendJSONRequest(0, | 1305 self._SendJSONRequest(-1, |
Nirnimesh
2012/04/12 01:46:24
I'm surprised that it worked with 0! Thanks for fi
bartfab (slow)
2012/04/12 12:49:31
It seemed to work with 0 when you are logged in. W
| |
1296 json.dumps({'command': 'GetLocalStatePrefsInfo'}), | 1306 json.dumps({'command': 'GetLocalStatePrefsInfo'}), |
1297 self.action_max_timeout_ms())) | 1307 self.action_max_timeout_ms())) |
1298 | 1308 |
1299 def SetLocalStatePrefs(self, path, value): | 1309 def SetLocalStatePrefs(self, path, value): |
1300 """Set local state preference for the given path. | 1310 """Set local state preference for the given path. |
1301 | 1311 |
1302 Preferences are stored by Chromium as a hierarchical dictionary. | 1312 Preferences are stored by Chromium as a hierarchical dictionary. |
1303 dot-separated paths can be used to refer to a particular preference. | 1313 dot-separated paths can be used to refer to a particular preference. |
1304 example: "session.restore_on_startup" | 1314 example: "session.restore_on_startup" |
1305 | 1315 |
(...skipping 3983 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5289 successful = result.wasSuccessful() | 5299 successful = result.wasSuccessful() |
5290 if not successful: | 5300 if not successful: |
5291 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) | 5301 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) |
5292 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ | 5302 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ |
5293 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) | 5303 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) |
5294 sys.exit(not successful) | 5304 sys.exit(not successful) |
5295 | 5305 |
5296 | 5306 |
5297 if __name__ == '__main__': | 5307 if __name__ == '__main__': |
5298 Main() | 5308 Main() |
OLD | NEW |