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

Side by Side Diff: ash/wm/panels/panel_layout_manager_unittest.cc

Issue 2036353002: mash: Move ash/common/wm/shelf to ash/common/shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 6 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
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/wm/panels/panel_layout_manager.h" 5 #include "ash/common/wm/panels/panel_layout_manager.h"
6 6
7 #include "ash/ash_switches.h" 7 #include "ash/ash_switches.h"
8 #include "ash/aura/wm_window_aura.h" 8 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/shelf/shelf_types.h"
9 #include "ash/common/shell_window_ids.h" 10 #include "ash/common/shell_window_ids.h"
10 #include "ash/common/wm/window_state.h" 11 #include "ash/common/wm/window_state.h"
11 #include "ash/screen_util.h" 12 #include "ash/screen_util.h"
12 #include "ash/shelf/shelf.h" 13 #include "ash/shelf/shelf.h"
13 #include "ash/shelf/shelf_button.h" 14 #include "ash/shelf/shelf_button.h"
14 #include "ash/shelf/shelf_layout_manager.h" 15 #include "ash/shelf/shelf_layout_manager.h"
15 #include "ash/shelf/shelf_model.h" 16 #include "ash/shelf/shelf_model.h"
16 #include "ash/shelf/shelf_types.h"
17 #include "ash/shelf/shelf_util.h" 17 #include "ash/shelf/shelf_util.h"
18 #include "ash/shelf/shelf_view.h" 18 #include "ash/shelf/shelf_view.h"
19 #include "ash/shelf/shelf_widget.h" 19 #include "ash/shelf/shelf_widget.h"
20 #include "ash/shell.h" 20 #include "ash/shell.h"
21 #include "ash/test/ash_test_base.h" 21 #include "ash/test/ash_test_base.h"
22 #include "ash/test/shelf_test_api.h" 22 #include "ash/test/shelf_test_api.h"
23 #include "ash/test/shelf_view_test_api.h" 23 #include "ash/test/shelf_view_test_api.h"
24 #include "ash/test/shell_test_api.h" 24 #include "ash/test/shell_test_api.h"
25 #include "ash/test/test_shelf_delegate.h" 25 #include "ash/test/test_shelf_delegate.h"
26 #include "ash/wm/mru_window_tracker.h" 26 #include "ash/wm/mru_window_tracker.h"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 shelf_view_test()->RunMessageLoopUntilAnimationsDone(); 121 shelf_view_test()->RunMessageLoopUntilAnimationsDone();
122 122
123 Shelf* shelf = Shelf::ForWindow(panel); 123 Shelf* shelf = Shelf::ForWindow(panel);
124 gfx::Rect icon_bounds = shelf->GetScreenBoundsOfItemIconForWindow(panel); 124 gfx::Rect icon_bounds = shelf->GetScreenBoundsOfItemIconForWindow(panel);
125 ASSERT_FALSE(icon_bounds.width() == 0 && icon_bounds.height() == 0); 125 ASSERT_FALSE(icon_bounds.width() == 0 && icon_bounds.height() == 0);
126 126
127 gfx::Rect window_bounds = panel->GetBoundsInScreen(); 127 gfx::Rect window_bounds = panel->GetBoundsInScreen();
128 ASSERT_LT(icon_bounds.width(), window_bounds.width()); 128 ASSERT_LT(icon_bounds.width(), window_bounds.width());
129 ASSERT_LT(icon_bounds.height(), window_bounds.height()); 129 ASSERT_LT(icon_bounds.height(), window_bounds.height());
130 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen(); 130 gfx::Rect shelf_bounds = shelf->shelf_widget()->GetWindowBoundsInScreen();
131 wm::ShelfAlignment alignment = GetAlignment(panel->GetRootWindow()); 131 ShelfAlignment alignment = GetAlignment(panel->GetRootWindow());
132 132
133 if (IsHorizontal(alignment)) { 133 if (IsHorizontal(alignment)) {
134 // The horizontal bounds of the panel window should contain the bounds of 134 // The horizontal bounds of the panel window should contain the bounds of
135 // the shelf icon. 135 // the shelf icon.
136 EXPECT_LE(window_bounds.x(), icon_bounds.x()); 136 EXPECT_LE(window_bounds.x(), icon_bounds.x());
137 EXPECT_GE(window_bounds.right(), icon_bounds.right()); 137 EXPECT_GE(window_bounds.right(), icon_bounds.right());
138 } else { 138 } else {
139 // The vertical bounds of the panel window should contain the bounds of 139 // The vertical bounds of the panel window should contain the bounds of
140 // the shelf icon. 140 // the shelf icon.
141 EXPECT_LE(window_bounds.y(), icon_bounds.y()); 141 EXPECT_LE(window_bounds.y(), icon_bounds.y());
142 EXPECT_GE(window_bounds.bottom(), icon_bounds.bottom()); 142 EXPECT_GE(window_bounds.bottom(), icon_bounds.bottom());
143 } 143 }
144 144
145 if (alignment == wm::SHELF_ALIGNMENT_LEFT) 145 if (alignment == SHELF_ALIGNMENT_LEFT)
146 EXPECT_EQ(shelf_bounds.right(), window_bounds.x()); 146 EXPECT_EQ(shelf_bounds.right(), window_bounds.x());
147 else if (alignment == wm::SHELF_ALIGNMENT_RIGHT) 147 else if (alignment == SHELF_ALIGNMENT_RIGHT)
148 EXPECT_EQ(shelf_bounds.x(), window_bounds.right()); 148 EXPECT_EQ(shelf_bounds.x(), window_bounds.right());
149 else 149 else
150 EXPECT_EQ(shelf_bounds.y(), window_bounds.bottom()); 150 EXPECT_EQ(shelf_bounds.y(), window_bounds.bottom());
151 } 151 }
152 152
153 void IsCalloutAboveLauncherIcon(aura::Window* panel) { 153 void IsCalloutAboveLauncherIcon(aura::Window* panel) {
154 // Flush the message loop, since callout updates use a delayed task. 154 // Flush the message loop, since callout updates use a delayed task.
155 base::RunLoop().RunUntilIdle(); 155 base::RunLoop().RunUntilIdle();
156 views::Widget* widget = GetCalloutWidgetForPanel(panel); 156 views::Widget* widget = GetCalloutWidgetForPanel(panel);
157 157
158 Shelf* shelf = Shelf::ForWindow(panel); 158 Shelf* shelf = Shelf::ForWindow(panel);
159 gfx::Rect icon_bounds = shelf->GetScreenBoundsOfItemIconForWindow(panel); 159 gfx::Rect icon_bounds = shelf->GetScreenBoundsOfItemIconForWindow(panel);
160 ASSERT_FALSE(icon_bounds.IsEmpty()); 160 ASSERT_FALSE(icon_bounds.IsEmpty());
161 161
162 gfx::Rect panel_bounds = panel->GetBoundsInScreen(); 162 gfx::Rect panel_bounds = panel->GetBoundsInScreen();
163 gfx::Rect callout_bounds = widget->GetWindowBoundsInScreen(); 163 gfx::Rect callout_bounds = widget->GetWindowBoundsInScreen();
164 ASSERT_FALSE(icon_bounds.IsEmpty()); 164 ASSERT_FALSE(icon_bounds.IsEmpty());
165 165
166 EXPECT_TRUE(widget->IsVisible()); 166 EXPECT_TRUE(widget->IsVisible());
167 167
168 wm::ShelfAlignment alignment = GetAlignment(panel->GetRootWindow()); 168 ShelfAlignment alignment = GetAlignment(panel->GetRootWindow());
169 if (alignment == wm::SHELF_ALIGNMENT_LEFT) 169 if (alignment == SHELF_ALIGNMENT_LEFT)
170 EXPECT_EQ(panel_bounds.x(), callout_bounds.right()); 170 EXPECT_EQ(panel_bounds.x(), callout_bounds.right());
171 else if (alignment == wm::SHELF_ALIGNMENT_RIGHT) 171 else if (alignment == SHELF_ALIGNMENT_RIGHT)
172 EXPECT_EQ(panel_bounds.right(), callout_bounds.x()); 172 EXPECT_EQ(panel_bounds.right(), callout_bounds.x());
173 else 173 else
174 EXPECT_EQ(panel_bounds.bottom(), callout_bounds.y()); 174 EXPECT_EQ(panel_bounds.bottom(), callout_bounds.y());
175 175
176 if (IsHorizontal(alignment)) { 176 if (IsHorizontal(alignment)) {
177 EXPECT_NEAR(icon_bounds.CenterPoint().x(), 177 EXPECT_NEAR(icon_bounds.CenterPoint().x(),
178 widget->GetWindowBoundsInScreen().CenterPoint().x(), 178 widget->GetWindowBoundsInScreen().CenterPoint().x(),
179 1); 179 1);
180 } else { 180 } else {
181 EXPECT_NEAR(icon_bounds.CenterPoint().y(), 181 EXPECT_NEAR(icon_bounds.CenterPoint().y(),
(...skipping 21 matching lines...) Expand all
203 int index = model->ItemIndexByID(GetShelfIDForWindow(window)); 203 int index = model->ItemIndexByID(GetShelfIDForWindow(window));
204 gfx::Rect bounds = test_api.GetButton(index)->GetBoundsInScreen(); 204 gfx::Rect bounds = test_api.GetButton(index)->GetBoundsInScreen();
205 205
206 ui::test::EventGenerator& event_generator = GetEventGenerator(); 206 ui::test::EventGenerator& event_generator = GetEventGenerator();
207 event_generator.MoveMouseTo(bounds.CenterPoint()); 207 event_generator.MoveMouseTo(bounds.CenterPoint());
208 event_generator.ClickLeftButton(); 208 event_generator.ClickLeftButton();
209 209
210 test_api.RunMessageLoopUntilAnimationsDone(); 210 test_api.RunMessageLoopUntilAnimationsDone();
211 } 211 }
212 212
213 void SetAlignment(aura::Window* root_window, wm::ShelfAlignment alignment) { 213 void SetAlignment(aura::Window* root_window, ShelfAlignment alignment) {
214 Shelf::ForWindow(root_window)->SetAlignment(alignment); 214 Shelf::ForWindow(root_window)->SetAlignment(alignment);
215 } 215 }
216 216
217 wm::ShelfAlignment GetAlignment(const aura::Window* root_window) { 217 ShelfAlignment GetAlignment(const aura::Window* root_window) {
218 return Shelf::ForWindow(root_window)->alignment(); 218 return Shelf::ForWindow(root_window)->alignment();
219 } 219 }
220 220
221 void SetShelfAutoHideBehavior(aura::Window* window, 221 void SetShelfAutoHideBehavior(aura::Window* window,
222 ShelfAutoHideBehavior behavior) { 222 ShelfAutoHideBehavior behavior) {
223 Shelf* shelf = Shelf::ForWindow(window); 223 Shelf* shelf = Shelf::ForWindow(window);
224 shelf->SetAutoHideBehavior(behavior); 224 shelf->SetAutoHideBehavior(behavior);
225 test::ShelfViewTestAPI test_api(GetShelfView(shelf)); 225 test::ShelfViewTestAPI test_api(GetShelfView(shelf));
226 test_api.RunMessageLoopUntilAnimationsDone(); 226 test_api.RunMessageLoopUntilAnimationsDone();
227 } 227 }
228 228
229 void SetShelfVisibilityState(aura::Window* window, 229 void SetShelfVisibilityState(aura::Window* window,
230 ShelfVisibilityState visibility_state) { 230 ShelfVisibilityState visibility_state) {
231 Shelf* shelf = Shelf::ForWindow(window); 231 Shelf* shelf = Shelf::ForWindow(window);
232 shelf->shelf_layout_manager()->SetState(visibility_state); 232 shelf->shelf_layout_manager()->SetState(visibility_state);
233 } 233 }
234 234
235 ShelfView* GetShelfView(Shelf* shelf) { 235 ShelfView* GetShelfView(Shelf* shelf) {
236 return test::ShelfTestAPI(shelf).shelf_view(); 236 return test::ShelfTestAPI(shelf).shelf_view();
237 } 237 }
238 238
239 private: 239 private:
240 std::unique_ptr<test::ShelfViewTestAPI> shelf_view_test_; 240 std::unique_ptr<test::ShelfViewTestAPI> shelf_view_test_;
241 241
242 bool IsHorizontal(wm::ShelfAlignment alignment) { 242 bool IsHorizontal(ShelfAlignment alignment) {
243 return alignment == wm::SHELF_ALIGNMENT_BOTTOM; 243 return alignment == SHELF_ALIGNMENT_BOTTOM;
244 } 244 }
245 245
246 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManagerTest); 246 DISALLOW_COPY_AND_ASSIGN(PanelLayoutManagerTest);
247 }; 247 };
248 248
249 class PanelLayoutManagerTextDirectionTest 249 class PanelLayoutManagerTextDirectionTest
250 : public PanelLayoutManagerTest, 250 : public PanelLayoutManagerTest,
251 public testing::WithParamInterface<bool> { 251 public testing::WithParamInterface<bool> {
252 public: 252 public:
253 PanelLayoutManagerTextDirectionTest() : is_rtl_(GetParam()) {} 253 PanelLayoutManagerTextDirectionTest() : is_rtl_(GetParam()) {}
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 EXPECT_TRUE(WindowIsAbove(w2.get(), w3.get())); 361 EXPECT_TRUE(WindowIsAbove(w2.get(), w3.get()));
362 EXPECT_TRUE(WindowIsAbove(w2.get(), w1.get())); 362 EXPECT_TRUE(WindowIsAbove(w2.get(), w1.get()));
363 363
364 wm::ActivateWindow(w3.get()); 364 wm::ActivateWindow(w3.get());
365 EXPECT_TRUE(WindowIsAbove(w3.get(), w2.get())); 365 EXPECT_TRUE(WindowIsAbove(w3.get(), w2.get()));
366 EXPECT_TRUE(WindowIsAbove(w2.get(), w1.get())); 366 EXPECT_TRUE(WindowIsAbove(w2.get(), w1.get()));
367 } 367 }
368 368
369 TEST_F(PanelLayoutManagerTest, MultiplePanelStackingVertical) { 369 TEST_F(PanelLayoutManagerTest, MultiplePanelStackingVertical) {
370 // Set shelf to be aligned on the right. 370 // Set shelf to be aligned on the right.
371 SetAlignment(Shell::GetPrimaryRootWindow(), wm::SHELF_ALIGNMENT_RIGHT); 371 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_RIGHT);
372 372
373 // Size panels in such a way that ordering them by X coordinate would cause 373 // Size panels in such a way that ordering them by X coordinate would cause
374 // stacking order to be incorrect. Test that stacking order is based on Y. 374 // stacking order to be incorrect. Test that stacking order is based on Y.
375 std::unique_ptr<aura::Window> w1( 375 std::unique_ptr<aura::Window> w1(
376 CreatePanelWindow(gfx::Rect(0, 0, 210, 201))); 376 CreatePanelWindow(gfx::Rect(0, 0, 210, 201)));
377 std::unique_ptr<aura::Window> w2( 377 std::unique_ptr<aura::Window> w2(
378 CreatePanelWindow(gfx::Rect(0, 0, 220, 201))); 378 CreatePanelWindow(gfx::Rect(0, 0, 220, 201)));
379 std::unique_ptr<aura::Window> w3( 379 std::unique_ptr<aura::Window> w3(
380 CreatePanelWindow(gfx::Rect(0, 0, 200, 201))); 380 CreatePanelWindow(gfx::Rect(0, 0, 200, 201)));
381 381
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
680 UpdateDisplay("600x400,600x400"); 680 UpdateDisplay("600x400,600x400");
681 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 681 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
682 682
683 std::unique_ptr<aura::Window> p1_d2( 683 std::unique_ptr<aura::Window> p1_d2(
684 CreatePanelWindow(gfx::Rect(600, 0, 50, 50))); 684 CreatePanelWindow(gfx::Rect(600, 0, 50, 50)));
685 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow()); 685 EXPECT_EQ(root_windows[1], p1_d2->GetRootWindow());
686 686
687 IsPanelAboveLauncherIcon(p1_d2.get()); 687 IsPanelAboveLauncherIcon(p1_d2.get());
688 IsCalloutAboveLauncherIcon(p1_d2.get()); 688 IsCalloutAboveLauncherIcon(p1_d2.get());
689 689
690 SetAlignment(root_windows[1], wm::SHELF_ALIGNMENT_RIGHT); 690 SetAlignment(root_windows[1], SHELF_ALIGNMENT_RIGHT);
691 IsPanelAboveLauncherIcon(p1_d2.get()); 691 IsPanelAboveLauncherIcon(p1_d2.get());
692 IsCalloutAboveLauncherIcon(p1_d2.get()); 692 IsCalloutAboveLauncherIcon(p1_d2.get());
693 SetAlignment(root_windows[1], wm::SHELF_ALIGNMENT_LEFT); 693 SetAlignment(root_windows[1], SHELF_ALIGNMENT_LEFT);
694 IsPanelAboveLauncherIcon(p1_d2.get()); 694 IsPanelAboveLauncherIcon(p1_d2.get());
695 IsCalloutAboveLauncherIcon(p1_d2.get()); 695 IsCalloutAboveLauncherIcon(p1_d2.get());
696 } 696 }
697 697
698 TEST_F(PanelLayoutManagerTest, AlignmentLeft) { 698 TEST_F(PanelLayoutManagerTest, AlignmentLeft) {
699 gfx::Rect bounds(0, 0, 201, 201); 699 gfx::Rect bounds(0, 0, 201, 201);
700 std::unique_ptr<aura::Window> w(CreatePanelWindow(bounds)); 700 std::unique_ptr<aura::Window> w(CreatePanelWindow(bounds));
701 SetAlignment(Shell::GetPrimaryRootWindow(), wm::SHELF_ALIGNMENT_LEFT); 701 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_LEFT);
702 IsPanelAboveLauncherIcon(w.get()); 702 IsPanelAboveLauncherIcon(w.get());
703 IsCalloutAboveLauncherIcon(w.get()); 703 IsCalloutAboveLauncherIcon(w.get());
704 } 704 }
705 705
706 TEST_F(PanelLayoutManagerTest, AlignmentRight) { 706 TEST_F(PanelLayoutManagerTest, AlignmentRight) {
707 gfx::Rect bounds(0, 0, 201, 201); 707 gfx::Rect bounds(0, 0, 201, 201);
708 std::unique_ptr<aura::Window> w(CreatePanelWindow(bounds)); 708 std::unique_ptr<aura::Window> w(CreatePanelWindow(bounds));
709 SetAlignment(Shell::GetPrimaryRootWindow(), wm::SHELF_ALIGNMENT_RIGHT); 709 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_RIGHT);
710 IsPanelAboveLauncherIcon(w.get()); 710 IsPanelAboveLauncherIcon(w.get());
711 IsCalloutAboveLauncherIcon(w.get()); 711 IsCalloutAboveLauncherIcon(w.get());
712 } 712 }
713 713
714 // Tests that panels will hide and restore their state with the shelf visibility 714 // Tests that panels will hide and restore their state with the shelf visibility
715 // state. This ensures that entering full-screen mode will hide your panels 715 // state. This ensures that entering full-screen mode will hide your panels
716 // until you leave it. 716 // until you leave it.
717 TEST_F(PanelLayoutManagerTest, PanelsHideAndRestoreWithShelf) { 717 TEST_F(PanelLayoutManagerTest, PanelsHideAndRestoreWithShelf) {
718 gfx::Rect bounds(0, 0, 201, 201); 718 gfx::Rect bounds(0, 0, 201, 201);
719 719
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 ui::EventTargeter* targeter = root->GetEventTargeter(); 771 ui::EventTargeter* targeter = root->GetEventTargeter();
772 772
773 // Note that the constants used in the touch locations below are 773 // Note that the constants used in the touch locations below are
774 // arbitrarily-selected small numbers which will ensure the point is 774 // arbitrarily-selected small numbers which will ensure the point is
775 // within the default extended region surrounding the panel. This value 775 // within the default extended region surrounding the panel. This value
776 // is calculated as 776 // is calculated as
777 // kResizeOutsideBoundsSize * kResizeOutsideBoundsScaleForTouch 777 // kResizeOutsideBoundsSize * kResizeOutsideBoundsScaleForTouch
778 // in src/ash/root_window_controller.cc. 778 // in src/ash/root_window_controller.cc.
779 779
780 // Hit test outside the right edge with a bottom-aligned shelf. 780 // Hit test outside the right edge with a bottom-aligned shelf.
781 SetAlignment(Shell::GetPrimaryRootWindow(), wm::SHELF_ALIGNMENT_BOTTOM); 781 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_BOTTOM);
782 gfx::Rect bounds(w->bounds()); 782 gfx::Rect bounds(w->bounds());
783 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED, 783 ui::TouchEvent touch(ui::ET_TOUCH_PRESSED,
784 gfx::Point(bounds.right() + 3, bounds.y() + 2), 784 gfx::Point(bounds.right() + 3, bounds.y() + 2),
785 0, ui::EventTimeForNow()); 785 0, ui::EventTimeForNow());
786 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch); 786 ui::EventTarget* target = targeter->FindTargetForEvent(root, &touch);
787 EXPECT_EQ(w.get(), target); 787 EXPECT_EQ(w.get(), target);
788 788
789 // Hit test outside the bottom edge with a bottom-aligned shelf. 789 // Hit test outside the bottom edge with a bottom-aligned shelf.
790 touch.set_location(gfx::Point(bounds.x() + 6, bounds.bottom() + 5)); 790 touch.set_location(gfx::Point(bounds.x() + 6, bounds.bottom() + 5));
791 target = targeter->FindTargetForEvent(root, &touch); 791 target = targeter->FindTargetForEvent(root, &touch);
792 EXPECT_NE(w.get(), target); 792 EXPECT_NE(w.get(), target);
793 793
794 // Hit test outside the bottom edge with a right-aligned shelf. 794 // Hit test outside the bottom edge with a right-aligned shelf.
795 SetAlignment(Shell::GetPrimaryRootWindow(), wm::SHELF_ALIGNMENT_RIGHT); 795 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_RIGHT);
796 bounds = w->bounds(); 796 bounds = w->bounds();
797 touch.set_location(gfx::Point(bounds.x() + 6, bounds.bottom() + 5)); 797 touch.set_location(gfx::Point(bounds.x() + 6, bounds.bottom() + 5));
798 target = targeter->FindTargetForEvent(root, &touch); 798 target = targeter->FindTargetForEvent(root, &touch);
799 EXPECT_EQ(w.get(), target); 799 EXPECT_EQ(w.get(), target);
800 800
801 // Hit test outside the right edge with a right-aligned shelf. 801 // Hit test outside the right edge with a right-aligned shelf.
802 touch.set_location(gfx::Point(bounds.right() + 3, bounds.y() + 2)); 802 touch.set_location(gfx::Point(bounds.right() + 3, bounds.y() + 2));
803 target = targeter->FindTargetForEvent(root, &touch); 803 target = targeter->FindTargetForEvent(root, &touch);
804 EXPECT_NE(w.get(), target); 804 EXPECT_NE(w.get(), target);
805 805
806 // Hit test outside the top edge with a left-aligned shelf. 806 // Hit test outside the top edge with a left-aligned shelf.
807 SetAlignment(Shell::GetPrimaryRootWindow(), wm::SHELF_ALIGNMENT_LEFT); 807 SetAlignment(Shell::GetPrimaryRootWindow(), SHELF_ALIGNMENT_LEFT);
808 bounds = w->bounds(); 808 bounds = w->bounds();
809 touch.set_location(gfx::Point(bounds.x() + 4, bounds.y() - 6)); 809 touch.set_location(gfx::Point(bounds.x() + 4, bounds.y() - 6));
810 target = targeter->FindTargetForEvent(root, &touch); 810 target = targeter->FindTargetForEvent(root, &touch);
811 EXPECT_EQ(w.get(), target); 811 EXPECT_EQ(w.get(), target);
812 812
813 // Hit test outside the left edge with a left-aligned shelf. 813 // Hit test outside the left edge with a left-aligned shelf.
814 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5)); 814 touch.set_location(gfx::Point(bounds.x() - 1, bounds.y() + 5));
815 target = targeter->FindTargetForEvent(root, &touch); 815 target = targeter->FindTargetForEvent(root, &touch);
816 EXPECT_NE(w.get(), target); 816 EXPECT_NE(w.get(), target);
817 } 817 }
818 818
819 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, 819 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest,
820 testing::Bool()); 820 testing::Bool());
821 821
822 } // namespace ash 822 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/attached_panel_window_targeter.cc ('k') | ash/wm/panels/panel_window_resizer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698