| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "base/time/time.h" | 10 #include "base/time/time.h" |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 virtual void TearDown() override { | 60 virtual void TearDown() override { |
| 61 emulator_->Disable(); | 61 emulator_->Disable(); |
| 62 EXPECT_EQ("", ExpectedEvents()); | 62 EXPECT_EQ("", ExpectedEvents()); |
| 63 | 63 |
| 64 #if defined(USE_AURA) | 64 #if defined(USE_AURA) |
| 65 aura::Env::DeleteInstance(); | 65 aura::Env::DeleteInstance(); |
| 66 screen_.reset(); | 66 screen_.reset(); |
| 67 #endif | 67 #endif |
| 68 } | 68 } |
| 69 | 69 |
| 70 virtual void ForwardGestureEvent( | 70 void ForwardGestureEvent(const blink::WebGestureEvent& event) override { |
| 71 const blink::WebGestureEvent& event) override { | |
| 72 forwarded_events_.push_back(event.type); | 71 forwarded_events_.push_back(event.type); |
| 73 } | 72 } |
| 74 | 73 |
| 75 virtual void ForwardEmulatedTouchEvent( | 74 void ForwardEmulatedTouchEvent(const blink::WebTouchEvent& event) override { |
| 76 const blink::WebTouchEvent& event) override { | |
| 77 forwarded_events_.push_back(event.type); | 75 forwarded_events_.push_back(event.type); |
| 78 EXPECT_EQ(1U, event.touchesLength); | 76 EXPECT_EQ(1U, event.touchesLength); |
| 79 EXPECT_EQ(last_mouse_x_, event.touches[0].position.x); | 77 EXPECT_EQ(last_mouse_x_, event.touches[0].position.x); |
| 80 EXPECT_EQ(last_mouse_y_, event.touches[0].position.y); | 78 EXPECT_EQ(last_mouse_y_, event.touches[0].position.y); |
| 81 int expectedCancelable = event.type != WebInputEvent::TouchCancel; | 79 int expectedCancelable = event.type != WebInputEvent::TouchCancel; |
| 82 EXPECT_EQ(expectedCancelable, event.cancelable); | 80 EXPECT_EQ(expectedCancelable, event.cancelable); |
| 83 if (ack_touches_synchronously_) { | 81 if (ack_touches_synchronously_) { |
| 84 emulator()->HandleTouchEventAck( | 82 emulator()->HandleTouchEventAck( |
| 85 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); | 83 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); |
| 86 } | 84 } |
| 87 } | 85 } |
| 88 | 86 |
| 89 virtual void SetCursor(const WebCursor& cursor) override {} | 87 void SetCursor(const WebCursor& cursor) override {} |
| 90 | 88 |
| 91 virtual void ShowContextMenuAtPoint(const gfx::Point& point) override {} | 89 void ShowContextMenuAtPoint(const gfx::Point& point) override {} |
| 92 | 90 |
| 93 protected: | 91 protected: |
| 94 TouchEmulator* emulator() const { | 92 TouchEmulator* emulator() const { |
| 95 return emulator_.get(); | 93 return emulator_.get(); |
| 96 } | 94 } |
| 97 | 95 |
| 98 int modifiers() const { | 96 int modifiers() const { |
| 99 return shift_pressed_ ? WebInputEvent::ShiftKey : 0; | 97 return shift_pressed_ ? WebInputEvent::ShiftKey : 0; |
| 100 } | 98 } |
| 101 | 99 |
| (...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 MouseDown(100, 200); | 514 MouseDown(100, 200); |
| 517 EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents()); | 515 EXPECT_EQ("TouchStart GestureTapDown", ExpectedEvents()); |
| 518 MouseUp(200, 200); | 516 MouseUp(200, 200); |
| 519 EXPECT_EQ( | 517 EXPECT_EQ( |
| 520 "TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate" | 518 "TouchMove GestureTapCancel GestureScrollBegin GestureScrollUpdate" |
| 521 " TouchEnd GestureScrollEnd", | 519 " TouchEnd GestureScrollEnd", |
| 522 ExpectedEvents()); | 520 ExpectedEvents()); |
| 523 } | 521 } |
| 524 | 522 |
| 525 } // namespace content | 523 } // namespace content |
| OLD | NEW |