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

Side by Side Diff: content/browser/renderer_host/input/touch_emulator_unittest.cc

Issue 2573073003: Collapse the API surface on WebInputEvent via accessor functions. (Closed)
Patch Set: Fix nits Created 3 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
OLDNEW
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 "content/browser/renderer_host/input/touch_emulator.h" 5 #include "content/browser/renderer_host/input/touch_emulator.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 emulator_->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); 49 emulator_->Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
50 } 50 }
51 51
52 void TearDown() override { 52 void TearDown() override {
53 emulator_->Disable(); 53 emulator_->Disable();
54 EXPECT_EQ("", ExpectedEvents()); 54 EXPECT_EQ("", ExpectedEvents());
55 } 55 }
56 56
57 void ForwardEmulatedGestureEvent( 57 void ForwardEmulatedGestureEvent(
58 const blink::WebGestureEvent& event) override { 58 const blink::WebGestureEvent& event) override {
59 forwarded_events_.push_back(event.type); 59 forwarded_events_.push_back(event.type());
60 } 60 }
61 61
62 void ForwardEmulatedTouchEvent(const blink::WebTouchEvent& event) override { 62 void ForwardEmulatedTouchEvent(const blink::WebTouchEvent& event) override {
63 forwarded_events_.push_back(event.type); 63 forwarded_events_.push_back(event.type());
64 EXPECT_EQ(1U, event.touchesLength); 64 EXPECT_EQ(1U, event.touchesLength);
65 EXPECT_EQ(last_mouse_x_, event.touches[0].position.x); 65 EXPECT_EQ(last_mouse_x_, event.touches[0].position.x);
66 EXPECT_EQ(last_mouse_y_, event.touches[0].position.y); 66 EXPECT_EQ(last_mouse_y_, event.touches[0].position.y);
67 const int all_buttons = WebInputEvent::LeftButtonDown | 67 const int all_buttons = WebInputEvent::LeftButtonDown |
68 WebInputEvent::MiddleButtonDown | WebInputEvent::RightButtonDown; 68 WebInputEvent::MiddleButtonDown | WebInputEvent::RightButtonDown;
69 EXPECT_EQ(0, event.modifiers & all_buttons); 69 EXPECT_EQ(0, event.modifiers() & all_buttons);
70 WebInputEvent::DispatchType expected_dispatch_type = 70 WebInputEvent::DispatchType expected_dispatch_type =
71 event.type == WebInputEvent::TouchCancel 71 event.type() == WebInputEvent::TouchCancel
72 ? WebInputEvent::EventNonBlocking 72 ? WebInputEvent::EventNonBlocking
73 : WebInputEvent::Blocking; 73 : WebInputEvent::Blocking;
74 EXPECT_EQ(expected_dispatch_type, event.dispatchType); 74 EXPECT_EQ(expected_dispatch_type, event.dispatchType);
75 if (ack_touches_synchronously_) { 75 if (ack_touches_synchronously_) {
76 emulator()->HandleTouchEventAck( 76 emulator()->HandleTouchEventAck(
77 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS); 77 event, INPUT_EVENT_ACK_STATE_NO_CONSUMER_EXISTS);
78 } 78 }
79 } 79 }
80 80
81 void SetCursor(const WebCursor& cursor) override { 81 void SetCursor(const WebCursor& cursor) override {
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after
585 emulator()->SetDeviceScaleFactor(1.0f); 585 emulator()->SetDeviceScaleFactor(1.0f);
586 EXPECT_EQ(1.0f, GetCursorScaleFactor()); 586 EXPECT_EQ(1.0f, GetCursorScaleFactor());
587 587
588 TouchEmulator another(this, 4.0f); 588 TouchEmulator another(this, 4.0f);
589 EXPECT_EQ(1.0f, GetCursorScaleFactor()); 589 EXPECT_EQ(1.0f, GetCursorScaleFactor());
590 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE); 590 another.Enable(ui::GestureProviderConfigType::GENERIC_MOBILE);
591 EXPECT_EQ(2.0f, GetCursorScaleFactor()); 591 EXPECT_EQ(2.0f, GetCursorScaleFactor());
592 } 592 }
593 593
594 } // namespace content 594 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/input/touch_emulator.cc ('k') | content/browser/renderer_host/input/touch_event_queue.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698