OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/logging.h" |
6 #include "base/macros.h" | 7 #include "base/macros.h" |
7 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
8 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" | 9 #include "chrome/browser/chromeos/login/enrollment/enrollment_screen.h" |
| 10 #include "chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h" |
9 #include "chrome/browser/chromeos/login/screens/mock_base_screen_delegate.h" | 11 #include "chrome/browser/chromeos/login/screens/mock_base_screen_delegate.h" |
10 #include "chrome/browser/chromeos/login/startup_utils.h" | 12 #include "chrome/browser/chromeos/login/startup_utils.h" |
| 13 #include "chrome/browser/chromeos/login/test/js_checker.h" |
| 14 #include "chrome/browser/chromeos/login/test/oobe_screen_waiter.h" |
11 #include "chrome/browser/chromeos/login/test/wizard_in_process_browser_test.h" | 15 #include "chrome/browser/chromeos/login/test/wizard_in_process_browser_test.h" |
| 16 #include "chrome/browser/chromeos/login/ui/login_display_host.h" |
| 17 #include "chrome/browser/chromeos/login/ui/webui_login_view.h" |
12 #include "chrome/browser/chromeos/login/wizard_controller.h" | 18 #include "chrome/browser/chromeos/login/wizard_controller.h" |
| 19 #include "chrome/browser/ui/webui/chromeos/login/oobe_screen.h" |
13 #include "chromeos/chromeos_switches.h" | 20 #include "chromeos/chromeos_switches.h" |
14 #include "chromeos/chromeos_test_utils.h" | 21 #include "chromeos/chromeos_test_utils.h" |
15 #include "content/public/test/test_utils.h" | 22 #include "content/public/test/test_utils.h" |
16 #include "testing/gmock/include/gmock/gmock.h" | 23 #include "testing/gmock/include/gmock/gmock.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
18 | 25 |
19 using testing::InvokeWithoutArgs; | 26 using testing::InvokeWithoutArgs; |
20 using testing::Mock; | 27 using testing::Mock; |
21 using testing::_; | 28 using testing::_; |
22 | 29 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 123 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
117 ASSERT_FALSE(enrollment_screen->AdvanceToNextAuth()); | 124 ASSERT_FALSE(enrollment_screen->AdvanceToNextAuth()); |
118 enrollment_screen->OnCancel(); | 125 enrollment_screen->OnCancel(); |
119 content::RunThisRunLoop(&run_loop); | 126 content::RunThisRunLoop(&run_loop); |
120 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); | 127 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); |
121 | 128 |
122 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 129 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
123 WizardController::default_controller(); | 130 WizardController::default_controller(); |
124 } | 131 } |
125 | 132 |
| 133 IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, EnrollmentSpinner) { |
| 134 WizardController* wcontroller = WizardController::default_controller(); |
| 135 ASSERT_TRUE(wcontroller); |
| 136 |
| 137 EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get(wcontroller); |
| 138 ASSERT_TRUE(enrollment_screen); |
| 139 |
| 140 EnrollmentScreenActor* actor = enrollment_screen->GetActor(); |
| 141 ASSERT_TRUE(actor); |
| 142 |
| 143 test::JSChecker checker( |
| 144 LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents()); |
| 145 |
| 146 // Run through the flow |
| 147 actor->Show(); |
| 148 OobeScreenWaiter(OobeScreen::SCREEN_OOBE_ENROLLMENT).Wait(); |
| 149 checker.ExpectTrue( |
| 150 "window.getComputedStyle(document.getElementById('oauth-enroll-step-" |
| 151 "signin')).display !== 'none'"); |
| 152 |
| 153 actor->ShowEnrollmentSpinnerScreen(); |
| 154 checker.ExpectTrue( |
| 155 "window.getComputedStyle(document.getElementById('oauth-enroll-step-" |
| 156 "working')).display !== 'none'"); |
| 157 |
| 158 actor->ShowAttestationBasedEnrollmentSuccessScreen("fake domain"); |
| 159 checker.ExpectTrue( |
| 160 "window.getComputedStyle(document.getElementById('oauth-enroll-step-abe-" |
| 161 "success')).display !== 'none'"); |
| 162 } |
| 163 |
126 class ForcedAttestationAuthEnrollmentScreenTest : public EnrollmentScreenTest { | 164 class ForcedAttestationAuthEnrollmentScreenTest : public EnrollmentScreenTest { |
127 public: | 165 public: |
128 ForcedAttestationAuthEnrollmentScreenTest() {} | 166 ForcedAttestationAuthEnrollmentScreenTest() {} |
129 | 167 |
130 private: | 168 private: |
131 // Overridden from InProcessBrowserTest: | 169 // Overridden from InProcessBrowserTest: |
132 void SetUpCommandLine(base::CommandLine* command_line) override { | 170 void SetUpCommandLine(base::CommandLine* command_line) override { |
133 command_line->AppendSwitchASCII( | 171 command_line->AppendSwitchASCII( |
134 switches::kEnterpriseEnableZeroTouchEnrollment, "forced"); | 172 switches::kEnterpriseEnableZeroTouchEnrollment, "forced"); |
135 } | 173 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
249 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 287 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
250 enrollment_screen->OnCancel(); | 288 enrollment_screen->OnCancel(); |
251 content::RunThisRunLoop(&run_loop); | 289 content::RunThisRunLoop(&run_loop); |
252 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); | 290 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); |
253 | 291 |
254 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 292 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
255 WizardController::default_controller(); | 293 WizardController::default_controller(); |
256 } | 294 } |
257 | 295 |
258 } // namespace chromeos | 296 } // namespace chromeos |
OLD | NEW |