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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 14756019: Adding new user menu section to the SystemTrayMenu & refactoring of user access (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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 | Annotate | Revision Log
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 "ash/root_window_controller.h" 5 #include "ash/root_window_controller.h"
6 6
7 #include "ash/display/display_controller.h" 7 #include "ash/display/display_controller.h"
8 #include "ash/session_state_delegate.h" 8 #include "ash/session_state_delegate.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
320 } 320 }
321 321
322 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { 322 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) {
323 UpdateDisplay("600x600"); 323 UpdateDisplay("600x600");
324 Shell* shell = Shell::GetInstance(); 324 Shell* shell = Shell::GetInstance();
325 325
326 // Configure login screen environment. 326 // Configure login screen environment.
327 SetUserLoggedIn(false); 327 SetUserLoggedIn(false);
328 EXPECT_EQ(user::LOGGED_IN_NONE, 328 EXPECT_EQ(user::LOGGED_IN_NONE,
329 shell->system_tray_delegate()->GetUserLoginStatus()); 329 shell->system_tray_delegate()->GetUserLoginStatus());
330 EXPECT_FALSE(shell->session_state_delegate()->HasActiveUser()); 330 EXPECT_EQ(0, shell->session_state_delegate()->NumberOfLoggedInUsers());
331 EXPECT_FALSE(shell->session_state_delegate()->IsActiveUserSessionStarted()); 331 EXPECT_FALSE(shell->session_state_delegate()->IsActiveUserSessionStarted());
332 332
333 internal::RootWindowController* controller = 333 internal::RootWindowController* controller =
334 shell->GetPrimaryRootWindowController(); 334 shell->GetPrimaryRootWindowController();
335 EXPECT_EQ(Shell::GetContainer(controller->root_window(), 335 EXPECT_EQ(Shell::GetContainer(controller->root_window(),
336 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), 336 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(),
337 controller->GetSystemModalLayoutManager(NULL)); 337 controller->GetSystemModalLayoutManager(NULL));
338 338
339 aura::Window* lock_container = 339 aura::Window* lock_container =
340 Shell::GetContainer(controller->root_window(), 340 Shell::GetContainer(controller->root_window(),
341 internal::kShellWindowId_LockScreenContainer); 341 internal::kShellWindowId_LockScreenContainer);
342 views::Widget* login_modal_widget = 342 views::Widget* login_modal_widget =
343 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); 343 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container);
344 EXPECT_EQ(Shell::GetContainer(controller->root_window(), 344 EXPECT_EQ(Shell::GetContainer(controller->root_window(),
345 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(), 345 internal::kShellWindowId_LockSystemModalContainer)->layout_manager(),
346 controller->GetSystemModalLayoutManager( 346 controller->GetSystemModalLayoutManager(
347 login_modal_widget->GetNativeView())); 347 login_modal_widget->GetNativeView()));
348 login_modal_widget->Close(); 348 login_modal_widget->Close();
349 349
350 // Configure user session environment. 350 // Configure user session environment.
351 SetUserLoggedIn(true); 351 SetUserLoggedIn(true);
352 SetSessionStarted(true); 352 SetSessionStarted(true);
353 EXPECT_EQ(user::LOGGED_IN_USER, 353 EXPECT_EQ(user::LOGGED_IN_USER,
354 shell->system_tray_delegate()->GetUserLoginStatus()); 354 shell->system_tray_delegate()->GetUserLoginStatus());
355 EXPECT_TRUE(shell->session_state_delegate()->HasActiveUser()); 355 EXPECT_EQ(1, shell->session_state_delegate()->NumberOfLoggedInUsers());
356 EXPECT_TRUE(shell->session_state_delegate()->IsActiveUserSessionStarted()); 356 EXPECT_TRUE(shell->session_state_delegate()->IsActiveUserSessionStarted());
357 EXPECT_EQ(Shell::GetContainer(controller->root_window(), 357 EXPECT_EQ(Shell::GetContainer(controller->root_window(),
358 internal::kShellWindowId_SystemModalContainer)->layout_manager(), 358 internal::kShellWindowId_SystemModalContainer)->layout_manager(),
359 controller->GetSystemModalLayoutManager(NULL)); 359 controller->GetSystemModalLayoutManager(NULL));
360 360
361 views::Widget* session_modal_widget = 361 views::Widget* session_modal_widget =
362 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); 362 CreateModalWidget(gfx::Rect(300, 10, 100, 100));
363 EXPECT_EQ(Shell::GetContainer(controller->root_window(), 363 EXPECT_EQ(Shell::GetContainer(controller->root_window(),
364 internal::kShellWindowId_SystemModalContainer)->layout_manager(), 364 internal::kShellWindowId_SystemModalContainer)->layout_manager(),
365 controller->GetSystemModalLayoutManager( 365 controller->GetSystemModalLayoutManager(
(...skipping 25 matching lines...) Expand all
391 w1->Activate(); 391 w1->Activate();
392 EXPECT_FALSE(controller->GetFullscreenWindow()); 392 EXPECT_FALSE(controller->GetFullscreenWindow());
393 393
394 // If the fullscreen window is active, GetFullscreenWindow() should find it. 394 // If the fullscreen window is active, GetFullscreenWindow() should find it.
395 w2->Activate(); 395 w2->Activate();
396 EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow()); 396 EXPECT_EQ(w2->GetNativeWindow(), controller->GetFullscreenWindow());
397 } 397 }
398 398
399 } // namespace test 399 } // namespace test
400 } // namespace ash 400 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698