OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/aura/test/event_generator.h" | 5 #include "ui/aura/test/event_generator.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop/message_loop_proxy.h" | 9 #include "base/message_loop/message_loop_proxy.h" |
10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
(...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 // On Windows, WM_KEYDOWN event is followed by WM_CHAR with a character | 441 // On Windows, WM_KEYDOWN event is followed by WM_CHAR with a character |
442 // if the key event cooresponds to a real character. | 442 // if the key event cooresponds to a real character. |
443 key_press = WM_CHAR; | 443 key_press = WM_CHAR; |
444 key_code = static_cast<ui::KeyboardCode>(character); | 444 key_code = static_cast<ui::KeyboardCode>(character); |
445 } | 445 } |
446 MSG native_event = | 446 MSG native_event = |
447 { NULL, (is_press ? key_press : WM_KEYUP), key_code, 0 }; | 447 { NULL, (is_press ? key_press : WM_KEYUP), key_code, 0 }; |
448 TestKeyEvent keyev(native_event, flags, key_press == WM_CHAR); | 448 TestKeyEvent keyev(native_event, flags, key_press == WM_CHAR); |
449 #else | 449 #else |
450 ui::EventType type = is_press ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED; | 450 ui::EventType type = is_press ? ui::ET_KEY_PRESSED : ui::ET_KEY_RELEASED; |
451 #if defined(USE_X11) | |
452 scoped_ptr<XEvent> native_event(new XEvent); | |
453 ui::InitXKeyEventForTesting(type, key_code, flags, native_event.get()); | |
454 TestKeyEvent keyev(native_event.get(), flags, false); | |
455 #else | |
456 ui::KeyEvent keyev(type, key_code, flags, false); | 451 ui::KeyEvent keyev(type, key_code, flags, false); |
457 #endif // USE_X11 | |
458 #endif // OS_WIN | 452 #endif // OS_WIN |
459 Dispatch(&keyev); | 453 Dispatch(&keyev); |
460 } | 454 } |
461 | 455 |
462 void EventGenerator::UpdateCurrentRootWindow(const gfx::Point& point) { | 456 void EventGenerator::UpdateCurrentRootWindow(const gfx::Point& point) { |
463 current_root_window_ = delegate_->GetRootWindowAt(point); | 457 current_root_window_ = delegate_->GetRootWindowAt(point); |
464 } | 458 } |
465 | 459 |
466 void EventGenerator::PressButton(int flag) { | 460 void EventGenerator::PressButton(int flag) { |
467 if (!(flags_ & flag)) { | 461 if (!(flags_ & flag)) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
572 base::MessageLoopProxy::current()->PostTask( | 566 base::MessageLoopProxy::current()->PostTask( |
573 FROM_HERE, | 567 FROM_HERE, |
574 base::Bind(&EventGenerator::DispatchNextPendingEvent, | 568 base::Bind(&EventGenerator::DispatchNextPendingEvent, |
575 base::Unretained(this))); | 569 base::Unretained(this))); |
576 } | 570 } |
577 } | 571 } |
578 | 572 |
579 | 573 |
580 } // namespace test | 574 } // namespace test |
581 } // namespace aura | 575 } // namespace aura |
OLD | NEW |