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

Side by Side Diff: ui/base/test/ui_controls_mac.mm

Issue 141683005: Removes MessageLoop::Type checks in favor of IsCurrent on MessageLoops. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: base:: Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ui/base/ime/win/tsf_input_scope.cc ('k') | ui/gfx/ozone/dri/dri_surface_factory.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 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 "ui/base/test/ui_controls.h" 5 #include "ui/base/test/ui_controls.h"
6 6
7 #import <Cocoa/Cocoa.h> 7 #import <Cocoa/Cocoa.h>
8 #include <mach/mach_time.h> 8 #include <mach/mach_time.h>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 // Win and Linux implement a SendKeyPress() this as a 234 // Win and Linux implement a SendKeyPress() this as a
235 // SendKeyPressAndRelease(), so we should as well (despite the name). 235 // SendKeyPressAndRelease(), so we should as well (despite the name).
236 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window, 236 bool SendKeyPressNotifyWhenDone(gfx::NativeWindow window,
237 ui::KeyboardCode key, 237 ui::KeyboardCode key,
238 bool control, 238 bool control,
239 bool shift, 239 bool shift,
240 bool alt, 240 bool alt,
241 bool command, 241 bool command,
242 const base::Closure& task) { 242 const base::Closure& task) {
243 CHECK(g_ui_controls_enabled); 243 CHECK(g_ui_controls_enabled);
244 DCHECK_EQ(base::MessageLoop::TYPE_UI, base::MessageLoop::current()->type()); 244 DCHECK(base::MessageLoopForUI::IsCurrent());
245 245
246 std::vector<NSEvent*> events; 246 std::vector<NSEvent*> events;
247 SynthesizeKeyEventsSequence( 247 SynthesizeKeyEventsSequence(
248 window, key, control, shift, alt, command, &events); 248 window, key, control, shift, alt, command, &events);
249 249
250 // TODO(suzhe): Using [NSApplication postEvent:atStart:] here causes 250 // TODO(suzhe): Using [NSApplication postEvent:atStart:] here causes
251 // BrowserKeyEventsTest.CommandKeyEvents to fail. See http://crbug.com/49270 251 // BrowserKeyEventsTest.CommandKeyEvents to fail. See http://crbug.com/49270
252 // But using [NSApplication sendEvent:] should be safe for keyboard events, 252 // But using [NSApplication sendEvent:] should be safe for keyboard events,
253 // because until now, no code wants to retrieve the next event when handling 253 // because until now, no code wants to retrieve the next event when handling
254 // a keyboard event. 254 // a keyboard event.
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 364
365 return true; 365 return true;
366 } 366 }
367 367
368 bool SendMouseClick(MouseButton type) { 368 bool SendMouseClick(MouseButton type) {
369 CHECK(g_ui_controls_enabled); 369 CHECK(g_ui_controls_enabled);
370 return SendMouseEventsNotifyWhenDone(type, UP|DOWN, base::Closure()); 370 return SendMouseEventsNotifyWhenDone(type, UP|DOWN, base::Closure());
371 } 371 }
372 372
373 } // namespace ui_controls 373 } // namespace ui_controls
OLDNEW
« no previous file with comments | « ui/base/ime/win/tsf_input_scope.cc ('k') | ui/gfx/ozone/dri/dri_surface_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698