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

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

Issue 9791023: Allow setting of user and device policies in functional tests (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Comments addressed. Created 8 years, 8 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
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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
433 433
434 chronos_dir = '/home/chronos' 434 chronos_dir = '/home/chronos'
435 for item in os.listdir(chronos_dir): 435 for item in os.listdir(chronos_dir):
436 if item != 'user' and not item.startswith('.'): 436 if item != 'user' and not item.startswith('.'):
437 pyauto_utils.RemovePath(os.path.join(chronos_dir, item)) 437 pyauto_utils.RemovePath(os.path.join(chronos_dir, item))
438 438
439 @staticmethod 439 @staticmethod
440 def CleanupFlimflamDirsOnChromeOS(): 440 def CleanupFlimflamDirsOnChromeOS():
441 """Clean the contents of flimflam profiles and restart flimflam.""" 441 """Clean the contents of flimflam profiles and restart flimflam."""
442 PyUITest.RunSuperuserActionOnChromeOS('CleanFlimflamDirs') 442 PyUITest.RunSuperuserActionOnChromeOS('CleanFlimflamDirs')
443 443
Nirnimesh 2012/04/05 19:05:30 This has creeped in from your other CL. Remove.
bartfab (slow) 2012/04/10 15:27:20 No, this is actually used by PolicyTestBase.setUp(
444 @staticmethod 444 @staticmethod
445 def RemoveAllCryptohomeVaultsOnChromeOS():
446 """Remove any existing cryptohome vaults."""
447 PyUITest.RunSuperuserActionOnChromeOS('RemoveAllCryptohomeVaults')
448
449 @staticmethod
445 def _IsInodeNew(path, old_inode): 450 def _IsInodeNew(path, old_inode):
446 """Determine whether an inode has changed. POSIX only. 451 """Determine whether an inode has changed. POSIX only.
447 452
448 Args: 453 Args:
449 path: The file path to check for changes. 454 path: The file path to check for changes.
450 old_inode: The old inode number. 455 old_inode: The old inode number.
451 456
452 Returns: 457 Returns:
453 True if the path exists and its inode number is different from old_inode. 458 True if the path exists and its inode number is different from old_inode.
454 False otherwise. 459 False otherwise.
(...skipping 3205 matching lines...) Expand 10 before | Expand all | Expand 10 after
3660 Profiles will be listed in the same order as visible in preferences. 3665 Profiles will be listed in the same order as visible in preferences.
3661 3666
3662 Raises: 3667 Raises:
3663 pyauto_errors.JSONInterfaceError if the automation call returns an error. 3668 pyauto_errors.JSONInterfaceError if the automation call returns an error.
3664 """ 3669 """
3665 cmd_dict = { # Prepare command for the json interface 3670 cmd_dict = { # Prepare command for the json interface
3666 'command': 'GetMultiProfileInfo' 3671 'command': 'GetMultiProfileInfo'
3667 } 3672 }
3668 return self._GetResultFromJSONRequest(cmd_dict, windex=None) 3673 return self._GetResultFromJSONRequest(cmd_dict, windex=None)
3669 3674
3670 def SetPolicies(self, managed_platform=None, recommended_platform=None, 3675 def SetPolicies(self, managed_platform=None, recommended_platform=None,
Nirnimesh 2012/04/05 19:05:30 Isn't this obsolete? Remove.
bartfab (slow) 2012/04/10 15:27:20 Done, along with the TestingAutomationProvider met
3671 managed_cloud=None, recommended_cloud=None): 3676 managed_cloud=None, recommended_cloud=None):
3672 """Sets the policies on the browser. Always fails on official builds. 3677 """Sets the policies on the browser. Always fails on official builds.
3673 3678
3674 Args: 3679 Args:
3675 managed_platform: a dictionary with the policy values for the managed 3680 managed_platform: a dictionary with the policy values for the managed
3676 platform provider. 3681 platform provider.
3677 recommended_platform: a dictionary with the policy values for the 3682 recommended_platform: a dictionary with the policy values for the
3678 recommended platform provider. 3683 recommended platform provider.
3679 managed_cloud: a dictionary with the policy values for the managed 3684 managed_cloud: a dictionary with the policy values for the managed
3680 cloud provider. 3685 cloud provider.
(...skipping 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after
5246 successful = result.wasSuccessful() 5251 successful = result.wasSuccessful()
5247 if not successful: 5252 if not successful:
5248 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename) 5253 pyauto_tests_file = os.path.join(self.TestsDir(), self._tests_filename)
5249 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \ 5254 print >>sys.stderr, 'Tests can be disabled by editing %s. ' \
5250 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL) 5255 'Ref: %s' % (pyauto_tests_file, _PYAUTO_DOC_URL)
5251 sys.exit(not successful) 5256 sys.exit(not successful)
5252 5257
5253 5258
5254 if __name__ == '__main__': 5259 if __name__ == '__main__':
5255 Main() 5260 Main()
OLDNEW
« chrome/test/pyautolib/policy_base.py ('K') | « chrome/test/pyautolib/policy_base.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698