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

Side by Side Diff: content/browser/renderer_host/render_widget_host_view_mac_unittest.mm

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 (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 "content/browser/renderer_host/render_widget_host_view_mac.h" 5 #include "content/browser/renderer_host/render_widget_host_view_mac.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 #include <tuple> 10 #include <tuple>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 @synthesize unhandledWheelEventReceived = unhandledWheelEventReceived_; 84 @synthesize unhandledWheelEventReceived = unhandledWheelEventReceived_;
85 85
86 - (void)rendererHandledWheelEvent:(const blink::WebMouseWheelEvent&)event 86 - (void)rendererHandledWheelEvent:(const blink::WebMouseWheelEvent&)event
87 consumed:(BOOL)consumed { 87 consumed:(BOOL)consumed {
88 if (!consumed) 88 if (!consumed)
89 unhandledWheelEventReceived_ = true; 89 unhandledWheelEventReceived_ = true;
90 } 90 }
91 91
92 - (void)rendererHandledGestureScrollEvent:(const blink::WebGestureEvent&)event 92 - (void)rendererHandledGestureScrollEvent:(const blink::WebGestureEvent&)event
93 consumed:(BOOL)consumed { 93 consumed:(BOOL)consumed {
94 if (!consumed && event.type == blink::WebInputEvent::GestureScrollUpdate) 94 if (!consumed && event.type() == blink::WebInputEvent::GestureScrollUpdate)
95 unhandledWheelEventReceived_ = true; 95 unhandledWheelEventReceived_ = true;
96 } 96 }
97 97
98 - (void)touchesBeganWithEvent:(NSEvent*)event {} 98 - (void)touchesBeganWithEvent:(NSEvent*)event {}
99 - (void)touchesMovedWithEvent:(NSEvent*)event {} 99 - (void)touchesMovedWithEvent:(NSEvent*)event {}
100 - (void)touchesCancelledWithEvent:(NSEvent*)event {} 100 - (void)touchesCancelledWithEvent:(NSEvent*)event {}
101 - (void)touchesEndedWithEvent:(NSEvent*)event {} 101 - (void)touchesEndedWithEvent:(NSEvent*)event {}
102 - (void)beginGestureWithEvent:(NSEvent*)event {} 102 - (void)beginGestureWithEvent:(NSEvent*)event {}
103 - (void)endGestureWithEvent:(NSEvent*)event {} 103 - (void)endGestureWithEvent:(NSEvent*)event {}
104 104
105 @end 105 @end
106 106
107 namespace content { 107 namespace content {
108 108
109 namespace { 109 namespace {
110 110
111 std::string GetInputMessageTypes(MockRenderProcessHost* process) { 111 std::string GetInputMessageTypes(MockRenderProcessHost* process) {
112 std::string result; 112 std::string result;
113 for (size_t i = 0; i < process->sink().message_count(); ++i) { 113 for (size_t i = 0; i < process->sink().message_count(); ++i) {
114 const IPC::Message* message = process->sink().GetMessageAt(i); 114 const IPC::Message* message = process->sink().GetMessageAt(i);
115 EXPECT_EQ(InputMsg_HandleInputEvent::ID, message->type()); 115 EXPECT_EQ(InputMsg_HandleInputEvent::ID, message->type());
116 InputMsg_HandleInputEvent::Param params; 116 InputMsg_HandleInputEvent::Param params;
117 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, &params)); 117 EXPECT_TRUE(InputMsg_HandleInputEvent::Read(message, &params));
118 const blink::WebInputEvent* event = std::get<0>(params); 118 const blink::WebInputEvent* event = std::get<0>(params);
119 if (i != 0) 119 if (i != 0)
120 result += " "; 120 result += " ";
121 result += blink::WebInputEvent::GetName(event->type); 121 result += blink::WebInputEvent::GetName(event->type());
122 } 122 }
123 process->sink().ClearMessages(); 123 process->sink().ClearMessages();
124 return result; 124 return result;
125 } 125 }
126 126
127 id MockGestureEvent(NSEventType type, double magnification) { 127 id MockGestureEvent(NSEventType type, double magnification) {
128 id event = [OCMockObject mockForClass:[NSEvent class]]; 128 id event = [OCMockObject mockForClass:[NSEvent class]];
129 NSPoint locationInWindow = NSMakePoint(0, 0); 129 NSPoint locationInWindow = NSMakePoint(0, 0);
130 CGFloat deltaX = 0; 130 CGFloat deltaX = 0;
131 CGFloat deltaY = 0; 131 CGFloat deltaY = 0;
(...skipping 1507 matching lines...) Expand 10 before | Expand all | Expand 10 after
1639 // Verify that this IPC is asking for no monitoring or immediate updates. 1639 // Verify that this IPC is asking for no monitoring or immediate updates.
1640 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child, 1640 InputMsg_RequestCompositionUpdate::Read(composition_request_msg_for_child,
1641 &child_msg_params); 1641 &child_msg_params);
1642 is_child_msg_for_immediate_request = std::get<0>(child_msg_params); 1642 is_child_msg_for_immediate_request = std::get<0>(child_msg_params);
1643 is_child_msg_for_monitor_request = std::get<1>(child_msg_params); 1643 is_child_msg_for_monitor_request = std::get<1>(child_msg_params);
1644 EXPECT_FALSE(is_child_msg_for_immediate_request); 1644 EXPECT_FALSE(is_child_msg_for_immediate_request);
1645 EXPECT_FALSE(is_child_msg_for_monitor_request); 1645 EXPECT_FALSE(is_child_msg_for_monitor_request);
1646 } 1646 }
1647 1647
1648 } // namespace content 1648 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/renderer_host/render_widget_host_view_mac.mm ('k') | content/browser/renderer_host/ui_events_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698