Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / chrome / browser / chromeos / login / user_adding_screen_browsertest.cc
index 29bba4a..0bdb21a 100644 (file)
@@ -2,6 +2,8 @@
 // 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"
@@ -76,16 +78,29 @@ IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, CancelAdding) {
   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());
@@ -100,19 +115,37 @@ IN_PROC_BROWSER_TEST_F(UserAddingScreenTest, PRE_AddingSeveralUsers) {
 }
 
 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();