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

Side by Side Diff: ui/events/x/device_data_manager_x11_unittest.cc

Issue 683553002: Standardize usage of virtual/override/final specifiers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 1 month 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 | « ui/events/x/device_data_manager_x11.h ('k') | ui/events/x/events_x_unittest.cc » ('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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "ui/events/x/device_data_manager_x11.h" 5 #include "ui/events/x/device_data_manager_x11.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 // Generically-named #defines from Xlib that conflict with symbols in GTest. 9 // Generically-named #defines from Xlib that conflict with symbols in GTest.
10 #undef Bool 10 #undef Bool
(...skipping 11 matching lines...) Expand all
22 namespace { 22 namespace {
23 23
24 class TestInputDeviceObserver : public InputDeviceEventObserver { 24 class TestInputDeviceObserver : public InputDeviceEventObserver {
25 public: 25 public:
26 explicit TestInputDeviceObserver(DeviceDataManagerX11* manager) 26 explicit TestInputDeviceObserver(DeviceDataManagerX11* manager)
27 : manager_(manager), change_notified_(false) { 27 : manager_(manager), change_notified_(false) {
28 if (manager_) 28 if (manager_)
29 manager_->AddObserver(this); 29 manager_->AddObserver(this);
30 } 30 }
31 31
32 virtual ~TestInputDeviceObserver() { 32 ~TestInputDeviceObserver() override {
33 if (manager_) 33 if (manager_)
34 manager_->RemoveObserver(this); 34 manager_->RemoveObserver(this);
35 } 35 }
36 36
37 // InputDeviceEventObserver implementation. 37 // InputDeviceEventObserver implementation.
38 virtual void OnTouchscreenDeviceConfigurationChanged() override {} 38 void OnTouchscreenDeviceConfigurationChanged() override {}
39 virtual void OnKeyboardDeviceConfigurationChanged() override { 39 void OnKeyboardDeviceConfigurationChanged() override {
40 change_notified_ = true; 40 change_notified_ = true;
41 } 41 }
42 42
43 int change_notified() const { return change_notified_; } 43 int change_notified() const { return change_notified_; }
44 void Reset() { change_notified_ = false; } 44 void Reset() { change_notified_ = false; }
45 45
46 private: 46 private:
47 DeviceDataManager* manager_; 47 DeviceDataManager* manager_;
48 bool change_notified_; 48 bool change_notified_;
49 49
50 DISALLOW_COPY_AND_ASSIGN(TestInputDeviceObserver); 50 DISALLOW_COPY_AND_ASSIGN(TestInputDeviceObserver);
51 }; 51 };
52 52
53 } // namespace 53 } // namespace
54 54
55 class DeviceDataManagerX11Test : public testing::Test { 55 class DeviceDataManagerX11Test : public testing::Test {
56 public: 56 public:
57 DeviceDataManagerX11Test() {} 57 DeviceDataManagerX11Test() {}
58 virtual ~DeviceDataManagerX11Test() {} 58 ~DeviceDataManagerX11Test() override {}
59 59
60 virtual void SetUp() override { DeviceDataManagerX11::CreateInstance(); } 60 void SetUp() override { DeviceDataManagerX11::CreateInstance(); }
61 61
62 virtual void TearDown() override { 62 void TearDown() override {
63 SetKeyboardDevices(std::vector<KeyboardDevice>()); 63 SetKeyboardDevices(std::vector<KeyboardDevice>());
64 } 64 }
65 65
66 virtual void SetKeyboardDevices(const std::vector<KeyboardDevice>& devices) { 66 virtual void SetKeyboardDevices(const std::vector<KeyboardDevice>& devices) {
67 DeviceHotplugEventObserver* manager = DeviceDataManagerX11::GetInstance(); 67 DeviceHotplugEventObserver* manager = DeviceDataManagerX11::GetInstance();
68 manager->OnKeyboardDevicesUpdated(devices); 68 manager->OnKeyboardDevicesUpdated(devices);
69 } 69 }
70 70
71 private: 71 private:
72 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11Test); 72 DISALLOW_COPY_AND_ASSIGN(DeviceDataManagerX11Test);
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 // Replug in the first device. Should be notified of the new device. 173 // Replug in the first device. Should be notified of the new device.
174 SetKeyboardDevices(all_keyboards); 174 SetKeyboardDevices(all_keyboards);
175 EXPECT_TRUE(observer.change_notified()); 175 EXPECT_TRUE(observer.change_notified());
176 devices = manager->keyboard_devices(); 176 devices = manager->keyboard_devices();
177 // Both devices now present. 177 // Both devices now present.
178 EXPECT_EQ(2u, devices.size()); 178 EXPECT_EQ(2u, devices.size());
179 } 179 }
180 180
181 } // namespace test 181 } // namespace test
182 } // namespace ui 182 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/x/device_data_manager_x11.h ('k') | ui/events/x/events_x_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698