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

Side by Side Diff: ui/events/mojo/struct_traits_unittest.cc

Issue 2301593002: Add POINTER_WHEEL_CHANGED event to mojo. (Closed)
Patch Set: rebase Created 4 years, 3 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 | « ui/events/mojo/event_struct_traits.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "base/message_loop/message_loop.h" 5 #include "base/message_loop/message_loop.h"
6 #include "mojo/public/cpp/bindings/binding_set.h" 6 #include "mojo/public/cpp/bindings/binding_set.h"
7 #include "testing/gtest/include/gtest/gtest.h" 7 #include "testing/gtest/include/gtest/gtest.h"
8 #include "ui/events/keycodes/dom/dom_code.h" 8 #include "ui/events/keycodes/dom/dom_code.h"
9 #include "ui/events/mojo/traits_test_service.mojom.h" 9 #include "ui/events/mojo/traits_test_service.mojom.h"
10 10
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 EXPECT_EQ(kTestData[i].location(), output_ptr_event->location()); 200 EXPECT_EQ(kTestData[i].location(), output_ptr_event->location());
201 EXPECT_EQ(kTestData[i].root_location(), output_ptr_event->root_location()); 201 EXPECT_EQ(kTestData[i].root_location(), output_ptr_event->root_location());
202 EXPECT_EQ(kTestData[i].pointer_id(), output_ptr_event->pointer_id()); 202 EXPECT_EQ(kTestData[i].pointer_id(), output_ptr_event->pointer_id());
203 EXPECT_EQ(kTestData[i].changed_button_flags(), 203 EXPECT_EQ(kTestData[i].changed_button_flags(),
204 output_ptr_event->changed_button_flags()); 204 output_ptr_event->changed_button_flags());
205 EXPECT_EQ(kTestData[i].pointer_details(), 205 EXPECT_EQ(kTestData[i].pointer_details(),
206 output_ptr_event->pointer_details()); 206 output_ptr_event->pointer_details());
207 } 207 }
208 } 208 }
209 209
210 TEST_F(StructTraitsTest, MouseWheelEvent) { 210 TEST_F(StructTraitsTest, PointerWheelEvent) {
211 MouseWheelEvent kTestData[] = { 211 MouseWheelEvent kTestData[] = {
212 {gfx::Vector2d(11, 15), gfx::Point(3, 4), gfx::Point(40, 30), 212 {gfx::Vector2d(11, 15), gfx::Point(3, 4), gfx::Point(40, 30),
213 base::TimeTicks(), EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON}, 213 base::TimeTicks(), EF_LEFT_MOUSE_BUTTON, EF_LEFT_MOUSE_BUTTON},
214 {gfx::Vector2d(-5, 3), gfx::Point(40, 3), gfx::Point(4, 0), 214 {gfx::Vector2d(-5, 3), gfx::Point(40, 3), gfx::Point(4, 0),
215 base::TimeTicks(), EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON, 215 base::TimeTicks(), EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON,
216 EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON}, 216 EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON},
217 {gfx::Vector2d(1, 0), gfx::Point(3, 4), gfx::Point(40, 30), 217 {gfx::Vector2d(1, 0), gfx::Point(3, 4), gfx::Point(40, 30),
218 base::TimeTicks(), EF_NONE, EF_NONE}, 218 base::TimeTicks(), EF_NONE, EF_NONE},
219 }; 219 };
220 220
221 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); 221 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy();
222 for (size_t i = 0; i < arraysize(kTestData); i++) { 222 for (size_t i = 0; i < arraysize(kTestData); i++) {
223 std::unique_ptr<Event> output; 223 std::unique_ptr<Event> output;
224 proxy->EchoEvent(Event::Clone(kTestData[i]), &output); 224 proxy->EchoEvent(Event::Clone(ui::PointerEvent(kTestData[i])), &output);
225 EXPECT_TRUE(output->IsMouseWheelEvent()); 225 EXPECT_EQ(ET_POINTER_WHEEL_CHANGED, output->type());
226 226
227 const MouseWheelEvent* output_wheel_event = output->AsMouseWheelEvent(); 227 const PointerEvent* output_pointer_event = output->AsPointerEvent();
228 EXPECT_EQ(kTestData[i].type(), output_wheel_event->type()); 228 EXPECT_EQ(ET_POINTER_WHEEL_CHANGED, output_pointer_event->type());
229 EXPECT_EQ(kTestData[i].flags(), output_wheel_event->flags()); 229 EXPECT_EQ(kTestData[i].flags(), output_pointer_event->flags());
230 EXPECT_EQ(kTestData[i].location(), output_wheel_event->location()); 230 EXPECT_EQ(kTestData[i].location(), output_pointer_event->location());
231 EXPECT_EQ(kTestData[i].root_location(), 231 EXPECT_EQ(kTestData[i].root_location(),
232 output_wheel_event->root_location()); 232 output_pointer_event->root_location());
233 EXPECT_EQ(kTestData[i].offset(), output_wheel_event->offset()); 233 EXPECT_EQ(kTestData[i].offset(),
234 output_pointer_event->pointer_details().offset);
234 } 235 }
235 } 236 }
236 237
237 } // namespace ui 238 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/mojo/event_struct_traits.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698