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

Side by Side Diff: ash/wm/sticky_keys_unittest.cc

Issue 66273003: Fix memory leak in sticky keys unit test. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | 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/wm/sticky_keys.h" 5 #include "ash/wm/sticky_keys.h"
6 6
7 #include <X11/Xlib.h> 7 #include <X11/Xlib.h>
8 #undef None 8 #undef None
9 #undef Bool 9 #undef Bool
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 dispatcher.set_target(target_.get()); 92 dispatcher.set_target(target_.get());
93 return event; 93 return event;
94 } 94 }
95 95
96 ui::MouseEvent* GenerateMouseEvent(bool is_button_press) { 96 ui::MouseEvent* GenerateMouseEvent(bool is_button_press) {
97 XEvent* xev = new XEvent(); 97 XEvent* xev = new XEvent();
98 ui::InitXButtonEventForTesting( 98 ui::InitXButtonEventForTesting(
99 is_button_press ? ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED, 99 is_button_press ? ui::ET_MOUSE_PRESSED : ui::ET_MOUSE_RELEASED,
100 0, 100 0,
101 xev); 101 xev);
102 xevs_.push_back(xev);
102 ui::MouseEvent* event = new ui::MouseEvent(xev); 103 ui::MouseEvent* event = new ui::MouseEvent(xev);
103 ui::Event::DispatcherApi dispatcher(event); 104 ui::Event::DispatcherApi dispatcher(event);
104 dispatcher.set_target(target_.get()); 105 dispatcher.set_target(target_.get());
105 return event; 106 return event;
106 } 107 }
107 108
108 ui::MouseWheelEvent* GenerateMouseWheelEvent(int wheel_delta) { 109 ui::MouseWheelEvent* GenerateMouseWheelEvent(int wheel_delta) {
109 EXPECT_FALSE(wheel_delta == 0); 110 EXPECT_FALSE(wheel_delta == 0);
110 XEvent* xev = new XEvent(); 111 XEvent* xev = new XEvent();
111 ui::InitXMouseWheelEventForTesting(wheel_delta, 0, xev); 112 ui::InitXMouseWheelEventForTesting(wheel_delta, 0, xev);
113 xevs_.push_back(xev);
112 ui::MouseWheelEvent* event = new ui::MouseWheelEvent(xev); 114 ui::MouseWheelEvent* event = new ui::MouseWheelEvent(xev);
113 ui::Event::DispatcherApi dispatcher(event); 115 ui::Event::DispatcherApi dispatcher(event);
114 dispatcher.set_target(target_.get()); 116 dispatcher.set_target(target_.get());
115 return event; 117 return event;
116 } 118 }
117 119
118 private: 120 private:
119 scoped_ptr<StubEventTarget> target_; 121 scoped_ptr<StubEventTarget> target_;
120 ScopedVector<XEvent> xevs_; 122 ScopedVector<XEvent> xevs_;
121 }; 123 };
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 sticky_key.HandleMouseEvent(ev.get()); 390 sticky_key.HandleMouseEvent(ev.get());
389 EXPECT_TRUE(ev->flags() & ui::EF_CONTROL_DOWN); 391 EXPECT_TRUE(ev->flags() & ui::EF_CONTROL_DOWN);
390 kev.reset(GenerateKey(true, ui::VKEY_N)); 392 kev.reset(GenerateKey(true, ui::VKEY_N));
391 sticky_key.HandleKeyEvent(kev.get()); 393 sticky_key.HandleKeyEvent(kev.get());
392 kev.reset(GenerateKey(false, ui::VKEY_N)); 394 kev.reset(GenerateKey(false, ui::VKEY_N));
393 sticky_key.HandleKeyEvent(kev.get()); 395 sticky_key.HandleKeyEvent(kev.get());
394 EXPECT_EQ(StickyKeysHandler::LOCKED, sticky_key.current_state()); 396 EXPECT_EQ(StickyKeysHandler::LOCKED, sticky_key.current_state());
395 } 397 }
396 398
397 } // namespace ash 399 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698