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 |
| 11 |
| 12 class ChromeosEnterpriseEnroll(pyauto.PyUITest): |
| 13 """Test enrollment of chromebook device to enterprise domains. |
| 14 |
| 15 Preconditions: |
| 16 1) TPM is not locked. That is, the device was not 'owned' by successful |
| 17 enrollment to a domain, or by user sign in, since its last recovery. |
| 18 2) Files exist at: /root/.forget_usernames, /home/chronos/.oobe_completed, |
| 19 and /tmp/machine-info |
| 20 3) File does not exist at: /home/.shadow/install_attributes.pb |
| 21 """ |
| 22 |
| 23 _CHROME_FLAGS_FOR_ENTERPRISE = [ |
| 24 ('--device-management-url=' |
| 25 'https://cros-auto.sandbox.google.com/devicemanagement/data/api'), |
| 26 '--gaia-host=gaiastaging.corp.google.com', |
| 27 ] |
| 28 |
| 29 def setUp(self): |
| 30 pyauto.PyUITest.setUp(self) |
| 31 self.assertFalse(self.IsEnterpriseDevice(), msg='Device is already ' |
| 32 'enrolled. Tests cannot continue.') |
| 33 # TODO(scunningham): Add precondition steps to workaround bug 22282. |
| 34 |
| 35 def ExtraChromeFlags(self): |
| 36 """Launches Chrome with custom flags for enterprise test domains. |
| 37 |
| 38 Overrides the default list of flags normally passed to Chrome by |
| 39 ExtraChromeFlags() in pyauto.py. |
| 40 """ |
| 41 return self._CHROME_FLAGS_FOR_ENTERPRISE |
| 42 |
| 43 def testEnrollToCrOsUnmanagedDomain(self): |
| 44 """Try enroll to domain that does not support CrOS Management.""" |
| 45 credentials = self.GetPrivateInfo()['test_enterprise_disabled_domain'] |
| 46 enrollment_result = self.EnrollEnterpriseDevice(credentials['username'], |
| 47 credentials['password']) |
| 48 self.assertTrue(enrollment_result == 'Enrollment failed.', |
| 49 msg='Enrollment succeded to a domain that does not have ' |
| 50 'Chrome OS management enabled.') |
| 51 # TODO(scunningham): Add more precise error checking after bug 22280 is |
| 52 # fixed. |
| 53 |
| 54 def testEnrollWithInvalidPassword(self): |
| 55 """Try to enroll with an invalid account password.""" |
| 56 credentials = self.GetPrivateInfo()['test_enterprise_enabled_domain'] |
| 57 enrollment_result = self.EnrollEnterpriseDevice(credentials['username'], |
| 58 '__bogus_password__') |
| 59 self.assertTrue(enrollment_result == 'Enrollment failed.', |
| 60 msg='Enrollment succeeded to a domain that has Chrome OS ' |
| 61 'management enabled, using an invalid password.') |
| 62 # TODO(scunningham): Add more precise error checking after bug 22280 is |
| 63 # fixed. |
| 64 |
| 65 def testEnrollWithInvalidUsername(self): |
| 66 """Try to enroll with an invalid account username.""" |
| 67 credentials = self.GetPrivateInfo()['test_enterprise_enabled_domain'] |
| 68 enrollment_result = self.EnrollEnterpriseDevice('__bogus_username__', |
| 69 credentials['password']) |
| 70 self.assertTrue(enrollment_result == 'Enrollment failed.', |
| 71 msg='Enrollment succeeded to a domain that has Chrome OS ' |
| 72 'management enabled, using an invalid user account.') |
| 73 # TODO(scunningham): Add more precise error checking after bug 22280 is |
| 74 # fixed. |
| 75 |
| 76 |
| 77 if __name__ == '__main__': |
| 78 pyauto_functional.Main() |
OLD | NEW |