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

Side by Side Diff: chrome/browser/chromeos/login/wizard_controller_browsertest.cc

Issue 2676383002: cros: ensure update check to complete at OOBE before allowing login (Closed)
Patch Set: cros: ensure update check to complete at OOBE before allowing login Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "chrome/browser/chromeos/login/wizard_controller.h" 5 #include "chrome/browser/chromeos/login/wizard_controller.h"
6 6
7 #include "ash/common/accessibility_types.h" 7 #include "ash/common/accessibility_types.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 574 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 EXPECT_EQ("ethernet,wifi,cellular", 585 EXPECT_EQ("ethernet,wifi,cellular",
586 NetworkHandler::Get()->network_state_handler() 586 NetworkHandler::Get()->network_state_handler()
587 ->GetCheckPortalListForTest()); 587 ->GetCheckPortalListForTest());
588 588
589 WaitUntilTimezoneResolved(); 589 WaitUntilTimezoneResolved();
590 EXPECT_EQ("America/Anchorage", 590 EXPECT_EQ("America/Anchorage",
591 base::UTF16ToUTF8(chromeos::system::TimezoneSettings::GetInstance() 591 base::UTF16ToUTF8(chromeos::system::TimezoneSettings::GetInstance()
592 ->GetCurrentTimezoneID())); 592 ->GetCurrentTimezoneID()));
593 } 593 }
594 594
595 // This test verifies that if WizardController fails to check for update before
596 // the OOBE is marked complete, it goes back the network selection screen and
597 // thus prevents the user from proceeding to log in.
598 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest,
599 ControlFlowErrorCheckingForUpdate) {
600 CheckCurrentScreen(OobeScreen::SCREEN_OOBE_NETWORK);
601 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0);
602 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1);
603 EXPECT_CALL(*mock_update_screen_, Show()).Times(0);
604 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1);
605 OnExit(*mock_network_screen_, BaseScreenDelegate::NETWORK_CONNECTED);
606
607 CheckCurrentScreen(OobeScreen::SCREEN_OOBE_EULA);
608 EXPECT_CALL(*mock_eula_screen_, Hide()).Times(1);
609 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(1);
610 EXPECT_CALL(*mock_update_screen_, Show()).Times(1);
611 OnExit(*mock_eula_screen_, BaseScreenDelegate::EULA_ACCEPTED);
612
613 // Let update screen smooth time process (time = 0ms).
614 content::RunAllPendingInMessageLoop();
615
616 CheckCurrentScreen(OobeScreen::SCREEN_OOBE_UPDATE);
617 EXPECT_CALL(*mock_update_screen_, Hide()).Times(1);
618 EXPECT_CALL(*mock_eula_screen_, Show()).Times(0);
619 EXPECT_CALL(*mock_auto_enrollment_check_screen_, Show()).Times(0);
620 EXPECT_CALL(*mock_network_screen_, Show()).Times(1);
621 EXPECT_CALL(*mock_network_screen_, Hide()).Times(0); // last transition
622 OnExit(*mock_update_screen_,
623 BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE);
624 CheckCurrentScreen(OobeScreen::SCREEN_OOBE_NETWORK);
625 }
626
595 // This test verifies that if WizardController fails to apply a non-critical 627 // This test verifies that if WizardController fails to apply a non-critical
596 // update before the OOBE is marked complete, it allows the user to proceed to 628 // update before the OOBE is marked complete, it allows the user to proceed to
597 // log in. 629 // log in.
598 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, 630 IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest,
599 ControlFlowErrorUpdateNonCriticalUpdate) { 631 ControlFlowErrorUpdateNonCriticalUpdate) {
600 CheckCurrentScreen(OobeScreen::SCREEN_OOBE_NETWORK); 632 CheckCurrentScreen(OobeScreen::SCREEN_OOBE_NETWORK);
601 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0); 633 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0);
602 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1); 634 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1);
603 EXPECT_CALL(*mock_update_screen_, Show()).Times(0); 635 EXPECT_CALL(*mock_update_screen_, Show()).Times(0);
604 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1); 636 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
760 792
761 void SetUpOnMainThread() override { 793 void SetUpOnMainThread() override {
762 StartupUtils::MarkOobeCompleted(); // Pretend OOBE was complete. 794 StartupUtils::MarkOobeCompleted(); // Pretend OOBE was complete.
763 WizardControllerFlowTest::SetUpOnMainThread(); 795 WizardControllerFlowTest::SetUpOnMainThread();
764 } 796 }
765 797
766 private: 798 private:
767 DISALLOW_COPY_AND_ASSIGN(WizardControllerErrorUpdateAfterCompletedOobeTest); 799 DISALLOW_COPY_AND_ASSIGN(WizardControllerErrorUpdateAfterCompletedOobeTest);
768 }; 800 };
769 801
770 // This test verifies that if WizardController fails to apply an update, either 802 // This test verifies that if WizardController fails to check for update or
771 // critical or non-critical, after the OOBE is marked complete, it allows the 803 // apply an update (either critical or non-critical) after the OOBE is marked
772 // user to proceed to log in. 804 // complete, it allows the user to proceed to log in.
773 IN_PROC_BROWSER_TEST_P(WizardControllerErrorUpdateAfterCompletedOobeTest, 805 IN_PROC_BROWSER_TEST_P(WizardControllerErrorUpdateAfterCompletedOobeTest,
774 ControlFlowErrorUpdate) { 806 ControlFlowErrorUpdate) {
775 const BaseScreenDelegate::ExitCodes update_screen_exit_code = GetParam(); 807 const BaseScreenDelegate::ExitCodes update_screen_exit_code = GetParam();
776 CheckCurrentScreen(OobeScreen::SCREEN_OOBE_NETWORK); 808 CheckCurrentScreen(OobeScreen::SCREEN_OOBE_NETWORK);
777 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0); 809 EXPECT_CALL(*mock_update_screen_, StartNetworkCheck()).Times(0);
778 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1); 810 EXPECT_CALL(*mock_eula_screen_, Show()).Times(1);
779 EXPECT_CALL(*mock_update_screen_, Show()).Times(0); 811 EXPECT_CALL(*mock_update_screen_, Show()).Times(0);
780 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1); 812 EXPECT_CALL(*mock_network_screen_, Hide()).Times(1);
781 OnExit(*mock_network_screen_, BaseScreenDelegate::NETWORK_CONNECTED); 813 OnExit(*mock_network_screen_, BaseScreenDelegate::NETWORK_CONNECTED);
782 814
(...skipping 16 matching lines...) Expand all
799 EXPECT_CALL(*mock_eula_screen_, Show()).Times(0); 831 EXPECT_CALL(*mock_eula_screen_, Show()).Times(0);
800 OnExit(*mock_auto_enrollment_check_screen_, 832 OnExit(*mock_auto_enrollment_check_screen_,
801 BaseScreenDelegate::ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED); 833 BaseScreenDelegate::ENTERPRISE_AUTO_ENROLLMENT_CHECK_COMPLETED);
802 834
803 EXPECT_NE(nullptr, ExistingUserController::current_controller()); 835 EXPECT_NE(nullptr, ExistingUserController::current_controller());
804 } 836 }
805 837
806 INSTANTIATE_TEST_CASE_P( 838 INSTANTIATE_TEST_CASE_P(
807 WizardControllerErrorUpdateAfterCompletedOobe, 839 WizardControllerErrorUpdateAfterCompletedOobe,
808 WizardControllerErrorUpdateAfterCompletedOobeTest, 840 WizardControllerErrorUpdateAfterCompletedOobeTest,
809 testing::Values(BaseScreenDelegate::UPDATE_ERROR_UPDATING, 841 testing::Values(BaseScreenDelegate::UPDATE_ERROR_CHECKING_FOR_UPDATE,
842 BaseScreenDelegate::UPDATE_ERROR_UPDATING,
810 BaseScreenDelegate::UPDATE_ERROR_UPDATING_CRITICAL_UPDATE)); 843 BaseScreenDelegate::UPDATE_ERROR_UPDATING_CRITICAL_UPDATE));
811 844
812 class WizardControllerDeviceStateTest : public WizardControllerFlowTest { 845 class WizardControllerDeviceStateTest : public WizardControllerFlowTest {
813 protected: 846 protected:
814 WizardControllerDeviceStateTest() 847 WizardControllerDeviceStateTest()
815 : install_attributes_(ScopedStubInstallAttributes::CreateUnset()) { 848 : install_attributes_(ScopedStubInstallAttributes::CreateUnset()) {
816 fake_statistics_provider_.SetMachineStatistic( 849 fake_statistics_provider_.SetMachineStatistic(
817 system::kSerialNumberKey, "test"); 850 system::kSerialNumberKey, "test");
818 fake_statistics_provider_.SetMachineStatistic( 851 fake_statistics_provider_.SetMachineStatistic(
819 system::kActivateDateKey, "2000-01"); 852 system::kActivateDateKey, "2000-01");
(...skipping 490 matching lines...) Expand 10 before | Expand all | Expand 10 after
1310 1343
1311 // TODO(dzhioev): Add tests for controller/host pairing flow. 1344 // TODO(dzhioev): Add tests for controller/host pairing flow.
1312 // http://crbug.com/375191 1345 // http://crbug.com/375191
1313 1346
1314 // TODO(khmel): Add tests for Arc OptIn flow. 1347 // TODO(khmel): Add tests for Arc OptIn flow.
1315 // http://crbug.com/651144 1348 // http://crbug.com/651144
1316 static_assert(BaseScreenDelegate::EXIT_CODES_COUNT == 25, 1349 static_assert(BaseScreenDelegate::EXIT_CODES_COUNT == 25,
1317 "tests for new control flow are missing"); 1350 "tests for new control flow are missing");
1318 1351
1319 } // namespace chromeos 1352 } // namespace chromeos
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/wizard_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698