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> |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "ash/common/shell_window_ids.h" | 23 #include "ash/common/shell_window_ids.h" |
24 #include "ash/common/system/web_notification/web_notification_tray.h" | 24 #include "ash/common/system/web_notification/web_notification_tray.h" |
25 #include "ash/common/test/material_design_controller_test_api.h" | 25 #include "ash/common/test/material_design_controller_test_api.h" |
26 #include "ash/common/wm_root_window_controller.h" | 26 #include "ash/common/wm_root_window_controller.h" |
27 #include "ash/common/wm_shell.h" | 27 #include "ash/common/wm_shell.h" |
28 #include "ash/common/wm_window.h" | 28 #include "ash/common/wm_window.h" |
29 #include "ash/shell.h" | 29 #include "ash/shell.h" |
30 #include "ash/test/ash_test_base.h" | 30 #include "ash/test/ash_test_base.h" |
31 #include "ash/test/ash_test_helper.h" | 31 #include "ash/test/ash_test_helper.h" |
32 #include "ash/test/overflow_bubble_view_test_api.h" | 32 #include "ash/test/overflow_bubble_view_test_api.h" |
33 #include "ash/test/shelf_test_api.h" | |
34 #include "ash/test/shelf_view_test_api.h" | 33 #include "ash/test/shelf_view_test_api.h" |
35 #include "ash/test/test_shelf_delegate.h" | 34 #include "ash/test/test_shelf_delegate.h" |
36 #include "ash/test/test_shelf_item_delegate.h" | 35 #include "ash/test/test_shelf_item_delegate.h" |
37 #include "ash/test/test_shell_delegate.h" | 36 #include "ash/test/test_shell_delegate.h" |
38 #include "ash/test/test_system_tray_delegate.h" | 37 #include "ash/test/test_system_tray_delegate.h" |
39 #include "base/i18n/rtl.h" | 38 #include "base/i18n/rtl.h" |
40 #include "base/macros.h" | 39 #include "base/macros.h" |
41 #include "base/memory/ptr_util.h" | 40 #include "base/memory/ptr_util.h" |
42 #include "base/run_loop.h" | 41 #include "base/run_loop.h" |
43 #include "base/strings/string_number_conversions.h" | 42 #include "base/strings/string_number_conversions.h" |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
299 public: | 298 public: |
300 static const char* | 299 static const char* |
301 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName; | 300 kTimeBetweenWindowMinimizedAndActivatedActionsHistogramName; |
302 | 301 |
303 ShelfViewTest() : model_(nullptr), shelf_view_(nullptr), browser_index_(1) {} | 302 ShelfViewTest() : model_(nullptr), shelf_view_(nullptr), browser_index_(1) {} |
304 ~ShelfViewTest() override {} | 303 ~ShelfViewTest() override {} |
305 | 304 |
306 void SetUp() override { | 305 void SetUp() override { |
307 AshTestBase::SetUp(); | 306 AshTestBase::SetUp(); |
308 model_ = WmShell::Get()->shelf_model(); | 307 model_ = WmShell::Get()->shelf_model(); |
309 Shelf* shelf = Shelf::ForPrimaryDisplay(); | 308 shelf_view_ = GetPrimaryShelf()->GetShelfViewForTesting(); |
310 shelf_view_ = ShelfTestAPI(shelf).shelf_view(); | |
311 | 309 |
312 WebNotificationTray::DisableAnimationsForTest(true); | 310 WebNotificationTray::DisableAnimationsForTest(true); |
313 | 311 |
314 // The bounds should be big enough for 4 buttons + overflow chevron. | 312 // The bounds should be big enough for 4 buttons + overflow chevron. |
315 shelf_view_->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); | 313 shelf_view_->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); |
316 | 314 |
317 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); | 315 test_api_.reset(new ShelfViewTestAPI(shelf_view_)); |
318 test_api_->SetAnimationDuration(1); // Speeds up animation for test. | 316 test_api_->SetAnimationDuration(1); // Speeds up animation for test. |
319 | 317 |
320 ReplaceShelfDelegate(); | 318 ReplaceShelfDelegate(); |
(...skipping 1358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1679 EXPECT_TRUE(drag_reinsert_bounds.Contains(last_point)); | 1677 EXPECT_TRUE(drag_reinsert_bounds.Contains(last_point)); |
1680 } | 1678 } |
1681 | 1679 |
1682 // Check the drag insertion bounds of shelf view in multi monitor environment. | 1680 // Check the drag insertion bounds of shelf view in multi monitor environment. |
1683 TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { | 1681 TEST_F(ShelfViewTest, CheckDragInsertBoundsWithMultiMonitor) { |
1684 // win8-aura doesn't support multiple display. | 1682 // win8-aura doesn't support multiple display. |
1685 if (!SupportsMultipleDisplays()) | 1683 if (!SupportsMultipleDisplays()) |
1686 return; | 1684 return; |
1687 | 1685 |
1688 UpdateDisplay("800x600,800x600"); | 1686 UpdateDisplay("800x600,800x600"); |
1689 Shelf* secondary_shelf = | 1687 WmShelf* secondary_shelf = |
1690 Shelf::ForWindow(WmShell::Get()->GetAllRootWindows()[1]); | 1688 WmShelf::ForWindow(WmShell::Get()->GetAllRootWindows()[1]); |
1691 ShelfView* shelf_view_for_secondary = | 1689 ShelfView* shelf_view_for_secondary = |
1692 ShelfTestAPI(secondary_shelf).shelf_view(); | 1690 secondary_shelf->GetShelfViewForTesting(); |
1693 | 1691 |
1694 // The bounds should be big enough for 4 buttons + overflow chevron. | 1692 // The bounds should be big enough for 4 buttons + overflow chevron. |
1695 shelf_view_for_secondary->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); | 1693 shelf_view_for_secondary->SetBounds(0, 0, 500, GetShelfConstant(SHELF_SIZE)); |
1696 | 1694 |
1697 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); | 1695 ShelfViewTestAPI test_api_for_secondary(shelf_view_for_secondary); |
1698 // Speeds up animation for test. | 1696 // Speeds up animation for test. |
1699 test_api_for_secondary.SetAnimationDuration(1); | 1697 test_api_for_secondary.SetAnimationDuration(1); |
1700 | 1698 |
1701 AddButtonsUntilOverflow(); | 1699 AddButtonsUntilOverflow(); |
1702 | 1700 |
(...skipping 865 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2568 test_api_->CloseMenu(); | 2566 test_api_->CloseMenu(); |
2569 EXPECT_EQ(views::InkDropState::HIDDEN, | 2567 EXPECT_EQ(views::InkDropState::HIDDEN, |
2570 browser_button_ink_drop_->GetTargetInkDropState()); | 2568 browser_button_ink_drop_->GetTargetInkDropState()); |
2571 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(), | 2569 EXPECT_THAT(browser_button_ink_drop_->GetAndResetRequestedStates(), |
2572 ElementsAre(views::InkDropState::ACTIVATED, | 2570 ElementsAre(views::InkDropState::ACTIVATED, |
2573 views::InkDropState::DEACTIVATED)); | 2571 views::InkDropState::DEACTIVATED)); |
2574 } | 2572 } |
2575 | 2573 |
2576 } // namespace test | 2574 } // namespace test |
2577 } // namespace ash | 2575 } // namespace ash |
OLD | NEW |