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

Side by Side Diff: ui/aura/test/event_generator.cc

Issue 250953002: Changing aura::test::EventGenerator to send events through EventSource instead of through EventProc… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@get_event_source
Patch Set: Added WARN_UNUSED_RESULT Created 6 years, 7 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
« no previous file with comments | « no previous file | ui/events/event_source.h » ('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 (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"
11 #include "ui/aura/window_event_dispatcher.h" 11 #include "ui/aura/window_event_dispatcher.h"
12 #include "ui/aura/window_tree_host.h" 12 #include "ui/aura/window_tree_host.h"
13 #include "ui/events/event.h" 13 #include "ui/events/event.h"
14 #include "ui/events/event_source.h"
14 #include "ui/events/event_utils.h" 15 #include "ui/events/event_utils.h"
16 #include "ui/events/test/events_test_utils.h"
15 #include "ui/gfx/vector2d_conversions.h" 17 #include "ui/gfx/vector2d_conversions.h"
16 18
17 #if defined(USE_X11) 19 #if defined(USE_X11)
18 #include <X11/Xlib.h> 20 #include <X11/Xlib.h>
19 #include "ui/base/x/x11_util.h" 21 #include "ui/base/x/x11_util.h"
20 #include "ui/events/event_utils.h" 22 #include "ui/events/event_utils.h"
21 #include "ui/events/test/events_test_utils_x11.h" 23 #include "ui/events/test/events_test_utils_x11.h"
22 #endif 24 #endif
23 25
24 #if defined(OS_WIN) 26 #if defined(OS_WIN)
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 return; 602 return;
601 } 603 }
602 if (pending_events_.empty()) { 604 if (pending_events_.empty()) {
603 base::MessageLoopProxy::current()->PostTask( 605 base::MessageLoopProxy::current()->PostTask(
604 FROM_HERE, 606 FROM_HERE,
605 base::Bind(&EventGenerator::DispatchNextPendingEvent, 607 base::Bind(&EventGenerator::DispatchNextPendingEvent,
606 base::Unretained(this))); 608 base::Unretained(this)));
607 } 609 }
608 pending_events_.push_back(pending_event); 610 pending_events_.push_back(pending_event);
609 } else { 611 } else {
612 ui::EventSource* event_source = current_host_->GetEventSource();
613 ui::EventSourceTestApi event_source_test(event_source);
610 ui::EventDispatchDetails details = 614 ui::EventDispatchDetails details =
611 current_host_->event_processor()->OnEventFromSource(event); 615 event_source_test.SendEventToProcessor(event);
612 CHECK(!details.dispatcher_destroyed); 616 CHECK(!details.dispatcher_destroyed);
613 } 617 }
614 } 618 }
615 619
616 void EventGenerator::DispatchNextPendingEvent() { 620 void EventGenerator::DispatchNextPendingEvent() {
617 DCHECK(!pending_events_.empty()); 621 DCHECK(!pending_events_.empty());
618 ui::Event* event = pending_events_.front(); 622 ui::Event* event = pending_events_.front();
619 DoDispatchEvent(event, false); 623 DoDispatchEvent(event, false);
620 pending_events_.pop_front(); 624 pending_events_.pop_front();
621 delete event; 625 delete event;
622 if (!pending_events_.empty()) { 626 if (!pending_events_.empty()) {
623 base::MessageLoopProxy::current()->PostTask( 627 base::MessageLoopProxy::current()->PostTask(
624 FROM_HERE, 628 FROM_HERE,
625 base::Bind(&EventGenerator::DispatchNextPendingEvent, 629 base::Bind(&EventGenerator::DispatchNextPendingEvent,
626 base::Unretained(this))); 630 base::Unretained(this)));
627 } 631 }
628 } 632 }
629 633
630 634
631 } // namespace test 635 } // namespace test
632 } // namespace aura 636 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | ui/events/event_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698