| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_widget.h" | 5 #include "ash/shelf/shelf_widget.h" |
| 6 | 6 |
| 7 #include "ash/root_window_controller.h" | 7 #include "ash/root_window_controller.h" |
| 8 #include "ash/shelf/shelf.h" | 8 #include "ash/shelf/shelf.h" |
| 9 #include "ash/shelf/shelf_delegate.h" | 9 #include "ash/shelf/shelf_delegate.h" |
| 10 #include "ash/shelf/shelf_layout_manager.h" | 10 #include "ash/shelf/shelf_layout_manager.h" |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 | 33 |
| 34 ShelfLayoutManager* GetShelfLayoutManager() { | 34 ShelfLayoutManager* GetShelfLayoutManager() { |
| 35 return GetShelfWidget()->shelf_layout_manager(); | 35 return GetShelfWidget()->shelf_layout_manager(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 typedef test::AshTestBase ShelfWidgetTest; | 40 typedef test::AshTestBase ShelfWidgetTest; |
| 41 | 41 |
| 42 void TestLauncherAlignment(aura::Window* root, | 42 void TestLauncherAlignment(aura::Window* root, |
| 43 wm::ShelfAlignment alignment, | 43 ShelfAlignment alignment, |
| 44 const std::string& expected) { | 44 const std::string& expected) { |
| 45 Shelf::ForWindow(root)->SetAlignment(alignment); | 45 Shelf::ForWindow(root)->SetAlignment(alignment); |
| 46 display::Screen* screen = display::Screen::GetScreen(); | 46 display::Screen* screen = display::Screen::GetScreen(); |
| 47 EXPECT_EQ(expected, | 47 EXPECT_EQ(expected, |
| 48 screen->GetDisplayNearestWindow(root).work_area().ToString()); | 48 screen->GetDisplayNearestWindow(root).work_area().ToString()); |
| 49 } | 49 } |
| 50 | 50 |
| 51 #if defined(OS_WIN) && !defined(USE_ASH) | 51 #if defined(OS_WIN) && !defined(USE_ASH) |
| 52 // TODO(msw): Broken on Windows. http://crbug.com/584038 | 52 // TODO(msw): Broken on Windows. http://crbug.com/584038 |
| 53 #define MAYBE_TestAlignment DISABLED_TestAlignment | 53 #define MAYBE_TestAlignment DISABLED_TestAlignment |
| 54 #else | 54 #else |
| 55 #define MAYBE_TestAlignment TestAlignment | 55 #define MAYBE_TestAlignment TestAlignment |
| 56 #endif | 56 #endif |
| 57 TEST_F(ShelfWidgetTest, MAYBE_TestAlignment) { | 57 TEST_F(ShelfWidgetTest, MAYBE_TestAlignment) { |
| 58 UpdateDisplay("400x400"); | 58 UpdateDisplay("400x400"); |
| 59 { | 59 { |
| 60 SCOPED_TRACE("Single Bottom"); | 60 SCOPED_TRACE("Single Bottom"); |
| 61 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 61 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_BOTTOM, |
| 62 wm::SHELF_ALIGNMENT_BOTTOM, "0,0 400x353"); | 62 "0,0 400x353"); |
| 63 } | 63 } |
| 64 { | 64 { |
| 65 SCOPED_TRACE("Single Locked"); | 65 SCOPED_TRACE("Single Locked"); |
| 66 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 66 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), |
| 67 wm::SHELF_ALIGNMENT_BOTTOM_LOCKED, "0,0 400x353"); | 67 SHELF_ALIGNMENT_BOTTOM_LOCKED, "0,0 400x353"); |
| 68 } | 68 } |
| 69 { | 69 { |
| 70 SCOPED_TRACE("Single Right"); | 70 SCOPED_TRACE("Single Right"); |
| 71 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 71 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_RIGHT, |
| 72 wm::SHELF_ALIGNMENT_RIGHT, "0,0 353x400"); | 72 "0,0 353x400"); |
| 73 } | 73 } |
| 74 { | 74 { |
| 75 SCOPED_TRACE("Single Left"); | 75 SCOPED_TRACE("Single Left"); |
| 76 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), | 76 TestLauncherAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_LEFT, |
| 77 wm::SHELF_ALIGNMENT_LEFT, "47,0 353x400"); | 77 "47,0 353x400"); |
| 78 } | 78 } |
| 79 if (!SupportsMultipleDisplays()) | 79 if (!SupportsMultipleDisplays()) |
| 80 return; | 80 return; |
| 81 | 81 |
| 82 UpdateDisplay("300x300,500x500"); | 82 UpdateDisplay("300x300,500x500"); |
| 83 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); | 83 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); |
| 84 { | 84 { |
| 85 SCOPED_TRACE("Primary Bottom"); | 85 SCOPED_TRACE("Primary Bottom"); |
| 86 TestLauncherAlignment(root_windows[0], wm::SHELF_ALIGNMENT_BOTTOM, | 86 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_BOTTOM, |
| 87 "0,0 300x253"); | 87 "0,0 300x253"); |
| 88 } | 88 } |
| 89 { | 89 { |
| 90 SCOPED_TRACE("Primary Locked"); | 90 SCOPED_TRACE("Primary Locked"); |
| 91 TestLauncherAlignment(root_windows[0], wm::SHELF_ALIGNMENT_BOTTOM_LOCKED, | 91 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_BOTTOM_LOCKED, |
| 92 "0,0 300x253"); | 92 "0,0 300x253"); |
| 93 } | 93 } |
| 94 { | 94 { |
| 95 SCOPED_TRACE("Primary Right"); | 95 SCOPED_TRACE("Primary Right"); |
| 96 TestLauncherAlignment(root_windows[0], wm::SHELF_ALIGNMENT_RIGHT, | 96 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_RIGHT, |
| 97 "0,0 253x300"); | 97 "0,0 253x300"); |
| 98 } | 98 } |
| 99 { | 99 { |
| 100 SCOPED_TRACE("Primary Left"); | 100 SCOPED_TRACE("Primary Left"); |
| 101 TestLauncherAlignment(root_windows[0], wm::SHELF_ALIGNMENT_LEFT, | 101 TestLauncherAlignment(root_windows[0], SHELF_ALIGNMENT_LEFT, |
| 102 "47,0 253x300"); | 102 "47,0 253x300"); |
| 103 } | 103 } |
| 104 { | 104 { |
| 105 SCOPED_TRACE("Secondary Bottom"); | 105 SCOPED_TRACE("Secondary Bottom"); |
| 106 TestLauncherAlignment(root_windows[1], wm::SHELF_ALIGNMENT_BOTTOM, | 106 TestLauncherAlignment(root_windows[1], SHELF_ALIGNMENT_BOTTOM, |
| 107 "300,0 500x453"); | 107 "300,0 500x453"); |
| 108 } | 108 } |
| 109 { | 109 { |
| 110 SCOPED_TRACE("Secondary Locked"); | 110 SCOPED_TRACE("Secondary Locked"); |
| 111 TestLauncherAlignment(root_windows[1], wm::SHELF_ALIGNMENT_BOTTOM_LOCKED, | 111 TestLauncherAlignment(root_windows[1], SHELF_ALIGNMENT_BOTTOM_LOCKED, |
| 112 "300,0 500x453"); | 112 "300,0 500x453"); |
| 113 } | 113 } |
| 114 { | 114 { |
| 115 SCOPED_TRACE("Secondary Right"); | 115 SCOPED_TRACE("Secondary Right"); |
| 116 TestLauncherAlignment(root_windows[1], wm::SHELF_ALIGNMENT_RIGHT, | 116 TestLauncherAlignment(root_windows[1], SHELF_ALIGNMENT_RIGHT, |
| 117 "300,0 453x500"); | 117 "300,0 453x500"); |
| 118 } | 118 } |
| 119 { | 119 { |
| 120 SCOPED_TRACE("Secondary Left"); | 120 SCOPED_TRACE("Secondary Left"); |
| 121 TestLauncherAlignment(root_windows[1], wm::SHELF_ALIGNMENT_LEFT, | 121 TestLauncherAlignment(root_windows[1], SHELF_ALIGNMENT_LEFT, |
| 122 "347,0 453x500"); | 122 "347,0 453x500"); |
| 123 } | 123 } |
| 124 } | 124 } |
| 125 | 125 |
| 126 // Makes sure the shelf is initially sized correctly. | 126 // Makes sure the shelf is initially sized correctly. |
| 127 TEST_F(ShelfWidgetTest, LauncherInitiallySized) { | 127 TEST_F(ShelfWidgetTest, LauncherInitiallySized) { |
| 128 ShelfWidget* shelf_widget = GetShelfWidget(); | 128 ShelfWidget* shelf_widget = GetShelfWidget(); |
| 129 Shelf* shelf = shelf_widget->shelf(); | 129 Shelf* shelf = shelf_widget->shelf(); |
| 130 ASSERT_TRUE(shelf); | 130 ASSERT_TRUE(shelf); |
| 131 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); | 131 ShelfLayoutManager* shelf_layout_manager = GetShelfLayoutManager(); |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 222 // shelf). | 222 // shelf). |
| 223 gfx::Point event_location(widget_bounds.x() + 5, shelf_bounds.y() + 1); | 223 gfx::Point event_location(widget_bounds.x() + 5, shelf_bounds.y() + 1); |
| 224 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, | 224 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, |
| 225 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 225 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 226 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 226 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 227 EXPECT_EQ(widget->GetNativeWindow(), target); | 227 EXPECT_EQ(widget->GetNativeWindow(), target); |
| 228 } | 228 } |
| 229 | 229 |
| 230 // Change shelf alignment to verify that the targeter insets are updated. | 230 // Change shelf alignment to verify that the targeter insets are updated. |
| 231 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 231 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 232 shelf->SetAlignment(wm::SHELF_ALIGNMENT_LEFT); | 232 shelf->SetAlignment(SHELF_ALIGNMENT_LEFT); |
| 233 shelf_layout_manager->LayoutShelf(); | 233 shelf_layout_manager->LayoutShelf(); |
| 234 shelf_bounds = shelf_widget->GetWindowBoundsInScreen(); | 234 shelf_bounds = shelf_widget->GetWindowBoundsInScreen(); |
| 235 { | 235 { |
| 236 // Create a mouse-event targeting the right edge of the shelf widget. The | 236 // Create a mouse-event targeting the right edge of the shelf widget. The |
| 237 // window-targeter should find |widget| as the target (instead of the | 237 // window-targeter should find |widget| as the target (instead of the |
| 238 // shelf). | 238 // shelf). |
| 239 gfx::Point event_location(shelf_bounds.right() - 1, widget_bounds.y() + 5); | 239 gfx::Point event_location(shelf_bounds.right() - 1, widget_bounds.y() + 5); |
| 240 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, | 240 ui::MouseEvent mouse(ui::ET_MOUSE_MOVED, event_location, event_location, |
| 241 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); | 241 ui::EventTimeForNow(), ui::EF_NONE, ui::EF_NONE); |
| 242 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); | 242 ui::EventTarget* target = targeter->FindTargetForEvent(root, &mouse); |
| 243 EXPECT_EQ(widget->GetNativeWindow(), target); | 243 EXPECT_EQ(widget->GetNativeWindow(), target); |
| 244 } | 244 } |
| 245 | 245 |
| 246 // Now restore shelf alignment (bottom) and auto-hide (hidden) the shelf. | 246 // Now restore shelf alignment (bottom) and auto-hide (hidden) the shelf. |
| 247 shelf->SetAlignment(wm::SHELF_ALIGNMENT_BOTTOM); | 247 shelf->SetAlignment(SHELF_ALIGNMENT_BOTTOM); |
| 248 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); | 248 shelf->SetAutoHideBehavior(SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS); |
| 249 shelf_layout_manager->LayoutShelf(); | 249 shelf_layout_manager->LayoutShelf(); |
| 250 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager->visibility_state()); | 250 EXPECT_EQ(SHELF_AUTO_HIDE, shelf_layout_manager->visibility_state()); |
| 251 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager->auto_hide_state()); | 251 EXPECT_EQ(SHELF_AUTO_HIDE_HIDDEN, shelf_layout_manager->auto_hide_state()); |
| 252 shelf_bounds = shelf_widget->GetWindowBoundsInScreen(); | 252 shelf_bounds = shelf_widget->GetWindowBoundsInScreen(); |
| 253 EXPECT_TRUE(!shelf_bounds.IsEmpty()); | 253 EXPECT_TRUE(!shelf_bounds.IsEmpty()); |
| 254 | 254 |
| 255 // Move |widget| so it still overlaps the shelf. | 255 // Move |widget| so it still overlaps the shelf. |
| 256 widget->SetBounds(gfx::Rect(0, | 256 widget->SetBounds(gfx::Rect(0, |
| 257 shelf_bounds.y() - kWindowHeight + kOverlapSize, | 257 shelf_bounds.y() - kWindowHeight + kOverlapSize, |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 targeter->FindTargetForEvent(root, &touch)); | 320 targeter->FindTargetForEvent(root, &touch)); |
| 321 } | 321 } |
| 322 } | 322 } |
| 323 | 323 |
| 324 namespace { | 324 namespace { |
| 325 | 325 |
| 326 // A TestShelfDelegate that sets the shelf alignment and auto hide behavior in | 326 // A TestShelfDelegate that sets the shelf alignment and auto hide behavior in |
| 327 // OnShelfCreated, to simulate ChromeLauncherController's behavior. | 327 // OnShelfCreated, to simulate ChromeLauncherController's behavior. |
| 328 class TestShelfDelegate : public ShelfDelegate { | 328 class TestShelfDelegate : public ShelfDelegate { |
| 329 public: | 329 public: |
| 330 TestShelfDelegate(wm::ShelfAlignment initial_alignment, | 330 TestShelfDelegate(ShelfAlignment initial_alignment, |
| 331 ShelfAutoHideBehavior initial_auto_hide_behavior) | 331 ShelfAutoHideBehavior initial_auto_hide_behavior) |
| 332 : initial_alignment_(initial_alignment), | 332 : initial_alignment_(initial_alignment), |
| 333 initial_auto_hide_behavior_(initial_auto_hide_behavior) {} | 333 initial_auto_hide_behavior_(initial_auto_hide_behavior) {} |
| 334 ~TestShelfDelegate() override {} | 334 ~TestShelfDelegate() override {} |
| 335 | 335 |
| 336 // ShelfDelegate implementation. | 336 // ShelfDelegate implementation. |
| 337 void OnShelfCreated(Shelf* shelf) override { | 337 void OnShelfCreated(Shelf* shelf) override { |
| 338 shelf->SetAlignment(initial_alignment_); | 338 shelf->SetAlignment(initial_alignment_); |
| 339 shelf->SetAutoHideBehavior(initial_auto_hide_behavior_); | 339 shelf->SetAutoHideBehavior(initial_auto_hide_behavior_); |
| 340 } | 340 } |
| 341 void OnShelfDestroyed(Shelf* shelf) override {} | 341 void OnShelfDestroyed(Shelf* shelf) override {} |
| 342 void OnShelfAlignmentChanged(Shelf* shelf) override {} | 342 void OnShelfAlignmentChanged(Shelf* shelf) override {} |
| 343 void OnShelfAutoHideBehaviorChanged(Shelf* shelf) override {} | 343 void OnShelfAutoHideBehaviorChanged(Shelf* shelf) override {} |
| 344 void OnShelfAutoHideStateChanged(Shelf* shelf) override {} | 344 void OnShelfAutoHideStateChanged(Shelf* shelf) override {} |
| 345 void OnShelfVisibilityStateChanged(Shelf* shelf) override {} | 345 void OnShelfVisibilityStateChanged(Shelf* shelf) override {} |
| 346 ShelfID GetShelfIDForAppID(const std::string& app_id) override { return 0; } | 346 ShelfID GetShelfIDForAppID(const std::string& app_id) override { return 0; } |
| 347 bool HasShelfIDToAppIDMapping(ShelfID id) const override { return false; } | 347 bool HasShelfIDToAppIDMapping(ShelfID id) const override { return false; } |
| 348 const std::string& GetAppIDForShelfID(ShelfID id) override { | 348 const std::string& GetAppIDForShelfID(ShelfID id) override { |
| 349 return base::EmptyString(); | 349 return base::EmptyString(); |
| 350 } | 350 } |
| 351 void PinAppWithID(const std::string& app_id) override {} | 351 void PinAppWithID(const std::string& app_id) override {} |
| 352 bool IsAppPinned(const std::string& app_id) override { return false; } | 352 bool IsAppPinned(const std::string& app_id) override { return false; } |
| 353 void UnpinAppWithID(const std::string& app_id) override {} | 353 void UnpinAppWithID(const std::string& app_id) override {} |
| 354 | 354 |
| 355 private: | 355 private: |
| 356 wm::ShelfAlignment initial_alignment_; | 356 ShelfAlignment initial_alignment_; |
| 357 ShelfAutoHideBehavior initial_auto_hide_behavior_; | 357 ShelfAutoHideBehavior initial_auto_hide_behavior_; |
| 358 | 358 |
| 359 DISALLOW_COPY_AND_ASSIGN(TestShelfDelegate); | 359 DISALLOW_COPY_AND_ASSIGN(TestShelfDelegate); |
| 360 }; | 360 }; |
| 361 | 361 |
| 362 // A TestShellDelegate that creates a TestShelfDelegate with initial values. | 362 // A TestShellDelegate that creates a TestShelfDelegate with initial values. |
| 363 class ShelfWidgetTestShellDelegate : public test::TestShellDelegate { | 363 class ShelfWidgetTestShellDelegate : public test::TestShellDelegate { |
| 364 public: | 364 public: |
| 365 ShelfWidgetTestShellDelegate() {} | 365 ShelfWidgetTestShellDelegate() {} |
| 366 ~ShelfWidgetTestShellDelegate() override {} | 366 ~ShelfWidgetTestShellDelegate() override {} |
| 367 | 367 |
| 368 // test::TestShellDelegate | 368 // test::TestShellDelegate |
| 369 ShelfDelegate* CreateShelfDelegate(ShelfModel* model) override { | 369 ShelfDelegate* CreateShelfDelegate(ShelfModel* model) override { |
| 370 return new TestShelfDelegate(initial_alignment_, | 370 return new TestShelfDelegate(initial_alignment_, |
| 371 initial_auto_hide_behavior_); | 371 initial_auto_hide_behavior_); |
| 372 } | 372 } |
| 373 | 373 |
| 374 void set_initial_alignment(wm::ShelfAlignment alignment) { | 374 void set_initial_alignment(ShelfAlignment alignment) { |
| 375 initial_alignment_ = alignment; | 375 initial_alignment_ = alignment; |
| 376 } | 376 } |
| 377 | 377 |
| 378 void set_initial_auto_hide_behavior(ShelfAutoHideBehavior behavior) { | 378 void set_initial_auto_hide_behavior(ShelfAutoHideBehavior behavior) { |
| 379 initial_auto_hide_behavior_ = behavior; | 379 initial_auto_hide_behavior_ = behavior; |
| 380 } | 380 } |
| 381 | 381 |
| 382 private: | 382 private: |
| 383 wm::ShelfAlignment initial_alignment_ = wm::SHELF_ALIGNMENT_BOTTOM; | 383 ShelfAlignment initial_alignment_ = SHELF_ALIGNMENT_BOTTOM; |
| 384 ShelfAutoHideBehavior initial_auto_hide_behavior_ = | 384 ShelfAutoHideBehavior initial_auto_hide_behavior_ = |
| 385 SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 385 SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
| 386 DISALLOW_COPY_AND_ASSIGN(ShelfWidgetTestShellDelegate); | 386 DISALLOW_COPY_AND_ASSIGN(ShelfWidgetTestShellDelegate); |
| 387 }; | 387 }; |
| 388 | 388 |
| 389 class ShelfWidgetTestWithDelegate : public ShelfWidgetTest { | 389 class ShelfWidgetTestWithDelegate : public ShelfWidgetTest { |
| 390 public: | 390 public: |
| 391 ShelfWidgetTestWithDelegate() { set_start_session(false); } | 391 ShelfWidgetTestWithDelegate() { set_start_session(false); } |
| 392 ~ShelfWidgetTestWithDelegate() override {} | 392 ~ShelfWidgetTestWithDelegate() override {} |
| 393 | 393 |
| 394 // ShelfWidgetTest: | 394 // ShelfWidgetTest: |
| 395 void SetUp() override { | 395 void SetUp() override { |
| 396 shelf_widget_test_shell_delegate_ = new ShelfWidgetTestShellDelegate; | 396 shelf_widget_test_shell_delegate_ = new ShelfWidgetTestShellDelegate; |
| 397 ash_test_helper()->set_test_shell_delegate( | 397 ash_test_helper()->set_test_shell_delegate( |
| 398 shelf_widget_test_shell_delegate_); | 398 shelf_widget_test_shell_delegate_); |
| 399 ShelfWidgetTest::SetUp(); | 399 ShelfWidgetTest::SetUp(); |
| 400 } | 400 } |
| 401 | 401 |
| 402 void TestCreateShelfWithInitialValues( | 402 void TestCreateShelfWithInitialValues( |
| 403 wm::ShelfAlignment initial_alignment, | 403 ShelfAlignment initial_alignment, |
| 404 ShelfAutoHideBehavior initial_auto_hide_behavior, | 404 ShelfAutoHideBehavior initial_auto_hide_behavior, |
| 405 ShelfVisibilityState expected_shelf_visibility_state, | 405 ShelfVisibilityState expected_shelf_visibility_state, |
| 406 ShelfAutoHideState expected_shelf_auto_hide_state) { | 406 ShelfAutoHideState expected_shelf_auto_hide_state) { |
| 407 shelf_widget_test_shell_delegate_->set_initial_alignment(initial_alignment); | 407 shelf_widget_test_shell_delegate_->set_initial_alignment(initial_alignment); |
| 408 shelf_widget_test_shell_delegate_->set_initial_auto_hide_behavior( | 408 shelf_widget_test_shell_delegate_->set_initial_auto_hide_behavior( |
| 409 initial_auto_hide_behavior); | 409 initial_auto_hide_behavior); |
| 410 SetUserLoggedIn(true); | 410 SetUserLoggedIn(true); |
| 411 SetSessionStarted(true); | 411 SetSessionStarted(true); |
| 412 | 412 |
| 413 ShelfWidget* shelf_widget = GetShelfWidget(); | 413 ShelfWidget* shelf_widget = GetShelfWidget(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 428 | 428 |
| 429 private: | 429 private: |
| 430 ShelfWidgetTestShellDelegate* shelf_widget_test_shell_delegate_; | 430 ShelfWidgetTestShellDelegate* shelf_widget_test_shell_delegate_; |
| 431 DISALLOW_COPY_AND_ASSIGN(ShelfWidgetTestWithDelegate); | 431 DISALLOW_COPY_AND_ASSIGN(ShelfWidgetTestWithDelegate); |
| 432 }; | 432 }; |
| 433 | 433 |
| 434 } // namespace | 434 } // namespace |
| 435 | 435 |
| 436 TEST_F(ShelfWidgetTestWithDelegate, CreateAutoHideAlwaysShelf) { | 436 TEST_F(ShelfWidgetTestWithDelegate, CreateAutoHideAlwaysShelf) { |
| 437 // The actual auto hide state is shown because there are no open windows. | 437 // The actual auto hide state is shown because there are no open windows. |
| 438 TestCreateShelfWithInitialValues(wm::SHELF_ALIGNMENT_BOTTOM, | 438 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM, |
| 439 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, | 439 SHELF_AUTO_HIDE_BEHAVIOR_ALWAYS, |
| 440 SHELF_AUTO_HIDE, SHELF_AUTO_HIDE_SHOWN); | 440 SHELF_AUTO_HIDE, SHELF_AUTO_HIDE_SHOWN); |
| 441 } | 441 } |
| 442 | 442 |
| 443 TEST_F(ShelfWidgetTestWithDelegate, CreateAutoHideNeverShelf) { | 443 TEST_F(ShelfWidgetTestWithDelegate, CreateAutoHideNeverShelf) { |
| 444 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. | 444 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. |
| 445 TestCreateShelfWithInitialValues(wm::SHELF_ALIGNMENT_LEFT, | 445 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_LEFT, |
| 446 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 446 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
| 447 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); | 447 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); |
| 448 } | 448 } |
| 449 | 449 |
| 450 TEST_F(ShelfWidgetTestWithDelegate, CreateAutoHideAlwaysHideShelf) { | 450 TEST_F(ShelfWidgetTestWithDelegate, CreateAutoHideAlwaysHideShelf) { |
| 451 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. | 451 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. |
| 452 TestCreateShelfWithInitialValues(wm::SHELF_ALIGNMENT_RIGHT, | 452 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_RIGHT, |
| 453 SHELF_AUTO_HIDE_ALWAYS_HIDDEN, SHELF_HIDDEN, | 453 SHELF_AUTO_HIDE_ALWAYS_HIDDEN, SHELF_HIDDEN, |
| 454 SHELF_AUTO_HIDE_HIDDEN); | 454 SHELF_AUTO_HIDE_HIDDEN); |
| 455 } | 455 } |
| 456 | 456 |
| 457 TEST_F(ShelfWidgetTestWithDelegate, CreateLockedShelf) { | 457 TEST_F(ShelfWidgetTestWithDelegate, CreateLockedShelf) { |
| 458 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. | 458 // The auto hide state 'HIDDEN' is returned for any non-auto-hide behavior. |
| 459 TestCreateShelfWithInitialValues(wm::SHELF_ALIGNMENT_BOTTOM_LOCKED, | 459 TestCreateShelfWithInitialValues(SHELF_ALIGNMENT_BOTTOM_LOCKED, |
| 460 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, | 460 SHELF_AUTO_HIDE_BEHAVIOR_NEVER, |
| 461 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); | 461 SHELF_VISIBLE, SHELF_AUTO_HIDE_HIDDEN); |
| 462 } | 462 } |
| 463 | 463 |
| 464 } // namespace ash | 464 } // namespace ash |
| OLD | NEW |