@@ -0,0 +1,3380 @@
+# Copyright (c) 2011 The Chromium Authors. All rights reserved.%0A# Use of this source code is governed by a BSD-style license that can be%0A# found in the LICENSE file.%0A%0Aimport os%0A%0Aimport pyauto_functional  # must be imported before pyauto%0Aimport pyauto%0Aimport pyauto_errors%0A%0A%0Aclass ChromeosEnterpriseEnroll(pyauto.PyUITest):%0A  %22%22%22Test enrollment of chromebook device to enterprise domains.%0A%0A  Preconditions:%0A  1) TPM is not locked. That is, the device was not 'owned' by successful%0A     enrollment to a domain, or by user sign in, since its last recovery.%0A  2) Files exist at: /root/.forget_usernames, /home/chronos/.oobe_completed,%0A     and /tmp/machine-info%0A  3) File does not exist at: /home/.shadow/install_attributes.pb%0A  %22%22%22%0A%0A  _CHROME_FLAGS_FOR_ENTERPRISE = %5B%0A    ('--device-management-url='%0A     'https://cros-auto.sandbox.google.com/devicemanagement/data/api'),%0A    '--gaia-host=gaiastaging.corp.google.com',%0A  %5D%0A%0A  def setUp(self):%0A    pyauto.PyUITest.setUp(self)%0A    self.assertFalse(self.IsEnterpriseDevice(), msg='Device is already '%0A                     'enrolled. Tests cannot continue.')%0A    # TODO(scunningham): Add precondition steps to workaround bug 22282.%0A%0A  def ExtraChromeFlags(self):%0A    %22%22%22Launches Chrome with custom flags for enterprise test domains.%0A%0A    Overrides the default list of flags normally passed to Chrome by%0A    ExtraChromeFlags() in pyauto.py.%0A    %22%22%22%0A    return self._CHROME_FLAGS_FOR_ENTERPRISE%0A%0A  def testEnrollToCrOsUnmanagedDomain(self):%0A    %22%22%22Try enroll to domain that does not support CrOS Management.%22%22%22%0A    credentials = self.GetPrivateInfo()%5B'test_enterprise_disabled_domain'%5D%0A    enrollment_result = self.EnrollEnterpriseDevice(credentials%5B'username'%5D,%0A                                                    credentials%5B'password'%5D)%0A    self.assertTrue(enrollment_result == 'Enrollment failed.',%0A                    msg='Enrollment succeded to a domain that does not have '%0A                    'Chrome OS management enabled.')%0A    # TODO(scunningham): Add more precise error checking after bug 22280 is%0A    # fixed.%0A%0A  def testEnrollWithInvalidPassword(self):%0A    %22%22%22Try to enroll with an invalid account password.%22%22%22%0A    credentials = self.GetPrivateInfo()%5B'test_enterprise_enabled_domain'%5D%0A    enrollment_result = self.EnrollEnterpriseDevice(credentials%5B'username'%5D,%0A                                                    '__bogus_password__')%0A    self.assertTrue(enrollment_result == 'Enrollment failed.',%0A                    msg='Enrollment succeeded to a domain that has Chrome OS '%0A                    'management enabled, using an invalid password.')%0A    # TODO(scunningham): Add more precise error checking after bug 22280 is%0A    # fixed.%0A%0A  def testEnrollWithInvalidUsername(self):%0A    %22%22%22Try to enroll with an invalid account username.%22%22%22%0A    credentials = self.GetPrivateInfo()%5B'test_enterprise_enabled_domain'%5D%0A    enrollment_result = self.EnrollEnterpriseDevice('__bogus_username__',%0A                                                    credentials%5B'password'%5D)%0A    self.assertTrue(enrollment_result == 'Enrollment failed.',%0A                    msg='Enrollment succeeded to a domain that has Chrome OS '%0A                    'management enabled, using an invalid user account.')%0A    # TODO(scunningham): Add more precise error checking after bug 22280 is%0A    # fixed.%0A%0A%0Aif __name__ == '__main__':%0A  pyauto_functional.Main()%0A

Rename file and test to 'chromeos_enterprise_enroll.py' from 'chromeos_enterprise_check_policies'. The old name was not appropriate for the type of tests being performed, since they have nothing to do with policies, and everything to do with enrollment.