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