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

Side by Side Diff: ash/root_window_controller_unittest.cc

Issue 2761063002: Move more from WmShell to Shell (Closed)
Patch Set: cleanup Created 3 years, 9 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
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 <memory> 7 #include <memory>
8 8
9 #include "ash/common/session/session_controller.h" 9 #include "ash/common/session/session_controller.h"
10 #include "ash/common/session/session_state_delegate.h" 10 #include "ash/common/session/session_state_delegate.h"
(...skipping 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 ASSERT_EQ(lock_wallpaper->GetNativeWindow(), 380 ASSERT_EQ(lock_wallpaper->GetNativeWindow(),
381 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId)); 381 controller->GetRootWindow()->GetChildById(kLockWallpaperWindowId));
382 EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString()); 382 EXPECT_EQ("0,0 600x500", lock_screen->GetNativeWindow()->bounds().ToString());
383 } 383 }
384 384
385 TEST_F(RootWindowControllerTest, ModalContainer) { 385 TEST_F(RootWindowControllerTest, ModalContainer) {
386 UpdateDisplay("600x600"); 386 UpdateDisplay("600x600");
387 WmShell* wm_shell = WmShell::Get(); 387 WmShell* wm_shell = WmShell::Get();
388 RootWindowController* controller = wm_shell->GetPrimaryRootWindowController(); 388 RootWindowController* controller = wm_shell->GetPrimaryRootWindowController();
389 EXPECT_EQ(LoginStatus::USER, 389 EXPECT_EQ(LoginStatus::USER,
390 wm_shell->system_tray_delegate()->GetUserLoginStatus()); 390 Shell::Get()->system_tray_delegate()->GetUserLoginStatus());
391 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), 391 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer),
392 controller->GetSystemModalLayoutManager(NULL)); 392 controller->GetSystemModalLayoutManager(NULL));
393 393
394 views::Widget* session_modal_widget = 394 views::Widget* session_modal_widget =
395 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); 395 CreateModalWidget(gfx::Rect(300, 10, 100, 100));
396 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), 396 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer),
397 controller->GetSystemModalLayoutManager( 397 controller->GetSystemModalLayoutManager(
398 WmWindow::Get(session_modal_widget->GetNativeWindow()))); 398 WmWindow::Get(session_modal_widget->GetNativeWindow())));
399 399
400 wm_shell->GetSessionStateDelegate()->LockScreen(); 400 wm_shell->GetSessionStateDelegate()->LockScreen();
401 EXPECT_EQ(LoginStatus::LOCKED, 401 EXPECT_EQ(LoginStatus::LOCKED,
402 wm_shell->system_tray_delegate()->GetUserLoginStatus()); 402 Shell::Get()->system_tray_delegate()->GetUserLoginStatus());
403 EXPECT_EQ( 403 EXPECT_EQ(
404 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), 404 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer),
405 controller->GetSystemModalLayoutManager(nullptr)); 405 controller->GetSystemModalLayoutManager(nullptr));
406 406
407 aura::Window* lock_container = 407 aura::Window* lock_container =
408 controller->GetContainer(kShellWindowId_LockScreenContainer); 408 controller->GetContainer(kShellWindowId_LockScreenContainer);
409 views::Widget* lock_modal_widget = 409 views::Widget* lock_modal_widget =
410 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); 410 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container);
411 EXPECT_EQ( 411 EXPECT_EQ(
412 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), 412 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer),
413 controller->GetSystemModalLayoutManager( 413 controller->GetSystemModalLayoutManager(
414 WmWindow::Get(lock_modal_widget->GetNativeWindow()))); 414 WmWindow::Get(lock_modal_widget->GetNativeWindow())));
415 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), 415 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer),
416 controller->GetSystemModalLayoutManager( 416 controller->GetSystemModalLayoutManager(
417 WmWindow::Get(session_modal_widget->GetNativeWindow()))); 417 WmWindow::Get(session_modal_widget->GetNativeWindow())));
418 418
419 wm_shell->GetSessionStateDelegate()->UnlockScreen(); 419 wm_shell->GetSessionStateDelegate()->UnlockScreen();
420 } 420 }
421 421
422 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { 422 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) {
423 UpdateDisplay("600x600"); 423 UpdateDisplay("600x600");
424 424
425 // Configure login screen environment. 425 // Configure login screen environment.
426 SessionStateDelegate* session_state_delegate = 426 SessionStateDelegate* session_state_delegate =
427 WmShell::Get()->GetSessionStateDelegate(); 427 WmShell::Get()->GetSessionStateDelegate();
428 SetUserLoggedIn(false); 428 SetUserLoggedIn(false);
429 EXPECT_EQ(LoginStatus::NOT_LOGGED_IN, 429 EXPECT_EQ(LoginStatus::NOT_LOGGED_IN,
430 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus()); 430 Shell::Get()->system_tray_delegate()->GetUserLoginStatus());
431 EXPECT_EQ(0, session_state_delegate->NumberOfLoggedInUsers()); 431 EXPECT_EQ(0, session_state_delegate->NumberOfLoggedInUsers());
432 EXPECT_FALSE(session_state_delegate->IsActiveUserSessionStarted()); 432 EXPECT_FALSE(session_state_delegate->IsActiveUserSessionStarted());
433 433
434 RootWindowController* controller = 434 RootWindowController* controller =
435 WmShell::Get()->GetPrimaryRootWindowController(); 435 WmShell::Get()->GetPrimaryRootWindowController();
436 EXPECT_EQ( 436 EXPECT_EQ(
437 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), 437 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer),
438 controller->GetSystemModalLayoutManager(NULL)); 438 controller->GetSystemModalLayoutManager(NULL));
439 439
440 aura::Window* lock_container = 440 aura::Window* lock_container =
441 controller->GetContainer(kShellWindowId_LockScreenContainer); 441 controller->GetContainer(kShellWindowId_LockScreenContainer);
442 views::Widget* login_modal_widget = 442 views::Widget* login_modal_widget =
443 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); 443 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container);
444 EXPECT_EQ( 444 EXPECT_EQ(
445 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), 445 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer),
446 controller->GetSystemModalLayoutManager( 446 controller->GetSystemModalLayoutManager(
447 WmWindow::Get(login_modal_widget->GetNativeWindow()))); 447 WmWindow::Get(login_modal_widget->GetNativeWindow())));
448 login_modal_widget->Close(); 448 login_modal_widget->Close();
449 449
450 // Configure user session environment. 450 // Configure user session environment.
451 SetUserLoggedIn(true); 451 SetUserLoggedIn(true);
452 SetSessionStarted(true); 452 SetSessionStarted(true);
453 EXPECT_EQ(LoginStatus::USER, 453 EXPECT_EQ(LoginStatus::USER,
454 WmShell::Get()->system_tray_delegate()->GetUserLoginStatus()); 454 Shell::Get()->system_tray_delegate()->GetUserLoginStatus());
455 EXPECT_EQ(1, session_state_delegate->NumberOfLoggedInUsers()); 455 EXPECT_EQ(1, session_state_delegate->NumberOfLoggedInUsers());
456 EXPECT_TRUE(session_state_delegate->IsActiveUserSessionStarted()); 456 EXPECT_TRUE(session_state_delegate->IsActiveUserSessionStarted());
457 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), 457 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer),
458 controller->GetSystemModalLayoutManager(NULL)); 458 controller->GetSystemModalLayoutManager(NULL));
459 459
460 views::Widget* session_modal_widget = 460 views::Widget* session_modal_widget =
461 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); 461 CreateModalWidget(gfx::Rect(300, 10, 100, 100));
462 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), 462 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer),
463 controller->GetSystemModalLayoutManager( 463 controller->GetSystemModalLayoutManager(
464 WmWindow::Get(session_modal_widget->GetNativeWindow()))); 464 WmWindow::Get(session_modal_widget->GetNativeWindow())));
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
1238 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( 1238 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds(
1239 gfx::Rect(0, 400, 800, 200)); 1239 gfx::Rect(0, 400, 800, 200));
1240 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); 1240 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString());
1241 1241
1242 UpdateDisplay("600x800"); 1242 UpdateDisplay("600x800");
1243 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); 1243 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString());
1244 } 1244 }
1245 1245
1246 } // namespace test 1246 } // namespace test
1247 } // namespace ash 1247 } // namespace ash
OLDNEW
« no previous file with comments | « ash/mus/test/wm_test_helper.cc ('k') | ash/shell.h » ('j') | ash/shell.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698