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/shell.h" | 6 #include "ash/shell.h" |
7 #include "ash/test/ash_test_base.h" | 7 #include "ash/test/ash_test_base.h" |
8 #include "ui/aura/test/test_window_delegate.h" | 8 #include "ui/aura/test/test_window_delegate.h" |
9 #include "ui/aura/window.h" | 9 #include "ui/aura/window.h" |
10 #include "ui/aura/window_event_dispatcher.h" | 10 #include "ui/aura/window_event_dispatcher.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 | 262 |
263 // Test scroll events. | 263 // Test scroll events. |
264 GetEventGenerator().MoveMouseTo(200, 200); | 264 GetEventGenerator().MoveMouseTo(200, 200); |
265 GetEventGenerator().ScrollSequence( | 265 GetEventGenerator().ScrollSequence( |
266 gfx::Point(100, 100), base::TimeDelta::FromMilliseconds(200), | 266 gfx::Point(100, 100), base::TimeDelta::FromMilliseconds(200), |
267 0, 100, 3, 2); | 267 0, 100, 3, 2); |
268 events = WaitForMouseEvents(); | 268 events = WaitForMouseEvents(); |
269 EXPECT_EQ(0u, events.size()); | 269 EXPECT_EQ(0u, events.size()); |
270 } | 270 } |
271 | 271 |
272 TEST_F(AutoclickTest, SynthesizedMouseMovesIgnored) { | 272 // Fails on official cros trunk build. See crbug.com/489896. |
| 273 #if defined(OFFICIAL_BUILD) |
| 274 #define MAYBE_SynthesizedMouseMovesIgnored DISABLED_SynthesizedMouseMovesIgnored |
| 275 #else |
| 276 #define MAYBE_SynthesizedMouseMovesIgnored SynthesizedMouseMovesIgnored |
| 277 #endif |
| 278 TEST_F(AutoclickTest, MAYBE_SynthesizedMouseMovesIgnored) { |
273 GetAutoclickController()->SetEnabled(true); | 279 GetAutoclickController()->SetEnabled(true); |
274 std::vector<ui::MouseEvent> events; | 280 std::vector<ui::MouseEvent> events; |
275 GetEventGenerator().MoveMouseTo(100, 100); | 281 GetEventGenerator().MoveMouseTo(100, 100); |
276 events = WaitForMouseEvents(); | 282 events = WaitForMouseEvents(); |
277 EXPECT_EQ(2u, events.size()); | 283 EXPECT_EQ(2u, events.size()); |
278 | 284 |
279 // Show a window and make sure the new window is under the cursor. As a | 285 // Show a window and make sure the new window is under the cursor. As a |
280 // result, synthesized mouse events will be dispatched to the window, but it | 286 // result, synthesized mouse events will be dispatched to the window, but it |
281 // should not trigger an autoclick. | 287 // should not trigger an autoclick. |
282 aura::test::EventCountDelegate delegate; | 288 aura::test::EventCountDelegate delegate; |
283 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( | 289 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( |
284 &delegate, 123, gfx::Rect(50, 50, 100, 100))); | 290 &delegate, 123, gfx::Rect(50, 50, 100, 100))); |
285 window->Show(); | 291 window->Show(); |
286 events = WaitForMouseEvents(); | 292 events = WaitForMouseEvents(); |
287 EXPECT_EQ(0u, events.size()); | 293 EXPECT_EQ(0u, events.size()); |
288 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); | 294 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); |
289 } | 295 } |
290 | 296 |
291 } // namespace ash | 297 } // namespace ash |
OLD | NEW |