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

Side by Side Diff: ash/autoclick/autoclick_unittest.cc

Issue 1260453006: ui: events: Add a class to hold common touch and stylus properties (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address build problems, add accessor and unit tests. Created 5 years, 4 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 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 16 matching lines...) Expand all
27 } 27 }
28 28
29 void OnMouseEvent(ui::MouseEvent* event) override { 29 void OnMouseEvent(ui::MouseEvent* event) override {
30 if (!(event->flags() & ui::EF_LEFT_MOUSE_BUTTON)) 30 if (!(event->flags() & ui::EF_LEFT_MOUSE_BUTTON))
31 return; 31 return;
32 // Filter out extraneous mouse events like mouse entered, exited, 32 // Filter out extraneous mouse events like mouse entered, exited,
33 // capture changed, etc. 33 // capture changed, etc.
34 ui::EventType type = event->type(); 34 ui::EventType type = event->type();
35 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_PRESSED || 35 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_PRESSED ||
36 type == ui::ET_MOUSE_RELEASED) { 36 type == ui::ET_MOUSE_RELEASED) {
37 events_.push_back(ui::MouseEvent(event->type(), event->location(), 37 events_.push_back(ui::MouseEvent(
38 event->root_location(), 38 event->type(), event->location(), event->root_location(),
39 ui::EventTimeForNow(), event->flags(), 39 ui::EventTimeForNow(), event->flags(), event->changed_button_flags(),
40 event->changed_button_flags())); 40 ui::PointerEventDetails(ui::EventPointerType::POINTER_TYPE_MOUSE)));
41 // Stop event propagation so we don't click on random stuff that 41 // Stop event propagation so we don't click on random stuff that
42 // might break test assumptions. 42 // might break test assumptions.
43 event->StopPropagation(); 43 event->StopPropagation();
44 } 44 }
45 45
46 // If there is a possibility that we're in an infinite loop, we should 46 // If there is a possibility that we're in an infinite loop, we should
47 // exit early with a sensible error rather than letting the test time out. 47 // exit early with a sensible error rather than letting the test time out.
48 ASSERT_LT(events_.size(), 100u); 48 ASSERT_LT(events_.size(), 100u);
49 } 49 }
50 50
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 aura::test::EventCountDelegate delegate; 288 aura::test::EventCountDelegate delegate;
289 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( 289 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
290 &delegate, 123, gfx::Rect(50, 50, 100, 100))); 290 &delegate, 123, gfx::Rect(50, 50, 100, 100)));
291 window->Show(); 291 window->Show();
292 events = WaitForMouseEvents(); 292 events = WaitForMouseEvents();
293 EXPECT_EQ(0u, events.size()); 293 EXPECT_EQ(0u, events.size());
294 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); 294 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset());
295 } 295 }
296 296
297 } // namespace ash 297 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698