Index: chrome/browser/chromeos/login/wizard_controller_browsertest.cc |
diff --git a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc |
index 9bf061832b60775056f8c673d7c6ce5cbe670c88..0e4371b6712de9f7f68e3c7acabfc18d314eaf81 100644 |
--- a/chrome/browser/chromeos/login/wizard_controller_browsertest.cc |
+++ b/chrome/browser/chromeos/login/wizard_controller_browsertest.cc |
@@ -6,8 +6,8 @@ |
#include "chrome/browser/browser_process.h" |
#include "chrome/browser/chromeos/login/account_screen.h" |
#include "chrome/browser/chromeos/login/eula_view.h" |
+#include "chrome/browser/chromeos/login/existing_user_controller.h" |
#include "chrome/browser/chromeos/login/language_switch_menu.h" |
-#include "chrome/browser/chromeos/login/login_screen.h" |
#include "chrome/browser/chromeos/login/mock_update_screen.h" |
#include "chrome/browser/chromeos/login/network_screen.h" |
#include "chrome/browser/chromeos/login/network_selection_view.h" |
@@ -52,12 +52,12 @@ CreateMockWizardScreenHelper<chromeos::NetworkScreen>::Create( |
#define MOCK(mock_var, screen_name, mocked_class) \ |
mock_var = CreateMockWizardScreenHelper<mocked_class>::Create(controller()); \ |
- controller()->screen_name.reset(mock_var); \ |
- EXPECT_CALL(*mock_var, Show()).Times(0); \ |
- EXPECT_CALL(*mock_var, Hide()).Times(0); |
+ controller()->screen_name.reset(mock_var); |
} // namespace |
+using chromeos::ExistingUserController; |
+ |
class WizardControllerTest : public chromeos::WizardInProcessBrowserTest { |
protected: |
WizardControllerTest() : chromeos::WizardInProcessBrowserTest( |
@@ -112,10 +112,17 @@ class WizardControllerFlowTest : public WizardControllerTest { |
// Set up the mocks for all screens. |
MOCK(mock_account_screen_, account_screen_, chromeos::AccountScreen); |
- MOCK(mock_login_screen_, login_screen_, chromeos::LoginScreen); |
+ EXPECT_CALL(*mock_account_screen_, Show()).Times(0); |
+ EXPECT_CALL(*mock_account_screen_, Hide()).Times(0); |
MOCK(mock_network_screen_, network_screen_, chromeos::NetworkScreen); |
+ EXPECT_CALL(*mock_network_screen_, Show()).Times(0); |
+ EXPECT_CALL(*mock_network_screen_, Hide()).Times(0); |
MOCK(mock_update_screen_, update_screen_, MockUpdateScreen); |
+ EXPECT_CALL(*mock_update_screen_, Show()).Times(0); |
+ EXPECT_CALL(*mock_update_screen_, Hide()).Times(0); |
MOCK(mock_eula_screen_, eula_screen_, chromeos::EulaScreen); |
+ EXPECT_CALL(*mock_eula_screen_, Show()).Times(0); |
+ EXPECT_CALL(*mock_eula_screen_, Hide()).Times(0); |
// Switch to the initial screen. |
EXPECT_EQ(NULL, controller()->current_screen()); |
@@ -126,7 +133,6 @@ class WizardControllerFlowTest : public WizardControllerTest { |
} |
MockOutShowHide<chromeos::AccountScreen>* mock_account_screen_; |
- MockOutShowHide<chromeos::LoginScreen>* mock_login_screen_; |
MockOutShowHide<chromeos::NetworkScreen>* mock_network_screen_; |
MockOutShowHide<MockUpdateScreen>* mock_update_screen_; |
MockOutShowHide<chromeos::EulaScreen>* mock_eula_screen_; |
@@ -136,6 +142,7 @@ class WizardControllerFlowTest : public WizardControllerTest { |
}; |
IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowMain) { |
+ EXPECT_TRUE(ExistingUserController::current_controller() == NULL); |
EXPECT_EQ(controller()->GetNetworkScreen(), controller()->current_screen()); |
EXPECT_CALL(*mock_network_screen_, Hide()).Times(1); |
EXPECT_CALL(*mock_eula_screen_, Show()).Times(1); |
@@ -148,23 +155,12 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowMain) { |
controller()->OnExit(chromeos::ScreenObserver::EULA_ACCEPTED); |
EXPECT_EQ(controller()->GetUpdateScreen(), controller()->current_screen()); |
- EXPECT_CALL(*mock_update_screen_, Hide()).Times(1); |
+ EXPECT_CALL(*mock_update_screen_, Hide()).Times(0); |
EXPECT_CALL(*mock_eula_screen_, Show()).Times(0); |
- EXPECT_CALL(*mock_login_screen_, Show()).Times(1); |
controller()->OnExit(chromeos::ScreenObserver::UPDATE_INSTALLED); |
- EXPECT_EQ(controller()->GetLoginScreen(), controller()->current_screen()); |
- EXPECT_CALL(*mock_login_screen_, Hide()).Times(1); |
- EXPECT_CALL(*mock_account_screen_, Show()).Times(1); |
- controller()->OnExit(chromeos::ScreenObserver::LOGIN_CREATE_ACCOUNT); |
- |
- EXPECT_EQ(controller()->GetAccountScreen(), controller()->current_screen()); |
- EXPECT_CALL(*mock_account_screen_, Hide()).Times(1); |
- EXPECT_CALL(*mock_login_screen_, Show()).Times(1); |
- EXPECT_CALL(*mock_login_screen_, Hide()).Times(0); // last transition |
- controller()->OnExit(chromeos::ScreenObserver::ACCOUNT_CREATED); |
- |
- EXPECT_EQ(controller()->GetLoginScreen(), controller()->current_screen()); |
+ EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
+ set_controller(NULL); |
} |
IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowErrorUpdate) { |
@@ -182,14 +178,14 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowErrorUpdate) { |
controller()->OnExit(chromeos::ScreenObserver::EULA_ACCEPTED); |
EXPECT_EQ(controller()->GetUpdateScreen(), controller()->current_screen()); |
- EXPECT_CALL(*mock_update_screen_, Hide()).Times(1); |
+ EXPECT_CALL(*mock_update_screen_, Hide()).Times(0); |
EXPECT_CALL(*mock_eula_screen_, Show()).Times(0); |
EXPECT_CALL(*mock_eula_screen_, Hide()).Times(0); // last transition |
- EXPECT_CALL(*mock_login_screen_, Show()).Times(1); |
controller()->OnExit( |
chromeos::ScreenObserver::UPDATE_ERROR_UPDATING); |
- EXPECT_EQ(controller()->GetLoginScreen(), controller()->current_screen()); |
+ EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
+ set_controller(NULL); |
} |
IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowEulaDeclined) { |
@@ -210,14 +206,14 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowEulaDeclined) { |
IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, ControlFlowErrorNetwork) { |
EXPECT_EQ(controller()->GetNetworkScreen(), controller()->current_screen()); |
- EXPECT_CALL(*mock_login_screen_, Show()).Times(1); |
- EXPECT_CALL(*mock_network_screen_, Hide()).Times(1); |
controller()->OnExit(chromeos::ScreenObserver::NETWORK_OFFLINE); |
- EXPECT_EQ(controller()->GetLoginScreen(), controller()->current_screen()); |
+ |
+ EXPECT_FALSE(ExistingUserController::current_controller() == NULL); |
+ set_controller(NULL); |
} |
#if defined(OFFICIAL_BUILD) |
-// This test is supposed to fail on official test. |
+// This test is supposed to fail on official build. |
#define MAYBE_Accelerators DISABLED_Accelerators |
#else |
#define MAYBE_Accelerators Accelerators |
@@ -229,7 +225,6 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, MAYBE_Accelerators) { |
views::FocusManager* focus_manager = |
controller()->contents()->GetFocusManager(); |
views::Accelerator accel_account_screen(app::VKEY_A, false, true, true); |
- views::Accelerator accel_login_screen(app::VKEY_L, false, true, true); |
views::Accelerator accel_network_screen(app::VKEY_N, false, true, true); |
views::Accelerator accel_update_screen(app::VKEY_U, false, true, true); |
views::Accelerator accel_image_screen(app::VKEY_I, false, true, true); |
@@ -242,12 +237,6 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, MAYBE_Accelerators) { |
focus_manager = controller()->contents()->GetFocusManager(); |
EXPECT_CALL(*mock_account_screen_, Hide()).Times(1); |
- EXPECT_CALL(*mock_login_screen_, Show()).Times(1); |
- EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_login_screen)); |
- EXPECT_EQ(controller()->GetLoginScreen(), controller()->current_screen()); |
- |
- focus_manager = controller()->contents()->GetFocusManager(); |
- EXPECT_CALL(*mock_login_screen_, Hide()).Times(1); |
EXPECT_CALL(*mock_network_screen_, Show()).Times(1); |
EXPECT_TRUE(focus_manager->ProcessAccelerator(accel_network_screen)); |
EXPECT_EQ(controller()->GetNetworkScreen(), controller()->current_screen()); |
@@ -269,5 +258,5 @@ IN_PROC_BROWSER_TEST_F(WizardControllerFlowTest, MAYBE_Accelerators) { |
EXPECT_EQ(controller()->GetEulaScreen(), controller()->current_screen()); |
} |
-COMPILE_ASSERT(chromeos::ScreenObserver::EXIT_CODES_COUNT == 18, |
+COMPILE_ASSERT(chromeos::ScreenObserver::EXIT_CODES_COUNT == 15, |
add_tests_for_new_control_flow_you_just_introduced); |