| 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/common/shelf/shelf_view.h" | 5 #include "ash/common/shelf/shelf_view.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "ash/common/shelf/app_list_button.h" | 12 #include "ash/common/shelf/app_list_button.h" |
| 13 #include "ash/common/shelf/overflow_bubble.h" | 13 #include "ash/common/shelf/overflow_bubble.h" |
| 14 #include "ash/common/shelf/overflow_bubble_view.h" | 14 #include "ash/common/shelf/overflow_bubble_view.h" |
| 15 #include "ash/common/shelf/shelf_button.h" | 15 #include "ash/common/shelf/shelf_button.h" |
| 16 #include "ash/common/shelf/shelf_constants.h" | 16 #include "ash/common/shelf/shelf_constants.h" |
| 17 #include "ash/common/shelf/shelf_icon_observer.h" | 17 #include "ash/common/shelf/shelf_icon_observer.h" |
| 18 #include "ash/common/shelf/shelf_menu_model.h" | 18 #include "ash/common/shelf/shelf_menu_model.h" |
| 19 #include "ash/common/shelf/shelf_model.h" | 19 #include "ash/common/shelf/shelf_model.h" |
| 20 #include "ash/common/shelf/shelf_tooltip_manager.h" | 20 #include "ash/common/shelf/shelf_tooltip_manager.h" |
| 21 #include "ash/common/shelf/wm_shelf.h" | 21 #include "ash/common/shelf/wm_shelf.h" |
| 22 #include "ash/common/shell_window_ids.h" | 22 #include "ash/common/shell_window_ids.h" |
| 23 #include "ash/common/system/web_notification/web_notification_tray.h" |
| 23 #include "ash/common/test/material_design_controller_test_api.h" | 24 #include "ash/common/test/material_design_controller_test_api.h" |
| 24 #include "ash/common/wm_shell.h" | 25 #include "ash/common/wm_shell.h" |
| 25 #include "ash/shelf/shelf_widget.h" | 26 #include "ash/shelf/shelf_widget.h" |
| 26 #include "ash/shell.h" | 27 #include "ash/shell.h" |
| 27 #include "ash/test/ash_test_base.h" | 28 #include "ash/test/ash_test_base.h" |
| 28 #include "ash/test/ash_test_helper.h" | 29 #include "ash/test/ash_test_helper.h" |
| 29 #include "ash/test/overflow_bubble_view_test_api.h" | 30 #include "ash/test/overflow_bubble_view_test_api.h" |
| 30 #include "ash/test/shelf_test_api.h" | 31 #include "ash/test/shelf_test_api.h" |
| 31 #include "ash/test/shelf_view_test_api.h" | 32 #include "ash/test/shelf_view_test_api.h" |
| 32 #include "ash/test/test_shelf_delegate.h" | 33 #include "ash/test/test_shelf_delegate.h" |
| (...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 | 307 |
| 307 ShelfViewTest() : model_(nullptr), shelf_view_(nullptr), browser_index_(1) {} | 308 ShelfViewTest() : model_(nullptr), shelf_view_(nullptr), browser_index_(1) {} |
| 308 ~ShelfViewTest() override {} | 309 ~ShelfViewTest() override {} |
| 309 | 310 |
| 310 void SetUp() override { | 311 void SetUp() override { |
| 311 AshTestBase::SetUp(); | 312 AshTestBase::SetUp(); |
| 312 model_ = WmShell::Get()->shelf_model(); | 313 model_ = WmShell::Get()->shelf_model(); |
| 313 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 314 Shelf* shelf = Shelf::ForPrimaryDisplay(); |
| 314 shelf_view_ = ShelfTestAPI(shelf).shelf_view(); | 315 shelf_view_ = ShelfTestAPI(shelf).shelf_view(); |
| 315 | 316 |
| 317 WebNotificationTray::DisableAnimationsForTest(true); |
| 318 |
| 316 // The bounds should be big enough for 4 buttons + overflow chevron. | 319 // The bounds should be big enough for 4 buttons + overflow chevron. |
| 317 shelf_view_->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); | 320 shelf_view_->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); |
| 318 | 321 |
| 319 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); | 322 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); |
| 320 test_api_->SetAnimationDuration(1); // Speeds up animation for test. | 323 test_api_->SetAnimationDuration(1); // Speeds up animation for test. |
| 321 | 324 |
| 322 ReplaceShelfDelegate(); | 325 ReplaceShelfDelegate(); |
| 323 | 326 |
| 324 // Add browser shortcut shelf item at index 0 for test. | 327 // Add browser shortcut shelf item at index 0 for test. |
| 325 AddBrowserShortcut(); | 328 AddBrowserShortcut(); |
| 326 } | 329 } |
| 327 | 330 |
| 328 void TearDown() override { | 331 void TearDown() override { |
| 332 WebNotificationTray::DisableAnimationsForTest(false); // Reenable animation |
| 333 |
| 329 shelf_delegate_ = nullptr; | 334 shelf_delegate_ = nullptr; |
| 330 test_api_.reset(); | 335 test_api_.reset(); |
| 331 AshTestBase::TearDown(); | 336 AshTestBase::TearDown(); |
| 332 } | 337 } |
| 333 | 338 |
| 334 protected: | 339 protected: |
| 335 void CreateAndSetShelfItemDelegateForID(ShelfID id) { | 340 void CreateAndSetShelfItemDelegateForID(ShelfID id) { |
| 336 std::unique_ptr<ShelfItemDelegate> delegate( | 341 std::unique_ptr<ShelfItemDelegate> delegate( |
| 337 new TestShelfItemDelegate(NULL)); | 342 new TestShelfItemDelegate(NULL)); |
| 338 model_->SetShelfItemDelegate(id, std::move(delegate)); | 343 model_->SetShelfItemDelegate(id, std::move(delegate)); |
| (...skipping 2227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2566 test_api_->CloseMenu(); | 2571 test_api_->CloseMenu(); |
| 2567 EXPECT_EQ(views::InkDropState::HIDDEN, | 2572 EXPECT_EQ(views::InkDropState::HIDDEN, |
| 2568 browser_button_ink_drop_->GetTargetInkDropState()); | 2573 browser_button_ink_drop_->GetTargetInkDropState()); |
| 2569 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(), | 2574 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(), |
| 2570 ElementsAre(views::InkDropState::ACTIVATED, | 2575 ElementsAre(views::InkDropState::ACTIVATED, |
| 2571 views::InkDropState::DEACTIVATED)); | 2576 views::InkDropState::DEACTIVATED)); |
| 2572 } | 2577 } |
| 2573 | 2578 |
| 2574 } // namespace test | 2579 } // namespace test |
| 2575 } // namespace ash | 2580 } // namespace ash |
| OLD | NEW |