Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Side by Side Diff: ash/shelf/shelf_view_unittest.cc

Issue 2647833003: Adds AppListDelegate to AppList that is notified on visibility changes (Closed)
Patch Set: move Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/app_list/app_list_presenter_delegate.h ('k') | ash/shell.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 #include "base/test/histogram_tester.h" 46 #include "base/test/histogram_tester.h"
47 #include "base/test/scoped_mock_time_message_loop_task_runner.h" 47 #include "base/test/scoped_mock_time_message_loop_task_runner.h"
48 #include "base/test/user_action_tester.h" 48 #include "base/test/user_action_tester.h"
49 #include "base/time/time.h" 49 #include "base/time/time.h"
50 #include "testing/gmock/include/gmock/gmock.h" 50 #include "testing/gmock/include/gmock/gmock.h"
51 #include "ui/app_list/presenter/app_list.h" 51 #include "ui/app_list/presenter/app_list.h"
52 #include "ui/aura/test/aura_test_base.h" 52 #include "ui/aura/test/aura_test_base.h"
53 #include "ui/aura/window.h" 53 #include "ui/aura/window.h"
54 #include "ui/aura/window_event_dispatcher.h" 54 #include "ui/aura/window_event_dispatcher.h"
55 #include "ui/compositor/layer.h" 55 #include "ui/compositor/layer.h"
56 #include "ui/display/display.h"
57 #include "ui/display/screen.h"
56 #include "ui/events/event.h" 58 #include "ui/events/event.h"
57 #include "ui/events/event_constants.h" 59 #include "ui/events/event_constants.h"
58 #include "ui/events/event_utils.h" 60 #include "ui/events/event_utils.h"
59 #include "ui/events/test/event_generator.h" 61 #include "ui/events/test/event_generator.h"
60 #include "ui/gfx/geometry/point.h" 62 #include "ui/gfx/geometry/point.h"
61 #include "ui/views/animation/ink_drop_impl.h" 63 #include "ui/views/animation/ink_drop_impl.h"
62 #include "ui/views/animation/test/ink_drop_host_view_test_api.h" 64 #include "ui/views/animation/test/ink_drop_host_view_test_api.h"
63 #include "ui/views/bubble/bubble_frame_view.h" 65 #include "ui/views/bubble/bubble_frame_view.h"
64 #include "ui/views/view_model.h" 66 #include "ui/views/view_model.h"
65 #include "ui/views/widget/widget.h" 67 #include "ui/views/widget/widget.h"
66 #include "ui/views/widget/widget_delegate.h" 68 #include "ui/views/widget/widget_delegate.h"
67 #include "ui/wm/core/coordinate_conversion.h" 69 #include "ui/wm/core/coordinate_conversion.h"
68 70
69 using testing::ElementsAre; 71 using testing::ElementsAre;
70 using testing::IsEmpty; 72 using testing::IsEmpty;
71 73
72 namespace ash { 74 namespace ash {
73 namespace test { 75 namespace test {
76 namespace {
77
78 int64_t GetPrimaryDisplayId() {
79 return display::Screen::GetScreen()->GetPrimaryDisplay().id();
80 }
81
82 } // namespace
74 83
75 //////////////////////////////////////////////////////////////////////////////// 84 ////////////////////////////////////////////////////////////////////////////////
76 // WmShelfObserver::OnShelfIconPositionsChanged tests. 85 // WmShelfObserver::OnShelfIconPositionsChanged tests.
77 86
78 class TestWmShelfObserver : public WmShelfObserver { 87 class TestWmShelfObserver : public WmShelfObserver {
79 public: 88 public:
80 explicit TestWmShelfObserver(WmShelf* shelf) : shelf_(shelf) { 89 explicit TestWmShelfObserver(WmShelf* shelf) : shelf_(shelf) {
81 shelf_->AddObserver(this); 90 shelf_->AddObserver(this);
82 } 91 }
83 92
(...skipping 1381 matching lines...) Expand 10 before | Expand all | Expand 10 after
1465 gfx::Point(all_area.x() - 1, all_area.y()))); 1474 gfx::Point(all_area.x() - 1, all_area.y())));
1466 EXPECT_TRUE(shelf_view_->ShouldHideTooltip( 1475 EXPECT_TRUE(shelf_view_->ShouldHideTooltip(
1467 gfx::Point(all_area.x(), all_area.y() - 1))); 1476 gfx::Point(all_area.x(), all_area.y() - 1)));
1468 EXPECT_TRUE(shelf_view_->ShouldHideTooltip( 1477 EXPECT_TRUE(shelf_view_->ShouldHideTooltip(
1469 gfx::Point(all_area.x(), all_area.bottom()))); 1478 gfx::Point(all_area.x(), all_area.bottom())));
1470 } 1479 }
1471 1480
1472 TEST_F(ShelfViewTest, ShouldHideTooltipWithAppListWindowTest) { 1481 TEST_F(ShelfViewTest, ShouldHideTooltipWithAppListWindowTest) {
1473 // Trigger mock notifications that the app list was shown. 1482 // Trigger mock notifications that the app list was shown.
1474 WmShell::Get()->app_list()->OnTargetVisibilityChanged(true); 1483 WmShell::Get()->app_list()->OnTargetVisibilityChanged(true);
1475 WmShell::Get()->app_list()->OnVisibilityChanged(true); 1484 WmShell::Get()->app_list()->OnVisibilityChanged(true, GetPrimaryDisplayId());
1476 AppListButton* app_list_button = shelf_view_->GetAppListButton(); 1485 AppListButton* app_list_button = shelf_view_->GetAppListButton();
1477 app_list_button->OnAppListShown(); 1486 app_list_button->OnAppListShown();
1478 1487
1479 // The tooltip shouldn't hide if the mouse is on normal buttons. 1488 // The tooltip shouldn't hide if the mouse is on normal buttons.
1480 for (int i = 1; i < test_api_->GetButtonCount(); i++) { 1489 for (int i = 1; i < test_api_->GetButtonCount(); i++) {
1481 ShelfButton* button = test_api_->GetButton(i); 1490 ShelfButton* button = test_api_->GetButton(i);
1482 if (!button) 1491 if (!button)
1483 continue; 1492 continue;
1484 1493
1485 EXPECT_FALSE(shelf_view_->ShouldHideTooltip( 1494 EXPECT_FALSE(shelf_view_->ShouldHideTooltip(
(...skipping 623 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 2118
2110 void DismissAppList() { 2119 void DismissAppList() {
2111 // Trigger a mock notification that the app list was dismissed. 2120 // Trigger a mock notification that the app list was dismissed.
2112 WmShell::Get()->app_list()->OnTargetVisibilityChanged(false); 2121 WmShell::Get()->app_list()->OnTargetVisibilityChanged(false);
2113 app_list_button_->OnAppListDismissed(); 2122 app_list_button_->OnAppListDismissed();
2114 } 2123 }
2115 2124
2116 void FinishAppListVisibilityChange() { 2125 void FinishAppListVisibilityChange() {
2117 // Trigger a mock notification that the app list finished animating. 2126 // Trigger a mock notification that the app list finished animating.
2118 app_list::AppList* app_list = WmShell::Get()->app_list(); 2127 app_list::AppList* app_list = WmShell::Get()->app_list();
2119 app_list->OnVisibilityChanged(app_list->GetTargetVisibility()); 2128 app_list->OnVisibilityChanged(app_list->GetTargetVisibility(),
2129 GetPrimaryDisplayId());
2120 } 2130 }
2121 2131
2122 AppListButton* app_list_button_ = nullptr; 2132 AppListButton* app_list_button_ = nullptr;
2123 InkDropSpy* app_list_button_ink_drop_ = nullptr; 2133 InkDropSpy* app_list_button_ink_drop_ = nullptr;
2124 ShelfButton* browser_button_ = nullptr; 2134 ShelfButton* browser_button_ = nullptr;
2125 InkDropSpy* browser_button_ink_drop_ = nullptr; 2135 InkDropSpy* browser_button_ink_drop_ = nullptr;
2126 2136
2127 private: 2137 private:
2128 DISALLOW_COPY_AND_ASSIGN(ShelfViewInkDropTest); 2138 DISALLOW_COPY_AND_ASSIGN(ShelfViewInkDropTest);
2129 }; 2139 };
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
3052 EXPECT_EQ(views::InkDropState::ACTIVATED, 3062 EXPECT_EQ(views::InkDropState::ACTIVATED,
3053 overflow_button_ink_drop_->GetTargetInkDropState()); 3063 overflow_button_ink_drop_->GetTargetInkDropState());
3054 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(), 3064 EXPECT_THAT(overflow_button_ink_drop_->GetAndResetRequestedStates(),
3055 IsEmpty()); 3065 IsEmpty());
3056 3066
3057 ASSERT_TRUE(test_api_->IsShowingOverflowBubble()); 3067 ASSERT_TRUE(test_api_->IsShowingOverflowBubble());
3058 } 3068 }
3059 3069
3060 } // namespace test 3070 } // namespace test
3061 } // namespace ash 3071 } // namespace ash
OLDNEW
« no previous file with comments | « ash/app_list/app_list_presenter_delegate.h ('k') | ash/shell.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698