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/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
9 #include "ash/screen_util.h" | 9 #include "ash/screen_util.h" |
10 #include "ash/shelf/shelf.h" | 10 #include "ash/shelf/shelf.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 #include "ash/test/test_shelf_delegate.h" | 24 #include "ash/test/test_shelf_delegate.h" |
25 #include "ash/wm/mru_window_tracker.h" | 25 #include "ash/wm/mru_window_tracker.h" |
26 #include "ash/wm/window_state.h" | 26 #include "ash/wm/window_state.h" |
27 #include "ash/wm/window_util.h" | 27 #include "ash/wm/window_util.h" |
28 #include "base/basictypes.h" | 28 #include "base/basictypes.h" |
29 #include "base/command_line.h" | 29 #include "base/command_line.h" |
30 #include "base/compiler_specific.h" | 30 #include "base/compiler_specific.h" |
31 #include "base/i18n/rtl.h" | 31 #include "base/i18n/rtl.h" |
32 #include "base/run_loop.h" | 32 #include "base/run_loop.h" |
33 #include "ui/aura/client/aura_constants.h" | 33 #include "ui/aura/client/aura_constants.h" |
34 #include "ui/aura/test/event_generator.h" | |
35 #include "ui/aura/test/test_windows.h" | 34 #include "ui/aura/test/test_windows.h" |
36 #include "ui/aura/window.h" | 35 #include "ui/aura/window.h" |
37 #include "ui/aura/window_event_dispatcher.h" | 36 #include "ui/aura/window_event_dispatcher.h" |
38 #include "ui/base/l10n/l10n_util.h" | 37 #include "ui/base/l10n/l10n_util.h" |
39 #include "ui/events/event_utils.h" | 38 #include "ui/events/event_utils.h" |
| 39 #include "ui/events/test/event_generator.h" |
40 #include "ui/views/widget/widget.h" | 40 #include "ui/views/widget/widget.h" |
41 | 41 |
42 namespace ash { | 42 namespace ash { |
43 | 43 |
44 using aura::test::WindowIsAbove; | 44 using aura::test::WindowIsAbove; |
45 | 45 |
46 class PanelLayoutManagerTest : public test::AshTestBase { | 46 class PanelLayoutManagerTest : public test::AshTestBase { |
47 public: | 47 public: |
48 PanelLayoutManagerTest() {} | 48 PanelLayoutManagerTest() {} |
49 virtual ~PanelLayoutManagerTest() {} | 49 virtual ~PanelLayoutManagerTest() {} |
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 // Clicks the shelf items on |shelf_view| that is associated with given | 213 // Clicks the shelf items on |shelf_view| that is associated with given |
214 // |window|. | 214 // |window|. |
215 void ClickShelfItemForWindow(ShelfView* shelf_view, aura::Window* window) { | 215 void ClickShelfItemForWindow(ShelfView* shelf_view, aura::Window* window) { |
216 test::ShelfViewTestAPI test_api(shelf_view); | 216 test::ShelfViewTestAPI test_api(shelf_view); |
217 test_api.SetAnimationDuration(1); | 217 test_api.SetAnimationDuration(1); |
218 test_api.RunMessageLoopUntilAnimationsDone(); | 218 test_api.RunMessageLoopUntilAnimationsDone(); |
219 ShelfModel* model = test::ShellTestApi(Shell::GetInstance()).shelf_model(); | 219 ShelfModel* model = test::ShellTestApi(Shell::GetInstance()).shelf_model(); |
220 int index = model->ItemIndexByID(GetShelfIDForWindow(window)); | 220 int index = model->ItemIndexByID(GetShelfIDForWindow(window)); |
221 gfx::Rect bounds = test_api.GetButton(index)->GetBoundsInScreen(); | 221 gfx::Rect bounds = test_api.GetButton(index)->GetBoundsInScreen(); |
222 | 222 |
223 aura::test::EventGenerator& event_generator = GetEventGenerator(); | 223 ui::test::EventGenerator& event_generator = GetEventGenerator(); |
224 event_generator.MoveMouseTo(bounds.CenterPoint()); | 224 event_generator.MoveMouseTo(bounds.CenterPoint()); |
225 event_generator.ClickLeftButton(); | 225 event_generator.ClickLeftButton(); |
226 | 226 |
227 test_api.RunMessageLoopUntilAnimationsDone(); | 227 test_api.RunMessageLoopUntilAnimationsDone(); |
228 } | 228 } |
229 | 229 |
230 void SetAlignment(aura::Window* root_window, ShelfAlignment alignment) { | 230 void SetAlignment(aura::Window* root_window, ShelfAlignment alignment) { |
231 ash::Shell* shell = ash::Shell::GetInstance(); | 231 ash::Shell* shell = ash::Shell::GetInstance(); |
232 shell->SetShelfAlignment(alignment, root_window); | 232 shell->SetShelfAlignment(alignment, root_window); |
233 } | 233 } |
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
850 // Hit test outside the top edge with a top-aligned shelf. | 850 // Hit test outside the top edge with a top-aligned shelf. |
851 touch.set_location(gfx::Point(bounds.x() + 4, bounds.y() - 6)); | 851 touch.set_location(gfx::Point(bounds.x() + 4, bounds.y() - 6)); |
852 target = targeter->FindTargetForEvent(root, &touch); | 852 target = targeter->FindTargetForEvent(root, &touch); |
853 EXPECT_NE(w.get(), target); | 853 EXPECT_NE(w.get(), target); |
854 } | 854 } |
855 | 855 |
856 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, | 856 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelLayoutManagerTextDirectionTest, |
857 testing::Bool()); | 857 testing::Bool()); |
858 | 858 |
859 } // namespace ash | 859 } // namespace ash |
OLD | NEW |