Chromium Code Reviews| 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..890c9cb054bf8d5bb12b160dc2f896834fd0d356 100644 |
| --- a/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc |
| +++ b/chrome/browser/chromeos/login/enrollment/enrollment_screen_browsertest.cc |
| @@ -83,6 +83,134 @@ IN_PROC_BROWSER_TEST_F(EnrollmentScreenTest, DISABLED_TestSuccess) { |
| WizardController::default_controller(); |
| } |
| +class AttestationAuthEnrollmentScreenTest : public EnrollmentScreenTest { |
| + public: |
| + AttestationAuthEnrollmentScreenTest() {} |
| + |
| + private: |
| + // Overridden from InProcessBrowserTest: |
| + void SetUpCommandLine(base::CommandLine* command_line) override { |
| + command_line->AppendSwitch(switches::kEnterpriseEnableZeroTouchEnrollment); |
| + } |
| + |
| + DISALLOW_COPY_AND_ASSIGN(AttestationAuthEnrollmentScreenTest); |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(AttestationAuthEnrollmentScreenTest, TestCancel) { |
| + ASSERT_TRUE(WizardController::default_controller() != NULL); |
|
achuithb
2016/08/23 18:16:44
either nullptr, or drop the comparison. Here and b
The one and only Dr. Crash
2016/08/23 21:24:18
Done.
|
| + |
| + 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_FALSE(enrollment_screen->AdvanceToNextAuth()); |
| + 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 ForcedAttestationAuthEnrollmentScreenTest : public EnrollmentScreenTest { |
| + public: |
| + ForcedAttestationAuthEnrollmentScreenTest() {} |
| + |
| + private: |
| + // Overridden from InProcessBrowserTest: |
| + void SetUpCommandLine(base::CommandLine* command_line) override { |
| + command_line->AppendSwitchASCII( |
| + switches::kEnterpriseEnableZeroTouchEnrollment, "forced"); |
| + } |
| + |
| + DISALLOW_COPY_AND_ASSIGN(ForcedAttestationAuthEnrollmentScreenTest); |
| +}; |
| + |
| +IN_PROC_BROWSER_TEST_F(ForcedAttestationAuthEnrollmentScreenTest, 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_FALSE(enrollment_screen->AdvanceToNextAuth()); |
| + 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 MultiAuthEnrollmentScreenTest : public EnrollmentScreenTest { |
| + public: |
| + MultiAuthEnrollmentScreenTest() {} |
| + |
| + private: |
| + // Overridden from InProcessBrowserTest: |
| + void SetUpCommandLine(base::CommandLine* command_line) override { |
| + command_line->AppendSwitch(switches::kEnterpriseEnableZeroTouchEnrollment); |
| + // Kiosk mode will force OAuth enrollment. |
| + base::FilePath test_data_dir; |
| + ASSERT_TRUE(chromeos::test_utils::GetTestDataPath( |
| + "app_mode", "kiosk_manifest", &test_data_dir)); |
| + command_line->AppendSwitchPath( |
| + switches::kAppOemManifestFile, |
| + test_data_dir.AppendASCII("kiosk_manifest.json")); |
| + } |
| + |
| + 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_BACK, _)) |
| + .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| + ASSERT_TRUE(enrollment_screen->AdvanceToNextAuth()); |
| + 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 ProvisionedEnrollmentScreenTest : public EnrollmentScreenTest { |
| public: |
| ProvisionedEnrollmentScreenTest() {} |