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, TestFlow) { | |
xiyuan
2016/09/16 19:45:15
TestFlow -> EnrollmentSpinner
TestFlow is vague a
kumarniranjan
2016/09/16 20:53:40
Done.
| |
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 checker.set_web_contents( | |
145 LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents()); | |
xiyuan
2016/09/16 19:45:15
Combine L143-145 to:
test::JSChecker checker(
kumarniranjan
2016/09/16 20:53:39
Done.
| |
146 | |
147 // Run through the flow | |
148 actor->Show(); | |
149 OobeScreenWaiter(OobeScreen::SCREEN_OOBE_ENROLLMENT).Wait(); | |
150 checker.ExpectTrue( | |
151 "window.getComputedStyle(document.getElementById('oauth-enroll-step-" | |
152 "signin')).display !== 'none'"); | |
153 | |
154 actor->ShowEnrollmentSpinnerScreen(); | |
155 checker.ExpectTrue( | |
156 "window.getComputedStyle(document.getElementById('oauth-enroll-step-" | |
157 "working')).display !== 'none'"); | |
158 | |
159 actor->ShowAttestationBasedEnrollmentSuccessScreen("fake domain"); | |
160 checker.ExpectTrue( | |
161 "window.getComputedStyle(document.getElementById('oauth-enroll-step-abe-" | |
162 "success')).display !== 'none'"); | |
163 } | |
164 | |
126 class ForcedAttestationAuthEnrollmentScreenTest : public EnrollmentScreenTest { | 165 class ForcedAttestationAuthEnrollmentScreenTest : public EnrollmentScreenTest { |
127 public: | 166 public: |
128 ForcedAttestationAuthEnrollmentScreenTest() {} | 167 ForcedAttestationAuthEnrollmentScreenTest() {} |
129 | 168 |
130 private: | 169 private: |
131 // Overridden from InProcessBrowserTest: | 170 // Overridden from InProcessBrowserTest: |
132 void SetUpCommandLine(base::CommandLine* command_line) override { | 171 void SetUpCommandLine(base::CommandLine* command_line) override { |
133 command_line->AppendSwitchASCII( | 172 command_line->AppendSwitchASCII( |
134 switches::kEnterpriseEnableZeroTouchEnrollment, "forced"); | 173 switches::kEnterpriseEnableZeroTouchEnrollment, "forced"); |
135 } | 174 } |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
249 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 288 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
250 enrollment_screen->OnCancel(); | 289 enrollment_screen->OnCancel(); |
251 content::RunThisRunLoop(&run_loop); | 290 content::RunThisRunLoop(&run_loop); |
252 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); | 291 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); |
253 | 292 |
254 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 293 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
255 WizardController::default_controller(); | 294 WizardController::default_controller(); |
256 } | 295 } |
257 | 296 |
258 } // namespace chromeos | 297 } // namespace chromeos |
OLD | NEW |