OLD | NEW |
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/public/cpp/config.h" | 9 #include "ash/public/cpp/config.h" |
10 #include "ash/public/cpp/shell_window_ids.h" | 10 #include "ash/public/cpp/shell_window_ids.h" |
(...skipping 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 ASSERT_EQ(lock_screen->GetNativeWindow(), | 378 ASSERT_EQ(lock_screen->GetNativeWindow(), |
379 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); | 379 controller->GetRootWindow()->GetChildById(kLockScreenWindowId)); |
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 RootWindowController* controller = | 387 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); |
388 ShellPort::Get()->GetPrimaryRootWindowController(); | |
389 EXPECT_TRUE(Shell::Get()->session_controller()->IsActiveUserSessionStarted()); | 388 EXPECT_TRUE(Shell::Get()->session_controller()->IsActiveUserSessionStarted()); |
390 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), | 389 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), |
391 controller->GetSystemModalLayoutManager(NULL)); | 390 controller->GetSystemModalLayoutManager(NULL)); |
392 | 391 |
393 views::Widget* session_modal_widget = | 392 views::Widget* session_modal_widget = |
394 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 393 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
395 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), | 394 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), |
396 controller->GetSystemModalLayoutManager( | 395 controller->GetSystemModalLayoutManager( |
397 session_modal_widget->GetNativeWindow())); | 396 session_modal_widget->GetNativeWindow())); |
398 | 397 |
(...skipping 20 matching lines...) Expand all Loading... |
419 | 418 |
420 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { | 419 TEST_F(RootWindowControllerTest, ModalContainerNotLoggedInLoggedIn) { |
421 UpdateDisplay("600x600"); | 420 UpdateDisplay("600x600"); |
422 | 421 |
423 // Configure login screen environment. | 422 // Configure login screen environment. |
424 SessionController* session_controller = Shell::Get()->session_controller(); | 423 SessionController* session_controller = Shell::Get()->session_controller(); |
425 SetUserLoggedIn(false); | 424 SetUserLoggedIn(false); |
426 EXPECT_EQ(0, session_controller->NumberOfLoggedInUsers()); | 425 EXPECT_EQ(0, session_controller->NumberOfLoggedInUsers()); |
427 EXPECT_FALSE(session_controller->IsActiveUserSessionStarted()); | 426 EXPECT_FALSE(session_controller->IsActiveUserSessionStarted()); |
428 | 427 |
429 RootWindowController* controller = | 428 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); |
430 ShellPort::Get()->GetPrimaryRootWindowController(); | |
431 EXPECT_EQ( | 429 EXPECT_EQ( |
432 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), | 430 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), |
433 controller->GetSystemModalLayoutManager(NULL)); | 431 controller->GetSystemModalLayoutManager(NULL)); |
434 | 432 |
435 aura::Window* lock_container = | 433 aura::Window* lock_container = |
436 controller->GetContainer(kShellWindowId_LockScreenContainer); | 434 controller->GetContainer(kShellWindowId_LockScreenContainer); |
437 views::Widget* login_modal_widget = | 435 views::Widget* login_modal_widget = |
438 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); | 436 CreateModalWidgetWithParent(gfx::Rect(300, 10, 100, 100), lock_container); |
439 EXPECT_EQ( | 437 EXPECT_EQ( |
440 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), | 438 GetLayoutManager(controller, kShellWindowId_LockSystemModalContainer), |
(...skipping 11 matching lines...) Expand all Loading... |
452 | 450 |
453 views::Widget* session_modal_widget = | 451 views::Widget* session_modal_widget = |
454 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 452 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
455 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), | 453 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), |
456 controller->GetSystemModalLayoutManager( | 454 controller->GetSystemModalLayoutManager( |
457 session_modal_widget->GetNativeWindow())); | 455 session_modal_widget->GetNativeWindow())); |
458 } | 456 } |
459 | 457 |
460 TEST_F(RootWindowControllerTest, ModalContainerBlockedSession) { | 458 TEST_F(RootWindowControllerTest, ModalContainerBlockedSession) { |
461 UpdateDisplay("600x600"); | 459 UpdateDisplay("600x600"); |
462 RootWindowController* controller = | 460 RootWindowController* controller = Shell::GetPrimaryRootWindowController(); |
463 ShellPort::Get()->GetPrimaryRootWindowController(); | |
464 aura::Window* lock_container = | 461 aura::Window* lock_container = |
465 controller->GetContainer(kShellWindowId_LockScreenContainer); | 462 controller->GetContainer(kShellWindowId_LockScreenContainer); |
466 for (int block_reason = FIRST_BLOCK_REASON; | 463 for (int block_reason = FIRST_BLOCK_REASON; |
467 block_reason < NUMBER_OF_BLOCK_REASONS; ++block_reason) { | 464 block_reason < NUMBER_OF_BLOCK_REASONS; ++block_reason) { |
468 views::Widget* session_modal_widget = | 465 views::Widget* session_modal_widget = |
469 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); | 466 CreateModalWidget(gfx::Rect(300, 10, 100, 100)); |
470 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), | 467 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), |
471 controller->GetSystemModalLayoutManager( | 468 controller->GetSystemModalLayoutManager( |
472 session_modal_widget->GetNativeWindow())); | 469 session_modal_widget->GetNativeWindow())); |
473 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), | 470 EXPECT_EQ(GetLayoutManager(controller, kShellWindowId_SystemModalContainer), |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1237 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( | 1234 keyboard_controller->ui()->GetKeyboardWindow()->SetBounds( |
1238 gfx::Rect(0, 400, 800, 200)); | 1235 gfx::Rect(0, 400, 800, 200)); |
1239 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); | 1236 EXPECT_EQ("0,400 800x200", keyboard_container->bounds().ToString()); |
1240 | 1237 |
1241 UpdateDisplay("600x800"); | 1238 UpdateDisplay("600x800"); |
1242 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); | 1239 EXPECT_EQ("0,600 600x200", keyboard_container->bounds().ToString()); |
1243 } | 1240 } |
1244 | 1241 |
1245 } // namespace test | 1242 } // namespace test |
1246 } // namespace ash | 1243 } // namespace ash |
OLD | NEW |