| Index: ui/aura/root_window_unittest.cc
|
| diff --git a/ui/aura/root_window_unittest.cc b/ui/aura/root_window_unittest.cc
|
| index 2ce2f73d64e1b1800a8e272e85406fdf6a0ef879..6c99d8fed440292bf9a5d298a16baa2a3ad15761 100644
|
| --- a/ui/aura/root_window_unittest.cc
|
| +++ b/ui/aura/root_window_unittest.cc
|
| @@ -430,7 +430,9 @@ class EventFilterRecorder : public ui::EventHandler {
|
| typedef std::vector<ui::EventType> Events;
|
| typedef std::vector<gfx::Point> EventLocations;
|
|
|
| - EventFilterRecorder() {}
|
| + EventFilterRecorder()
|
| + : wait_until_event_(ui::ET_UNKNOWN) {
|
| + }
|
|
|
| const Events& events() const { return events_; }
|
|
|
| @@ -438,6 +440,13 @@ class EventFilterRecorder : public ui::EventHandler {
|
| gfx::Point mouse_location(int i) const { return mouse_locations_[i]; }
|
| const EventLocations& touch_locations() const { return touch_locations_; }
|
|
|
| + void WaitUntilReceivedEvent(ui::EventType type) {
|
| + wait_until_event_ = type;
|
| + run_loop_.reset(new base::RunLoop(
|
| + Env::GetInstance()->GetDispatcher()));
|
| + run_loop_->Run();
|
| + }
|
| +
|
| Events GetAndResetEvents() {
|
| Events events = events_;
|
| Reset();
|
| @@ -454,6 +463,10 @@ class EventFilterRecorder : public ui::EventHandler {
|
| virtual void OnEvent(ui::Event* event) OVERRIDE {
|
| ui::EventHandler::OnEvent(event);
|
| events_.push_back(event->type());
|
| + if (wait_until_event_ == event->type() && run_loop_) {
|
| + run_loop_->Quit();
|
| + wait_until_event_ = ui::ET_UNKNOWN;
|
| + }
|
| }
|
|
|
| virtual void OnMouseEvent(ui::MouseEvent* event) OVERRIDE {
|
| @@ -465,6 +478,9 @@ class EventFilterRecorder : public ui::EventHandler {
|
| }
|
|
|
| private:
|
| + scoped_ptr<base::RunLoop> run_loop_;
|
| + ui::EventType wait_until_event_;
|
| +
|
| Events events_;
|
| EventLocations mouse_locations_;
|
| EventLocations touch_locations_;
|
| @@ -669,13 +685,7 @@ TEST_F(RootWindowTest, MouseMovesHeld) {
|
| EXPECT_TRUE(filter->events().empty());
|
| }
|
|
|
| -#if defined(OS_CHROMEOS)
|
| -// This test may be flaky on Chromium OS valgrind bots: http://crbug.com/333644
|
| -#define MAYBE_TouchMovesHeld DISABLED_TouchMovesHeld
|
| -#else
|
| -#define MAYBE_TouchMovesHeld TouchMovesHeld
|
| -#endif
|
| -TEST_F(RootWindowTest, MAYBE_TouchMovesHeld) {
|
| +TEST_F(RootWindowTest, TouchMovesHeld) {
|
| EventFilterRecorder* filter = new EventFilterRecorder;
|
| root_window()->SetEventFilter(filter); // passes ownership
|
|
|
| @@ -691,7 +701,7 @@ TEST_F(RootWindowTest, MAYBE_TouchMovesHeld) {
|
| 0, base::TimeDelta());
|
| dispatcher()->AsWindowTreeHostDelegate()->OnHostTouchEvent(
|
| &touch_pressed_event);
|
| - RunAllPendingInMessageLoop();
|
| + filter->WaitUntilReceivedEvent(ui::ET_GESTURE_SHOW_PRESS);
|
| filter->Reset();
|
|
|
| dispatcher()->HoldPointerMoves();
|
|
|