Home | History | Annotate | Download | only in login
      1 // Copyright 2013 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 #include "base/prefs/pref_service.h"
      6 #include "chrome/browser/browser_process.h"
      7 #include "chrome/browser/chromeos/login/login_manager_test.h"
      8 #include "chrome/browser/chromeos/login/startup_utils.h"
      9 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h"
     10 #include "chrome/common/pref_names.h"
     11 
     12 namespace chromeos {
     13 
     14 namespace {
     15 
     16 const char kTestUser1[] = "test-user1 (at) gmail.com";
     17 const char kTestUser2[] = "test-user2 (at) gmail.com";
     18 
     19 }  // anonymous namespace
     20 
     21 class LoginUITest : public chromeos::LoginManagerTest {
     22  public:
     23   LoginUITest() : LoginManagerTest(false) {}
     24   virtual ~LoginUITest() {}
     25 };
     26 
     27 IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_LoginUIVisible) {
     28   RegisterUser(kTestUser1);
     29   RegisterUser(kTestUser2);
     30   StartupUtils::MarkOobeCompleted();
     31 }
     32 
     33 // Verifies basic login UI properties.
     34 IN_PROC_BROWSER_TEST_F(LoginUITest, LoginUIVisible) {
     35   JSExpect("!!document.querySelector('#account-picker')");
     36   JSExpect("!!document.querySelector('#pod-row')");
     37   JSExpect(
     38       "document.querySelectorAll('.pod:not(#user-pod-template)').length == 2");
     39 
     40   JSExpect("document.querySelectorAll('.pod:not(#user-pod-template)')[0]"
     41            ".user.emailAddress == '" + std::string(kTestUser1) + "'");
     42   JSExpect("document.querySelectorAll('.pod:not(#user-pod-template)')[1]"
     43            ".user.emailAddress == '" + std::string(kTestUser2) + "'");
     44 }
     45 
     46 IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_InterruptedAutoStartEnrollment) {
     47   StartupUtils::MarkOobeCompleted();
     48 
     49   PrefService* prefs = g_browser_process->local_state();
     50   prefs->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
     51 }
     52 
     53 // Tests that the default first screen is the network screen after OOBE
     54 // when auto enrollment is enabled and device is not yet enrolled.
     55 IN_PROC_BROWSER_TEST_F(LoginUITest, InterruptedAutoStartEnrollment) {
     56   OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_NETWORK).Wait();
     57 }
     58 
     59 }  // namespace chromeos
     60