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

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

Issue 621133002: replace OVERRIDE and FINAL with override and final in ash/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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
« no previous file with comments | « ash/autoclick/autoclick_controller.cc ('k') | ash/content_support/gpu_support_impl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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"
11 #include "ui/events/event.h" 11 #include "ui/events/event.h"
12 #include "ui/events/event_constants.h" 12 #include "ui/events/event_constants.h"
13 #include "ui/events/event_handler.h" 13 #include "ui/events/event_handler.h"
14 #include "ui/events/keycodes/keyboard_codes.h" 14 #include "ui/events/keycodes/keyboard_codes.h"
15 #include "ui/events/test/event_generator.h" 15 #include "ui/events/test/event_generator.h"
16 16
17 namespace ash { 17 namespace ash {
18 18
19 class MouseEventCapturer : public ui::EventHandler { 19 class MouseEventCapturer : public ui::EventHandler {
20 public: 20 public:
21 MouseEventCapturer() { Reset(); } 21 MouseEventCapturer() { Reset(); }
22 virtual ~MouseEventCapturer() {} 22 virtual ~MouseEventCapturer() {}
23 23
24 void Reset() { 24 void Reset() {
25 events_.clear(); 25 events_.clear();
26 } 26 }
27 27
28 virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE { 28 virtual void OnMouseEvent(ui::MouseEvent* event) override {
29 if (!(event->flags() & ui::EF_LEFT_MOUSE_BUTTON)) 29 if (!(event->flags() & ui::EF_LEFT_MOUSE_BUTTON))
30 return; 30 return;
31 // Filter out extraneous mouse events like mouse entered, exited, 31 // Filter out extraneous mouse events like mouse entered, exited,
32 // capture changed, etc. 32 // capture changed, etc.
33 ui::EventType type = event->type(); 33 ui::EventType type = event->type();
34 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_PRESSED || 34 if (type == ui::ET_MOUSE_MOVED || type == ui::ET_MOUSE_PRESSED ||
35 type == ui::ET_MOUSE_RELEASED) { 35 type == ui::ET_MOUSE_RELEASED) {
36 events_.push_back(ui::MouseEvent( 36 events_.push_back(ui::MouseEvent(
37 event->type(), 37 event->type(),
38 event->location(), 38 event->location(),
(...skipping 18 matching lines...) Expand all
57 std::vector<ui::MouseEvent> events_; 57 std::vector<ui::MouseEvent> events_;
58 58
59 DISALLOW_COPY_AND_ASSIGN(MouseEventCapturer); 59 DISALLOW_COPY_AND_ASSIGN(MouseEventCapturer);
60 }; 60 };
61 61
62 class AutoclickTest : public test::AshTestBase { 62 class AutoclickTest : public test::AshTestBase {
63 public: 63 public:
64 AutoclickTest() {} 64 AutoclickTest() {}
65 virtual ~AutoclickTest() {} 65 virtual ~AutoclickTest() {}
66 66
67 virtual void SetUp() OVERRIDE { 67 virtual void SetUp() override {
68 test::AshTestBase::SetUp(); 68 test::AshTestBase::SetUp();
69 Shell::GetInstance()->AddPreTargetHandler(&mouse_event_capturer_); 69 Shell::GetInstance()->AddPreTargetHandler(&mouse_event_capturer_);
70 GetAutoclickController()->SetAutoclickDelay(0); 70 GetAutoclickController()->SetAutoclickDelay(0);
71 71
72 // Move mouse to deterministic location at the start of each test. 72 // Move mouse to deterministic location at the start of each test.
73 GetEventGenerator().MoveMouseTo(100, 100); 73 GetEventGenerator().MoveMouseTo(100, 100);
74 } 74 }
75 75
76 virtual void TearDown() OVERRIDE { 76 virtual void TearDown() override {
77 Shell::GetInstance()->RemovePreTargetHandler(&mouse_event_capturer_); 77 Shell::GetInstance()->RemovePreTargetHandler(&mouse_event_capturer_);
78 test::AshTestBase::TearDown(); 78 test::AshTestBase::TearDown();
79 } 79 }
80 80
81 void MoveMouseWithFlagsTo(int x, int y, ui::EventFlags flags) { 81 void MoveMouseWithFlagsTo(int x, int y, ui::EventFlags flags) {
82 GetEventGenerator().set_flags(flags); 82 GetEventGenerator().set_flags(flags);
83 GetEventGenerator().MoveMouseTo(x, y); 83 GetEventGenerator().MoveMouseTo(x, y);
84 GetEventGenerator().set_flags(ui::EF_NONE); 84 GetEventGenerator().set_flags(ui::EF_NONE);
85 } 85 }
86 86
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
301 aura::test::EventCountDelegate delegate; 301 aura::test::EventCountDelegate delegate;
302 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate( 302 scoped_ptr<aura::Window> window(CreateTestWindowInShellWithDelegate(
303 &delegate, 123, gfx::Rect(50, 50, 100, 100))); 303 &delegate, 123, gfx::Rect(50, 50, 100, 100)));
304 window->Show(); 304 window->Show();
305 events = WaitForMouseEvents(); 305 events = WaitForMouseEvents();
306 EXPECT_EQ(0u, events.size()); 306 EXPECT_EQ(0u, events.size());
307 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset()); 307 EXPECT_EQ("1 1 0", delegate.GetMouseMotionCountsAndReset());
308 } 308 }
309 309
310 } // namespace ash 310 } // namespace ash
OLDNEW
« no previous file with comments | « ash/autoclick/autoclick_controller.cc ('k') | ash/content_support/gpu_support_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698