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.
5 #include "base/command_line.h"
6 #include "base/prefs/pref_service.h"
7 #include "base/timer/timer.h"
8 #include "chrome/browser/browser_process.h"
9 #include "chrome/browser/chrome_notification_types.h"
10 #include "chrome/browser/chromeos/login/login_manager_test.h"
11 #include "chrome/browser/chromeos/login/screenshot_testing_mixin.h"
12 #include "chrome/browser/chromeos/login/startup_utils.h"
13 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h"
14 #include "chrome/browser/ui/webui/chromeos/login/signin_screen_handler.h"
15 #include "chrome/common/pref_names.h"
16 #include "content/public/browser/browser_thread.h"
17 #include "content/public/browser/notification_observer.h"
18 #include "content/public/browser/notification_registrar.h"
19 #include "content/public/browser/notification_service.h"
20 #include "content/public/browser/notification_types.h"
21 #include "ui/compositor/compositor_switches.h"
27 const char kTestUser1[] = "test-user1@gmail.com";
28 const char kTestUser2[] = "test-user2@gmail.com";
32 class LoginUITest : public chromeos::LoginManagerTest {
34 bool enable_test_screenshots_;
35 LoginUITest() : LoginManagerTest(false) {
36 screenshot_testing_ = new ScreenshotTestingMixin;
37 AddMixin(screenshot_testing_);
39 virtual ~LoginUITest() {}
42 ScreenshotTestingMixin* screenshot_testing_;
45 IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_LoginUIVisible) {
46 RegisterUser(kTestUser1);
47 RegisterUser(kTestUser2);
48 StartupUtils::MarkOobeCompleted();
51 // Verifies basic login UI properties.
52 IN_PROC_BROWSER_TEST_F(LoginUITest, LoginUIVisible) {
53 JSExpect("!!document.querySelector('#account-picker')");
54 JSExpect("!!document.querySelector('#pod-row')");
56 "document.querySelectorAll('.pod:not(#user-pod-template)').length == 2");
58 JSExpect("document.querySelectorAll('.pod:not(#user-pod-template)')[0]"
59 ".user.emailAddress == '" + std::string(kTestUser1) + "'");
60 JSExpect("document.querySelectorAll('.pod:not(#user-pod-template)')[1]"
61 ".user.emailAddress == '" + std::string(kTestUser2) + "'");
62 screenshot_testing_->RunScreenshotTesting("LoginUITest-LoginUIVisible");
65 IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_InterruptedAutoStartEnrollment) {
66 StartupUtils::MarkOobeCompleted();
67 PrefService* prefs = g_browser_process->local_state();
68 prefs->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
71 // Tests that the default first screen is the network screen after OOBE
72 // when auto enrollment is enabled and device is not yet enrolled.
73 IN_PROC_BROWSER_TEST_F(LoginUITest, InterruptedAutoStartEnrollment) {
74 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_NETWORK).Wait();
77 } // namespace chromeos