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 "chrome/browser/browser_process.h"
8 #include "chrome/browser/chrome_notification_types.h"
9 #include "chrome/browser/chromeos/login/login_manager_test.h"
10 #include "chrome/browser/chromeos/login/screenshot_testing/login_screen_areas.h"
11 #include "chrome/browser/chromeos/login/screenshot_testing/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 screenshot_testing_->IgnoreArea(areas::kClockArea);
38 screenshot_testing_->IgnoreArea(areas::kFirstUserpod);
39 screenshot_testing_->IgnoreArea(areas::kSecondUserpod);
40 AddMixin(screenshot_testing_);
42 virtual ~LoginUITest() {}
45 ScreenshotTestingMixin* screenshot_testing_;
48 IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_LoginUIVisible) {
49 RegisterUser(kTestUser1);
50 RegisterUser(kTestUser2);
51 StartupUtils::MarkOobeCompleted();
54 // Verifies basic login UI properties.
55 IN_PROC_BROWSER_TEST_F(LoginUITest, LoginUIVisible) {
56 JSExpect("!!document.querySelector('#account-picker')");
57 JSExpect("!!document.querySelector('#pod-row')");
59 "document.querySelectorAll('.pod:not(#user-pod-template)').length == 2");
61 JSExpect("document.querySelectorAll('.pod:not(#user-pod-template)')[0]"
62 ".user.emailAddress == '" + std::string(kTestUser1) + "'");
63 JSExpect("document.querySelectorAll('.pod:not(#user-pod-template)')[1]"
64 ".user.emailAddress == '" + std::string(kTestUser2) + "'");
65 screenshot_testing_->RunScreenshotTesting("LoginUITest-LoginUIVisible");
68 IN_PROC_BROWSER_TEST_F(LoginUITest, PRE_InterruptedAutoStartEnrollment) {
69 StartupUtils::MarkOobeCompleted();
70 PrefService* prefs = g_browser_process->local_state();
71 prefs->SetBoolean(prefs::kDeviceEnrollmentAutoStart, true);
74 // Tests that the default first screen is the network screen after OOBE
75 // when auto enrollment is enabled and device is not yet enrolled.
76 IN_PROC_BROWSER_TEST_F(LoginUITest, InterruptedAutoStartEnrollment) {
77 OobeScreenWaiter(OobeDisplay::SCREEN_OOBE_NETWORK).Wait();
80 } // namespace chromeos