OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autoclick/autoclick_controller.h" | 5 #include "ash/autoclick/autoclick_controller.h" |
| 6 #include "ash/public/cpp/config.h" |
6 #include "ash/shell.h" | 7 #include "ash/shell.h" |
7 #include "ash/shell_port.h" | 8 #include "ash/shell_port.h" |
8 #include "ash/test/ash_test_base.h" | 9 #include "ash/test/ash_test_base.h" |
9 #include "ui/aura/test/test_window_delegate.h" | 10 #include "ui/aura/test/test_window_delegate.h" |
10 #include "ui/aura/window.h" | 11 #include "ui/aura/window.h" |
11 #include "ui/aura/window_event_dispatcher.h" | 12 #include "ui/aura/window_event_dispatcher.h" |
12 #include "ui/display/manager/display_manager.h" | 13 #include "ui/display/manager/display_manager.h" |
13 #include "ui/events/event.h" | 14 #include "ui/events/event.h" |
14 #include "ui/events/event_constants.h" | 15 #include "ui/events/event_constants.h" |
15 #include "ui/events/event_handler.h" | 16 #include "ui/events/event_handler.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 void SetUp() override { | 65 void SetUp() override { |
65 test::AshTestBase::SetUp(); | 66 test::AshTestBase::SetUp(); |
66 Shell::Get()->AddPreTargetHandler(&mouse_event_capturer_); | 67 Shell::Get()->AddPreTargetHandler(&mouse_event_capturer_); |
67 GetAutoclickController()->SetAutoclickDelay(base::TimeDelta()); | 68 GetAutoclickController()->SetAutoclickDelay(base::TimeDelta()); |
68 | 69 |
69 // Move mouse to deterministic location at the start of each test. | 70 // Move mouse to deterministic location at the start of each test. |
70 GetEventGenerator().MoveMouseTo(100, 100); | 71 GetEventGenerator().MoveMouseTo(100, 100); |
71 | 72 |
72 // Make sure the display is initialized so we don't fail the test due to any | 73 // Make sure the display is initialized so we don't fail the test due to any |
73 // input events caused from creating the display. | 74 // input events caused from creating the display. |
74 if (!ShellPort::Get()->IsRunningInMash()) | 75 if (Shell::GetAshConfig() != Config::MASH) |
75 Shell::Get()->display_manager()->UpdateDisplays(); | 76 Shell::Get()->display_manager()->UpdateDisplays(); |
76 RunAllPendingInMessageLoop(); | 77 RunAllPendingInMessageLoop(); |
77 } | 78 } |
78 | 79 |
79 void TearDown() override { | 80 void TearDown() override { |
80 Shell::Get()->RemovePreTargetHandler(&mouse_event_capturer_); | 81 Shell::Get()->RemovePreTargetHandler(&mouse_event_capturer_); |
81 test::AshTestBase::TearDown(); | 82 test::AshTestBase::TearDown(); |
82 } | 83 } |
83 | 84 |
84 void MoveMouseWithFlagsTo(int x, int y, ui::EventFlags flags) { | 85 void MoveMouseWithFlagsTo(int x, int y, ui::EventFlags flags) { |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 aura::test::EventCountDelegate delegate; | 286 aura::test::EventCountDelegate delegate; |
286 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( | 287 std::unique_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( |
287 &delegate, 123, gfx::Rect(50, 50, 100, 100))); | 288 &delegate, 123, gfx::Rect(50, 50, 100, 100))); |
288 window->Show(); | 289 window->Show(); |
289 events = WaitForMouseEvents(); | 290 events = WaitForMouseEvents(); |
290 EXPECT_EQ(0u, events.size()); | 291 EXPECT_EQ(0u, events.size()); |
291 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); | 292 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); |
292 } | 293 } |
293 | 294 |
294 } // namespace ash | 295 } // namespace ash |
OLD | NEW |