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/logging.h" |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #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" | 10 #include "chrome/browser/chromeos/login/enrollment/mock_enrollment_screen.h" |
(...skipping 23 matching lines...) Expand all Loading... |
34 EnrollmentScreenTest() | 34 EnrollmentScreenTest() |
35 : WizardInProcessBrowserTest(OobeScreen::SCREEN_OOBE_ENROLLMENT) {} | 35 : WizardInProcessBrowserTest(OobeScreen::SCREEN_OOBE_ENROLLMENT) {} |
36 | 36 |
37 private: | 37 private: |
38 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenTest); | 38 DISALLOW_COPY_AND_ASSIGN(EnrollmentScreenTest); |
39 }; | 39 }; |
40 | 40 |
41 IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, TestCancel) { | 41 IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, TestCancel) { |
42 ASSERT_TRUE(WizardController::default_controller()); | 42 ASSERT_TRUE(WizardController::default_controller()); |
43 | 43 |
44 EnrollmentScreen* enrollment_screen = | 44 EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get( |
45 EnrollmentScreen::Get(WizardController::default_controller()); | 45 WizardController::default_controller()->screen_manager()); |
46 ASSERT_TRUE(enrollment_screen); | 46 ASSERT_TRUE(enrollment_screen); |
47 | 47 |
48 base::RunLoop run_loop; | 48 base::RunLoop run_loop; |
49 MockBaseScreenDelegate mock_base_screen_delegate; | 49 MockBaseScreenDelegate mock_base_screen_delegate; |
50 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 50 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
51 &mock_base_screen_delegate; | 51 &mock_base_screen_delegate; |
52 | 52 |
53 ASSERT_EQ(WizardController::default_controller()->current_screen(), | 53 ASSERT_EQ(WizardController::default_controller()->current_screen(), |
54 enrollment_screen); | 54 enrollment_screen); |
55 | 55 |
56 EXPECT_CALL(mock_base_screen_delegate, | 56 EXPECT_CALL(mock_base_screen_delegate, |
57 OnExit(_, ScreenExitCode::ENTERPRISE_ENROLLMENT_COMPLETED, _)) | 57 OnExit(_, ScreenExitCode::ENTERPRISE_ENROLLMENT_COMPLETED, _)) |
58 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 58 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
59 enrollment_screen->OnCancel(); | 59 enrollment_screen->OnCancel(); |
60 content::RunThisRunLoop(&run_loop); | 60 content::RunThisRunLoop(&run_loop); |
61 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); | 61 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); |
62 | 62 |
63 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 63 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
64 WizardController::default_controller(); | 64 WizardController::default_controller(); |
65 } | 65 } |
66 | 66 |
67 // Flaky test: crbug.com/394069 | 67 // Flaky test: crbug.com/394069 |
68 IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, DISABLED_TestSuccess) { | 68 IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, DISABLED_TestSuccess) { |
69 ASSERT_TRUE(WizardController::default_controller()); | 69 ASSERT_TRUE(WizardController::default_controller()); |
70 EXPECT_FALSE(StartupUtils::IsOobeCompleted()); | 70 EXPECT_FALSE(StartupUtils::IsOobeCompleted()); |
71 | 71 |
72 EnrollmentScreen* enrollment_screen = | 72 EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get( |
73 EnrollmentScreen::Get(WizardController::default_controller()); | 73 WizardController::default_controller()->screen_manager()); |
74 ASSERT_TRUE(enrollment_screen); | 74 ASSERT_TRUE(enrollment_screen); |
75 | 75 |
76 base::RunLoop run_loop; | 76 base::RunLoop run_loop; |
77 MockBaseScreenDelegate mock_base_screen_delegate; | 77 MockBaseScreenDelegate mock_base_screen_delegate; |
78 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 78 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
79 &mock_base_screen_delegate; | 79 &mock_base_screen_delegate; |
80 | 80 |
81 ASSERT_EQ(WizardController::default_controller()->current_screen(), | 81 ASSERT_EQ(WizardController::default_controller()->current_screen(), |
82 enrollment_screen); | 82 enrollment_screen); |
83 | 83 |
(...skipping 14 matching lines...) Expand all Loading... |
98 void SetUpCommandLine(base::CommandLine* command_line) override { | 98 void SetUpCommandLine(base::CommandLine* command_line) override { |
99 command_line->AppendSwitch(switches::kEnterpriseEnableZeroTouchEnrollment); | 99 command_line->AppendSwitch(switches::kEnterpriseEnableZeroTouchEnrollment); |
100 } | 100 } |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(AttestationAuthEnrollmentScreenTest); | 102 DISALLOW_COPY_AND_ASSIGN(AttestationAuthEnrollmentScreenTest); |
103 }; | 103 }; |
104 | 104 |
105 IN_PROC_BROWSER_TEST_F(AttestationAuthEnrollmentScreenTest, TestCancel) { | 105 IN_PROC_BROWSER_TEST_F(AttestationAuthEnrollmentScreenTest, TestCancel) { |
106 ASSERT_TRUE(WizardController::default_controller()); | 106 ASSERT_TRUE(WizardController::default_controller()); |
107 | 107 |
108 EnrollmentScreen* enrollment_screen = | 108 EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get( |
109 EnrollmentScreen::Get(WizardController::default_controller()); | 109 WizardController::default_controller()->screen_manager()); |
110 ASSERT_TRUE(enrollment_screen); | 110 ASSERT_TRUE(enrollment_screen); |
111 | 111 |
112 base::RunLoop run_loop; | 112 base::RunLoop run_loop; |
113 MockBaseScreenDelegate mock_base_screen_delegate; | 113 MockBaseScreenDelegate mock_base_screen_delegate; |
114 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 114 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
115 &mock_base_screen_delegate; | 115 &mock_base_screen_delegate; |
116 | 116 |
117 ASSERT_EQ(WizardController::default_controller()->current_screen(), | 117 ASSERT_EQ(WizardController::default_controller()->current_screen(), |
118 enrollment_screen); | 118 enrollment_screen); |
119 | 119 |
120 EXPECT_CALL(mock_base_screen_delegate, | 120 EXPECT_CALL(mock_base_screen_delegate, |
121 OnExit(_, ScreenExitCode::ENTERPRISE_ENROLLMENT_COMPLETED, _)) | 121 OnExit(_, ScreenExitCode::ENTERPRISE_ENROLLMENT_COMPLETED, _)) |
122 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 122 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
123 ASSERT_FALSE(enrollment_screen->AdvanceToNextAuth()); | 123 ASSERT_FALSE(enrollment_screen->AdvanceToNextAuth()); |
124 enrollment_screen->OnCancel(); | 124 enrollment_screen->OnCancel(); |
125 content::RunThisRunLoop(&run_loop); | 125 content::RunThisRunLoop(&run_loop); |
126 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); | 126 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); |
127 | 127 |
128 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 128 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
129 WizardController::default_controller(); | 129 WizardController::default_controller(); |
130 } | 130 } |
131 | 131 |
132 IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, EnrollmentSpinner) { | 132 IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, EnrollmentSpinner) { |
133 WizardController* wcontroller = WizardController::default_controller(); | 133 WizardController* wcontroller = WizardController::default_controller(); |
134 ASSERT_TRUE(wcontroller); | 134 ASSERT_TRUE(wcontroller); |
135 | 135 |
136 EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get(wcontroller); | 136 EnrollmentScreen* enrollment_screen = |
| 137 EnrollmentScreen::Get(wcontroller->screen_manager()); |
137 ASSERT_TRUE(enrollment_screen); | 138 ASSERT_TRUE(enrollment_screen); |
138 | 139 |
139 EnrollmentScreenView* view = enrollment_screen->GetView(); | 140 EnrollmentScreenView* view = enrollment_screen->GetView(); |
140 ASSERT_TRUE(view); | 141 ASSERT_TRUE(view); |
141 | 142 |
142 test::JSChecker checker( | 143 test::JSChecker checker( |
143 LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents()); | 144 LoginDisplayHost::default_host()->GetWebUILoginView()->GetWebContents()); |
144 | 145 |
145 // Run through the flow | 146 // Run through the flow |
146 view->Show(); | 147 view->Show(); |
(...skipping 23 matching lines...) Expand all Loading... |
170 command_line->AppendSwitchASCII( | 171 command_line->AppendSwitchASCII( |
171 switches::kEnterpriseEnableZeroTouchEnrollment, "forced"); | 172 switches::kEnterpriseEnableZeroTouchEnrollment, "forced"); |
172 } | 173 } |
173 | 174 |
174 DISALLOW_COPY_AND_ASSIGN(ForcedAttestationAuthEnrollmentScreenTest); | 175 DISALLOW_COPY_AND_ASSIGN(ForcedAttestationAuthEnrollmentScreenTest); |
175 }; | 176 }; |
176 | 177 |
177 IN_PROC_BROWSER_TEST_F(ForcedAttestationAuthEnrollmentScreenTest, TestCancel) { | 178 IN_PROC_BROWSER_TEST_F(ForcedAttestationAuthEnrollmentScreenTest, TestCancel) { |
178 ASSERT_TRUE(WizardController::default_controller()); | 179 ASSERT_TRUE(WizardController::default_controller()); |
179 | 180 |
180 EnrollmentScreen* enrollment_screen = | 181 EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get( |
181 EnrollmentScreen::Get(WizardController::default_controller()); | 182 WizardController::default_controller()->screen_manager()); |
182 ASSERT_TRUE(enrollment_screen); | 183 ASSERT_TRUE(enrollment_screen); |
183 | 184 |
184 base::RunLoop run_loop; | 185 base::RunLoop run_loop; |
185 MockBaseScreenDelegate mock_base_screen_delegate; | 186 MockBaseScreenDelegate mock_base_screen_delegate; |
186 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 187 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
187 &mock_base_screen_delegate; | 188 &mock_base_screen_delegate; |
188 | 189 |
189 ASSERT_EQ(WizardController::default_controller()->current_screen(), | 190 ASSERT_EQ(WizardController::default_controller()->current_screen(), |
190 enrollment_screen); | 191 enrollment_screen); |
191 | 192 |
(...skipping 25 matching lines...) Expand all Loading... |
217 switches::kAppOemManifestFile, | 218 switches::kAppOemManifestFile, |
218 test_data_dir.AppendASCII("kiosk_manifest.json")); | 219 test_data_dir.AppendASCII("kiosk_manifest.json")); |
219 } | 220 } |
220 | 221 |
221 DISALLOW_COPY_AND_ASSIGN(MultiAuthEnrollmentScreenTest); | 222 DISALLOW_COPY_AND_ASSIGN(MultiAuthEnrollmentScreenTest); |
222 }; | 223 }; |
223 | 224 |
224 IN_PROC_BROWSER_TEST_F(MultiAuthEnrollmentScreenTest, TestCancel) { | 225 IN_PROC_BROWSER_TEST_F(MultiAuthEnrollmentScreenTest, TestCancel) { |
225 ASSERT_TRUE(WizardController::default_controller()); | 226 ASSERT_TRUE(WizardController::default_controller()); |
226 | 227 |
227 EnrollmentScreen* enrollment_screen = | 228 EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get( |
228 EnrollmentScreen::Get(WizardController::default_controller()); | 229 WizardController::default_controller()->screen_manager()); |
229 ASSERT_TRUE(enrollment_screen); | 230 ASSERT_TRUE(enrollment_screen); |
230 | 231 |
231 base::RunLoop run_loop; | 232 base::RunLoop run_loop; |
232 MockBaseScreenDelegate mock_base_screen_delegate; | 233 MockBaseScreenDelegate mock_base_screen_delegate; |
233 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 234 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
234 &mock_base_screen_delegate; | 235 &mock_base_screen_delegate; |
235 | 236 |
236 ASSERT_EQ(WizardController::default_controller()->current_screen(), | 237 ASSERT_EQ(WizardController::default_controller()->current_screen(), |
237 enrollment_screen); | 238 enrollment_screen); |
238 | 239 |
(...skipping 23 matching lines...) Expand all Loading... |
262 switches::kAppOemManifestFile, | 263 switches::kAppOemManifestFile, |
263 test_data_dir.AppendASCII("kiosk_manifest.json")); | 264 test_data_dir.AppendASCII("kiosk_manifest.json")); |
264 } | 265 } |
265 | 266 |
266 DISALLOW_COPY_AND_ASSIGN(ProvisionedEnrollmentScreenTest); | 267 DISALLOW_COPY_AND_ASSIGN(ProvisionedEnrollmentScreenTest); |
267 }; | 268 }; |
268 | 269 |
269 IN_PROC_BROWSER_TEST_F(ProvisionedEnrollmentScreenTest, TestBackButton) { | 270 IN_PROC_BROWSER_TEST_F(ProvisionedEnrollmentScreenTest, TestBackButton) { |
270 ASSERT_TRUE(WizardController::default_controller()); | 271 ASSERT_TRUE(WizardController::default_controller()); |
271 | 272 |
272 EnrollmentScreen* enrollment_screen = | 273 EnrollmentScreen* enrollment_screen = EnrollmentScreen::Get( |
273 EnrollmentScreen::Get(WizardController::default_controller()); | 274 WizardController::default_controller()->screen_manager()); |
274 ASSERT_TRUE(enrollment_screen); | 275 ASSERT_TRUE(enrollment_screen); |
275 | 276 |
276 base::RunLoop run_loop; | 277 base::RunLoop run_loop; |
277 MockBaseScreenDelegate mock_base_screen_delegate; | 278 MockBaseScreenDelegate mock_base_screen_delegate; |
278 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 279 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
279 &mock_base_screen_delegate; | 280 &mock_base_screen_delegate; |
280 | 281 |
281 ASSERT_EQ(WizardController::default_controller()->current_screen(), | 282 ASSERT_EQ(WizardController::default_controller()->current_screen(), |
282 enrollment_screen); | 283 enrollment_screen); |
283 | 284 |
284 EXPECT_CALL(mock_base_screen_delegate, | 285 EXPECT_CALL(mock_base_screen_delegate, |
285 OnExit(_, ScreenExitCode::ENTERPRISE_ENROLLMENT_BACK, _)) | 286 OnExit(_, ScreenExitCode::ENTERPRISE_ENROLLMENT_BACK, _)) |
286 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); | 287 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
287 enrollment_screen->OnCancel(); | 288 enrollment_screen->OnCancel(); |
288 content::RunThisRunLoop(&run_loop); | 289 content::RunThisRunLoop(&run_loop); |
289 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); | 290 Mock::VerifyAndClearExpectations(&mock_base_screen_delegate); |
290 | 291 |
291 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = | 292 static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ = |
292 WizardController::default_controller(); | 293 WizardController::default_controller(); |
293 } | 294 } |
294 | 295 |
295 } // namespace chromeos | 296 } // namespace chromeos |
OLD | NEW |