// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "ash/session/session_state_delegate.h"
+#include "ash/shell.h"
#include "base/prefs/pref_service.h"
#include "chrome/browser/chromeos/login/login_display_host_impl.h"
#include "chrome/browser/chromeos/login/login_manager_test.h"
EXPECT_EQ(3u, UserManager::Get()->GetUsers().size());
EXPECT_EQ(0u, UserManager::Get()->GetLoggedInUsers().size());
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
+
LoginUser(kTestUsers[0]);
EXPECT_EQ(1u, UserManager::Get()->GetLoggedInUsers().size());
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
UserAddingScreen::Get()->Start();
content::RunAllPendingInMessageLoop();
EXPECT_EQ(1, user_adding_started());
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
UserAddingScreen::Get()->Cancel();
content::RunAllPendingInMessageLoop();
EXPECT_EQ(1, user_adding_finished());
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
EXPECT_TRUE(LoginDisplayHostImpl::default_host() == NULL);
EXPECT_EQ(1u, UserManager::Get()->GetLoggedInUsers().size());
}
IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, AddingSeveralUsers) {
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_PRIMARY,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
EXPECT_CALL(login_utils(), DoBrowserLaunch(_, _)).Times(3);
LoginUser(kTestUsers[0]);
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
+
UserManager* user_manager = UserManager::Get();
+
for (int i = 1; i < 3; ++i) {
UserAddingScreen::Get()->Start();
content::RunAllPendingInMessageLoop();
EXPECT_EQ(i, user_adding_started());
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
AddUser(kTestUsers[i]);
EXPECT_EQ(i, user_adding_finished());
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
EXPECT_TRUE(LoginDisplayHostImpl::default_host() == NULL);
ASSERT_EQ(unsigned(i + 1), user_manager->GetLoggedInUsers().size());
}
+ EXPECT_EQ(ash::SessionStateDelegate::SESSION_STATE_ACTIVE,
+ ash::Shell::GetInstance()->session_state_delegate()->
+ GetSessionState());
+
// Now check how unlock policy works for these users.
PrefService* prefs1 = user_manager->
GetProfileByUser(user_manager->GetLoggedInUsers()[0])->GetPrefs();