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

Side by Side Diff: ui/views/controls/menu/menu_controller_unittest.cc

Issue 683563002: 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
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/views/controls/menu/menu_controller.h" 5 #include "ui/views/controls/menu/menu_controller.h"
6 6
7 #include "base/run_loop.h" 7 #include "base/run_loop.h"
8 #include "ui/aura/scoped_window_targeter.h" 8 #include "ui/aura/scoped_window_targeter.h"
9 #include "ui/aura/window.h" 9 #include "ui/aura/window.h"
10 #include "ui/events/event_targeter.h" 10 #include "ui/events/event_targeter.h"
(...skipping 14 matching lines...) Expand all
25 #include "ui/events/event.h" 25 #include "ui/events/event.h"
26 #endif 26 #endif
27 27
28 namespace views { 28 namespace views {
29 29
30 namespace { 30 namespace {
31 31
32 class TestMenuItemView : public MenuItemView { 32 class TestMenuItemView : public MenuItemView {
33 public: 33 public:
34 TestMenuItemView() : MenuItemView(NULL) {} 34 TestMenuItemView() : MenuItemView(NULL) {}
35 virtual ~TestMenuItemView() {} 35 ~TestMenuItemView() override {}
36 36
37 private: 37 private:
38 DISALLOW_COPY_AND_ASSIGN(TestMenuItemView); 38 DISALLOW_COPY_AND_ASSIGN(TestMenuItemView);
39 }; 39 };
40 40
41 class TestPlatformEventSource : public ui::PlatformEventSource { 41 class TestPlatformEventSource : public ui::PlatformEventSource {
42 public: 42 public:
43 TestPlatformEventSource() { 43 TestPlatformEventSource() {
44 #if defined(USE_X11) 44 #if defined(USE_X11)
45 ui::DeviceDataManagerX11::CreateInstance(); 45 ui::DeviceDataManagerX11::CreateInstance();
46 #endif 46 #endif
47 } 47 }
48 virtual ~TestPlatformEventSource() {} 48 ~TestPlatformEventSource() override {}
49 49
50 uint32_t Dispatch(const ui::PlatformEvent& event) { 50 uint32_t Dispatch(const ui::PlatformEvent& event) {
51 return DispatchEvent(event); 51 return DispatchEvent(event);
52 } 52 }
53 53
54 private: 54 private:
55 DISALLOW_COPY_AND_ASSIGN(TestPlatformEventSource); 55 DISALLOW_COPY_AND_ASSIGN(TestPlatformEventSource);
56 }; 56 };
57 57
58 class TestNullTargeter : public ui::EventTargeter { 58 class TestNullTargeter : public ui::EventTargeter {
59 public: 59 public:
60 TestNullTargeter() {} 60 TestNullTargeter() {}
61 virtual ~TestNullTargeter() {} 61 ~TestNullTargeter() override {}
62 62
63 virtual ui::EventTarget* FindTargetForEvent(ui::EventTarget* root, 63 ui::EventTarget* FindTargetForEvent(ui::EventTarget* root,
64 ui::Event* event) override { 64 ui::Event* event) override {
65 return NULL; 65 return NULL;
66 } 66 }
67 67
68 private: 68 private:
69 DISALLOW_COPY_AND_ASSIGN(TestNullTargeter); 69 DISALLOW_COPY_AND_ASSIGN(TestNullTargeter);
70 }; 70 };
71 71
72 class TestDispatcherClient : public aura::client::DispatcherClient { 72 class TestDispatcherClient : public aura::client::DispatcherClient {
73 public: 73 public:
74 TestDispatcherClient() : dispatcher_(NULL) {} 74 TestDispatcherClient() : dispatcher_(NULL) {}
75 virtual ~TestDispatcherClient() {} 75 ~TestDispatcherClient() override {}
76 76
77 base::MessagePumpDispatcher* dispatcher() { 77 base::MessagePumpDispatcher* dispatcher() {
78 return dispatcher_; 78 return dispatcher_;
79 } 79 }
80 80
81 // aura::client::DispatcherClient: 81 // aura::client::DispatcherClient:
82 virtual void PrepareNestedLoopClosures( 82 void PrepareNestedLoopClosures(base::MessagePumpDispatcher* dispatcher,
83 base::MessagePumpDispatcher* dispatcher, 83 base::Closure* run_closure,
84 base::Closure* run_closure, 84 base::Closure* quit_closure) override {
85 base::Closure* quit_closure) override {
86 scoped_ptr<base::RunLoop> run_loop(new base::RunLoop()); 85 scoped_ptr<base::RunLoop> run_loop(new base::RunLoop());
87 *quit_closure = run_loop->QuitClosure(); 86 *quit_closure = run_loop->QuitClosure();
88 *run_closure = base::Bind(&TestDispatcherClient::RunNestedDispatcher, 87 *run_closure = base::Bind(&TestDispatcherClient::RunNestedDispatcher,
89 base::Unretained(this), 88 base::Unretained(this),
90 base::Passed(&run_loop), 89 base::Passed(&run_loop),
91 dispatcher); 90 dispatcher);
92 } 91 }
93 92
94 private: 93 private:
95 void RunNestedDispatcher(scoped_ptr<base::RunLoop> run_loop, 94 void RunNestedDispatcher(scoped_ptr<base::RunLoop> run_loop,
96 base::MessagePumpDispatcher* dispatcher) { 95 base::MessagePumpDispatcher* dispatcher) {
97 base::AutoReset<base::MessagePumpDispatcher*> reset_dispatcher(&dispatcher_, 96 base::AutoReset<base::MessagePumpDispatcher*> reset_dispatcher(&dispatcher_,
98 dispatcher); 97 dispatcher);
99 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); 98 base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
100 base::MessageLoop::ScopedNestableTaskAllower allow(loop); 99 base::MessageLoop::ScopedNestableTaskAllower allow(loop);
101 run_loop->Run(); 100 run_loop->Run();
102 } 101 }
103 102
104 base::MessagePumpDispatcher* dispatcher_; 103 base::MessagePumpDispatcher* dispatcher_;
105 104
106 DISALLOW_COPY_AND_ASSIGN(TestDispatcherClient); 105 DISALLOW_COPY_AND_ASSIGN(TestDispatcherClient);
107 }; 106 };
108 107
109 } // namespace 108 } // namespace
110 109
111 class MenuControllerTest : public ViewsTestBase { 110 class MenuControllerTest : public ViewsTestBase {
112 public: 111 public:
113 MenuControllerTest() : controller_(NULL) {} 112 MenuControllerTest() : controller_(NULL) {}
114 virtual ~MenuControllerTest() { 113 ~MenuControllerTest() override { ResetMenuController(); }
115 ResetMenuController();
116 }
117 114
118 // Dispatches |count| number of items, each in a separate iteration of the 115 // Dispatches |count| number of items, each in a separate iteration of the
119 // message-loop, by posting a task. 116 // message-loop, by posting a task.
120 void Step3_DispatchEvents(int count) { 117 void Step3_DispatchEvents(int count) {
121 base::MessageLoopForUI* loop = base::MessageLoopForUI::current(); 118 base::MessageLoopForUI* loop = base::MessageLoopForUI::current();
122 base::MessageLoop::ScopedNestableTaskAllower allow(loop); 119 base::MessageLoop::ScopedNestableTaskAllower allow(loop);
123 controller_->exit_type_ = MenuController::EXIT_ALL; 120 controller_->exit_type_ = MenuController::EXIT_ALL;
124 121
125 DispatchEvent(); 122 DispatchEvent();
126 if (count) { 123 if (count) {
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
263 FROM_HERE, 260 FROM_HERE,
264 base::Bind(&MenuControllerTest::DispatchEscapeAndExpect, 261 base::Bind(&MenuControllerTest::DispatchEscapeAndExpect,
265 base::Unretained(this), 262 base::Unretained(this),
266 MenuController::EXIT_NONE)); 263 MenuController::EXIT_NONE));
267 RunMenu(owner.get()); 264 RunMenu(owner.get());
268 } 265 }
269 } 266 }
270 #endif 267 #endif
271 268
272 } // namespace views 269 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/controls/menu/menu_controller.h ('k') | ui/views/controls/menu/menu_event_dispatcher_linux.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698