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