Chromium Code Reviews
|
| OLD | NEW |
|---|---|
| (Empty) | |
| 1 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 import os | |
| 6 | |
| 7 import pyauto_functional # must be imported before pyauto | |
| 8 import pyauto | |
| 9 import pyauto_errors | |
| 10 | |
|
dennis_jeffrey
2011/12/06 21:41:16
nit: add 1 more blank line here to separate the im
xot
2011/12/06 22:20:42
Done.
| |
| 11 class ChromeosEnterpriseEnroll(pyauto.PyUITest): | |
| 12 """Test enrollment of chromebook device to enterprise domains. | |
| 13 | |
| 14 Preconditions: | |
| 15 1) TPM is not locked. That is, the device was not 'owned' by successful | |
| 16 enrollment to a domain, or by user sign in, since its last recovery. | |
| 17 2) Files exist at: /root/.forget_usernames, /home/chronos/.oobe_completed, | |
| 18 and /tmp/machine-info | |
| 19 3) File does not exist at: /home/.shadow/install_attributes.pb | |
| 20 """ | |
| 21 | |
| 22 _CHROME_FLAGS_FOR_ENTERPRISE = [ | |
| 23 ('--device-management-url=' | |
| 24 'https://cros-auto.sandbox.google.com/devicemanagement/data/api'), | |
| 25 '--gaia-host=gaiastaging.corp.google.com', | |
| 26 ] | |
| 27 | |
| 28 def setUp(self): | |
| 29 pyauto.PyUITest.setUp(self) | |
| 30 self.assertFalse(self.IsEnterpriseDevice(), msg='Device is already ' \ | |
|
dennis_jeffrey
2011/12/06 21:41:16
I believe the '\' at the end of the line is unnece
xot
2011/12/06 22:20:42
Done.
| |
| 31 'enrolled. Tests cannot continue.') | |
| 32 # TODO(scunningham): Add precondition steps to workaround bug 22282 | |
|
dennis_jeffrey
2011/12/06 21:41:16
nit: period at end of sentence
xot
2011/12/06 22:20:42
Done.
| |
| 33 | |
| 34 def ExtraChromeFlags(self): | |
| 35 """Launches Chrome with custom flags for enterprise test domains. | |
| 36 | |
| 37 Overrides the default list of flags normally passed to Chrome by | |
| 38 ExtraChromeFlags() in pyauto.py. | |
| 39 """ | |
| 40 return self._CHROME_FLAGS_FOR_ENTERPRISE | |
|
dennis_jeffrey
2011/12/06 21:41:16
Do we need to also pass along the other default fl
xot
2011/12/06 22:20:42
No, because no login ever happens.
| |
| 41 | |
| 42 def testEnrollToCrOsUnmanagedDomain(self): | |
| 43 """Try enroll to domain that does not support CrOS Management.""" | |
| 44 credentials = self.GetPrivateInfo()['test_enterprise_disabled_domain'] | |
| 45 enrollment_result = self.EnrollEnterpriseDevice(credentials['username'], | |
| 46 credentials['password']) | |
| 47 self.assertTrue(enrollment_result == 'Enrollment failed.', | |
| 48 msg='Enrollment succeded to a domain that does not have ' | |
| 49 'Chrome OS management enabled.') | |
| 50 # TODO(scunningham): Add more precise error checking after bug 22280 is | |
| 51 # fixed. | |
| 52 | |
| 53 def testEnrollWithInvalidPassword(self): | |
| 54 """Try to enroll with an invalid account password.""" | |
| 55 credentials = self.GetPrivateInfo()['test_enterprise_enabled_domain'] | |
| 56 enrollment_result = self.EnrollEnterpriseDevice(credentials['username'], | |
| 57 '__bogus_password__') | |
| 58 self.assertTrue(enrollment_result == 'Enrollment failed.', | |
| 59 msg='Enrollment succeeded to a domain that has Chrome OS ' | |
| 60 'management enabled, using an invalid password.') | |
| 61 # TODO(scunningham): Add more precise error checking after bug 22280 is | |
| 62 # fixed. | |
| 63 | |
| 64 def testEnrollWithInvalidUsername(self): | |
| 65 """Try to enroll with an invalid account username.""" | |
| 66 credentials = self.GetPrivateInfo()['test_enterprise_enabled_domain'] | |
| 67 enrollment_result = self.EnrollEnterpriseDevice('__bogus_username__', | |
| 68 credentials['password']) | |
| 69 self.assertTrue(enrollment_result == 'Enrollment failed.', | |
| 70 msg='Enrollment succeeded to a domain that has Chrome OS ' | |
| 71 'management enabled, using an invalid user account.') | |
| 72 # TODO(scunningham): Add more precise error checking after bug 22280 is | |
| 73 # fixed. | |
| 74 | |
| 75 | |
| 76 if __name__ == '__main__': | |
| 77 pyauto_functional.Main() | |
| OLD | NEW |