OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 """Base class for tests that need to update the policies enforced by Chrome. | 5 """Base class for tests that need to update the policies enforced by Chrome. |
6 | 6 |
7 Subclasses can call SetUserPolicy (ChromeOS, Linux, Windows) and | 7 Subclasses can call SetUserPolicy (ChromeOS, Linux, Windows) and |
8 SetDevicePolicy (ChromeOS only) with a dictionary of the policies to install. | 8 SetDevicePolicy (ChromeOS only) with a dictionary of the policies to install. |
9 | 9 |
10 The current implementation depends on the platform. The implementations might | 10 The current implementation depends on the platform. The implementations might |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 owner = 'user@example.com' | 98 owner = 'user@example.com' |
99 # Subclasses may override these credentials to fake enrollment into another | 99 # Subclasses may override these credentials to fake enrollment into another |
100 # mode or use different device and machine IDs. | 100 # mode or use different device and machine IDs. |
101 mode = 'enterprise' | 101 mode = 'enterprise' |
102 device_id = string.upper(str(uuid.uuid4())) | 102 device_id = string.upper(str(uuid.uuid4())) |
103 machine_id = 'CROSTEST' | 103 machine_id = 'CROSTEST' |
104 | 104 |
105 _auth_server = None | 105 _auth_server = None |
106 _dns_server = None | 106 _dns_server = None |
107 | 107 |
| 108 def ShouldAutoLogin(self): |
| 109 return False |
| 110 |
108 @staticmethod | 111 @staticmethod |
109 def _Call(command, check=False): | 112 def _Call(command, check=False): |
110 """Invokes a subprocess and optionally asserts the return value is zero.""" | 113 """Invokes a subprocess and optionally asserts the return value is zero.""" |
111 with open(os.devnull, 'w') as devnull: | 114 with open(os.devnull, 'w') as devnull: |
112 if check: | 115 if check: |
113 return subprocess.check_call(command.split(' '), stdout=devnull) | 116 return subprocess.check_call(command.split(' '), stdout=devnull) |
114 else: | 117 else: |
115 return subprocess.call(command.split(' '), stdout=devnull) | 118 return subprocess.call(command.split(' '), stdout=devnull) |
116 | 119 |
117 def _WriteFile(self, path, content): | 120 def _WriteFile(self, path, content): |
(...skipping 456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 Args: | 577 Args: |
575 device_policy: The device policy to set. None clears it. | 578 device_policy: The device policy to set. None clears it. |
576 refresh: If True, Chrome will refresh and apply the new policy. | 579 refresh: If True, Chrome will refresh and apply the new policy. |
577 Requires Chrome to be alive for it. | 580 Requires Chrome to be alive for it. |
578 """ | 581 """ |
579 assert self.IsChromeOS() | 582 assert self.IsChromeOS() |
580 self._device_policy = device_policy or {} | 583 self._device_policy = device_policy or {} |
581 self._WritePolicyOnChromeOS() | 584 self._WritePolicyOnChromeOS() |
582 if refresh: | 585 if refresh: |
583 self.RefreshPolicies() | 586 self.RefreshPolicies() |
OLD | NEW |