| 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/shelf/shelf_layout_manager.h" | 5 #include "ash/shelf/shelf_layout_manager.h" |
| 6 | 6 |
| 7 #include "ash/accelerators/accelerator_controller.h" | 7 #include "ash/accelerators/accelerator_controller.h" |
| 8 #include "ash/accelerators/accelerator_table.h" | 8 #include "ash/accelerators/accelerator_table.h" |
| 9 #include "ash/ash_switches.h" | 9 #include "ash/ash_switches.h" |
| 10 #include "ash/display/display_manager.h" | 10 #include "ash/display/display_manager.h" |
| (...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 // Turn off the lock screen. | 374 // Turn off the lock screen. |
| 375 void UnlockScreen() { | 375 void UnlockScreen() { |
| 376 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); | 376 Shell::GetInstance()->session_state_delegate()->UnlockScreen(); |
| 377 // The test session state delegate does not fire the lock state change. | 377 // The test session state delegate does not fire the lock state change. |
| 378 Shell::GetInstance()->OnLockStateChanged(false); | 378 Shell::GetInstance()->OnLockStateChanged(false); |
| 379 } | 379 } |
| 380 | 380 |
| 381 // Open the add user screen if |show| is true, otherwise end it. | 381 // Open the add user screen if |show| is true, otherwise end it. |
| 382 void ShowAddUserScreen(bool show) { | 382 void ShowAddUserScreen(bool show) { |
| 383 SetUserAddingScreenRunning(show); | 383 SetUserAddingScreenRunning(show); |
| 384 ShelfLayoutManager* manager = GetShelfWidget()->shelf_layout_manager(); | 384 |
| 385 manager->SessionStateChanged( | 385 const SessionStateDelegate::SessionState state = |
| 386 show ? SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY : | 386 show ? SessionStateDelegate::SESSION_STATE_LOGIN_SECONDARY |
| 387 SessionStateDelegate::SESSION_STATE_ACTIVE); | 387 : SessionStateDelegate::SESSION_STATE_ACTIVE; |
| 388 GetShelfWidget()->shelf_layout_manager()->SessionStateChanged(state); |
| 389 GetShelfWidget()->shelf()->SessionStateChanged(state); |
| 388 } | 390 } |
| 389 | 391 |
| 390 private: | 392 private: |
| 391 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerTest); | 393 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerTest); |
| 392 }; | 394 }; |
| 393 | 395 |
| 394 void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) { | 396 void ShelfLayoutManagerTest::RunGestureDragTests(gfx::Vector2d delta) { |
| 395 ShelfLayoutManager* shelf = GetShelfLayoutManager(); | 397 ShelfLayoutManager* shelf = GetShelfLayoutManager(); |
| 396 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); | 398 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_NEVER); |
| 397 views::Widget* widget = new views::Widget; | 399 views::Widget* widget = new views::Widget; |
| (...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 757 EXPECT_LT(status_bounds.y(), | 759 EXPECT_LT(status_bounds.y(), |
| 758 screen->GetPrimaryDisplay().bounds().bottom()); | 760 screen->GetPrimaryDisplay().bounds().bottom()); |
| 759 } | 761 } |
| 760 | 762 |
| 761 // Makes sure shelf alignment is correct for lock screen. | 763 // Makes sure shelf alignment is correct for lock screen. |
| 762 TEST_F(ShelfLayoutManagerTest, SideAlignmentInteractionWithLockScreen) { | 764 TEST_F(ShelfLayoutManagerTest, SideAlignmentInteractionWithLockScreen) { |
| 763 ShelfLayoutManager* manager = GetShelfWidget()->shelf_layout_manager(); | 765 ShelfLayoutManager* manager = GetShelfWidget()->shelf_layout_manager(); |
| 764 manager->SetAlignment(SHELF_ALIGNMENT_LEFT); | 766 manager->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 765 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, manager->GetAlignment()); | 767 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, manager->GetAlignment()); |
| 766 LockScreen(); | 768 LockScreen(); |
| 767 EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, manager->GetAlignment()); | 769 EXPECT_EQ(SHELF_ALIGNMENT_LOCKED, manager->GetAlignment()); |
| 768 UnlockScreen(); | 770 UnlockScreen(); |
| 769 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, manager->GetAlignment()); | 771 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, manager->GetAlignment()); |
| 770 } | 772 } |
| 771 | 773 |
| 772 // Makes sure shelf alignment is correct for add user screen. | 774 // Makes sure shelf alignment is correct for add user screen. |
| 773 TEST_F(ShelfLayoutManagerTest, SideAlignmentInteractionWithAddUserScreen) { | 775 TEST_F(ShelfLayoutManagerTest, SideAlignmentInteractionWithAddUserScreen) { |
| 774 ShelfLayoutManager* manager = GetShelfWidget()->shelf_layout_manager(); | 776 ShelfLayoutManager* manager = GetShelfWidget()->shelf_layout_manager(); |
| 775 manager->SetAlignment(SHELF_ALIGNMENT_LEFT); | 777 manager->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 776 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, manager->GetAlignment()); | 778 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, manager->GetAlignment()); |
| 777 ShowAddUserScreen(true); | 779 ShowAddUserScreen(true); |
| 778 EXPECT_EQ(SHELF_ALIGNMENT_BOTTOM, manager->GetAlignment()); | 780 EXPECT_EQ(SHELF_ALIGNMENT_LOCKED, manager->GetAlignment()); |
| 779 ShowAddUserScreen(false); | 781 ShowAddUserScreen(false); |
| 780 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, manager->GetAlignment()); | 782 EXPECT_EQ(SHELF_ALIGNMENT_LEFT, manager->GetAlignment()); |
| 781 } | 783 } |
| 782 | 784 |
| 783 // Makes sure shelf alignment is correct for login screen. | 785 // Makes sure shelf alignment is correct for login screen. |
| 784 TEST_F(ShelfLayoutManagerTest, SideAlignmentInteractionWithLoginScreen) { | 786 TEST_F(ShelfLayoutManagerTest, SideAlignmentInteractionWithLoginScreen) { |
| 785 ShelfLayoutManager* manager = GetShelfWidget()->shelf_layout_manager(); | 787 ShelfLayoutManager* manager = GetShelfWidget()->shelf_layout_manager(); |
| 786 ASSERT_EQ(SHELF_ALIGNMENT_BOTTOM, manager->GetAlignment()); | 788 ASSERT_EQ(SHELF_ALIGNMENT_BOTTOM, manager->GetAlignment()); |
| 787 SetUserLoggedIn(false); | 789 SetUserLoggedIn(false); |
| 788 SetSessionStarted(false); | 790 SetSessionStarted(false); |
| (...skipping 1543 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2332 StatusAreaWidget* status_area_widget = | 2334 StatusAreaWidget* status_area_widget = |
| 2333 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); | 2335 Shell::GetPrimaryRootWindowController()->shelf()->status_area_widget(); |
| 2334 EXPECT_TRUE(status_area_widget->IsVisible()); | 2336 EXPECT_TRUE(status_area_widget->IsVisible()); |
| 2335 // Shelf should be in the first display's area. | 2337 // Shelf should be in the first display's area. |
| 2336 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); | 2338 gfx::Rect status_area_bounds(status_area_widget->GetWindowBoundsInScreen()); |
| 2337 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); | 2339 EXPECT_TRUE(gfx::Rect(0, 0, 500, 400).Contains(status_area_bounds)); |
| 2338 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); | 2340 EXPECT_EQ(gfx::Point(500, 400), status_area_bounds.bottom_right()); |
| 2339 } | 2341 } |
| 2340 | 2342 |
| 2341 } // namespace ash | 2343 } // namespace ash |
| OLD | NEW |