Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4206)

Unified Diff: chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc

Issue 2186623002: Minimal attestation-based enrollment flow. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made ZTE independent of enterprise enrollment. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc
diff --git a/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc b/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc
index 33e02491362936a751241f29f24d1c6b0cb4b6c4..861220e6650195757f348ef9137226f135b8db16 100644
--- a/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc
+++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc
@@ -83,6 +83,95 @@ IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, DISABLED_TestSuccess) {
WizardController::default_controller();
}
+class MultiAuthEnrollmentScreenTest : public EnrollmentScreenTest {
+ public:
+ MultiAuthEnrollmentScreenTest() {}
+
+ private:
+ // Overridden from InProcessBrowserTest:
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ command_line->AppendSwitch(switches::kEnterpriseEnableZeroTouchEnrollment);
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(MultiAuthEnrollmentScreenTest);
+};
+
+IN_PROC_BROWSER_TEST_F(MultiAuthEnrollmentScreenTest, TestCancel) {
+ ASSERT_TRUE(WizardController::default_controller() != NULL);
+
+ EnrollmentScreen* enrollment_screen =
+ EnrollmentScreen::Get(WizardController::default_controller());
+ ASSERT_TRUE(enrollment_screen != NULL);
+
+ base::RunLoop run_loop;
+ MockBaseScreenDelegate mock_base_screen_delegate;
+ static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ =
+ &mock_base_screen_delegate;
+
+ ASSERT_EQ(WizardController::default_controller()->current_screen(),
+ enrollment_screen);
+
+ EXPECT_CALL(mock_base_screen_delegate,
+ OnExit(_, BaseScreenDelegate::ENTERPRISE_ENROLLMENT_COMPLETED, _))
+ .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
+ ASSERT_EQ(EnrollmentScreen::AUTH_OAUTH, enrollment_screen->last_auth_);
+ ASSERT_EQ(EnrollmentScreen::AUTH_ATTESTATION,
+ enrollment_screen->current_auth_);
+ ASSERT_TRUE(enrollment_screen->AdvanceToNextAuth());
+ ASSERT_EQ(EnrollmentScreen::AUTH_OAUTH, enrollment_screen->current_auth_);
+ enrollment_screen->OnCancel();
+ content::RunThisRunLoop(&run_loop);
+ Mock::VerifyAndClearExpectations(&mock_base_screen_delegate);
+
+ static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ =
+ WizardController::default_controller();
+}
+
+class AttestationAuthEnrollmentScreenTest : public EnrollmentScreenTest {
+ public:
+ AttestationAuthEnrollmentScreenTest() {}
+
+ private:
+ // Overridden from InProcessBrowserTest:
+ void SetUpCommandLine(base::CommandLine* command_line) override {
+ command_line->AppendSwitchASCII(
+ switches::kEnterpriseEnableZeroTouchEnrollment, "forced");
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(AttestationAuthEnrollmentScreenTest);
+};
+
+IN_PROC_BROWSER_TEST_F(AttestationAuthEnrollmentScreenTest, TestCancel) {
+ ASSERT_TRUE(WizardController::default_controller() != NULL);
+
+ EnrollmentScreen* enrollment_screen =
+ EnrollmentScreen::Get(WizardController::default_controller());
+ ASSERT_TRUE(enrollment_screen != NULL);
+
+ base::RunLoop run_loop;
+ MockBaseScreenDelegate mock_base_screen_delegate;
+ static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ =
+ &mock_base_screen_delegate;
+
+ ASSERT_EQ(WizardController::default_controller()->current_screen(),
+ enrollment_screen);
+
+ EXPECT_CALL(mock_base_screen_delegate,
+ OnExit(_, BaseScreenDelegate::ENTERPRISE_ENROLLMENT_BACK, _))
+ .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit));
+ ASSERT_EQ(EnrollmentScreen::AUTH_ATTESTATION, enrollment_screen->last_auth_);
+ ASSERT_EQ(EnrollmentScreen::AUTH_ATTESTATION,
+ enrollment_screen->current_auth_);
+ enrollment_screen->OnCancel();
+ ASSERT_EQ(EnrollmentScreen::AUTH_ATTESTATION,
+ enrollment_screen->current_auth_);
+ content::RunThisRunLoop(&run_loop);
+ Mock::VerifyAndClearExpectations(&mock_base_screen_delegate);
+
+ static_cast<BaseScreen*>(enrollment_screen)->base_screen_delegate_ =
+ WizardController::default_controller();
+}
+
class ProvisionedEnrollmentScreenTest : public EnrollmentScreenTest {
public:
ProvisionedEnrollmentScreenTest() {}

Powered by Google App Engine
This is Rietveld 408576698