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