| OLD | NEW |
| 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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON, | 173 EF_MIDDLE_MOUSE_BUTTON | EF_RIGHT_MOUSE_BUTTON, |
| 174 PointerEvent::kMousePointerId, EF_RIGHT_MOUSE_BUTTON, | 174 PointerEvent::kMousePointerId, EF_RIGHT_MOUSE_BUTTON, |
| 175 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), base::TimeTicks()}, | 175 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), base::TimeTicks()}, |
| 176 {ET_POINTER_EXITED, gfx::Point(10, 10), gfx::Point(20, 30), | 176 {ET_POINTER_EXITED, gfx::Point(10, 10), gfx::Point(20, 30), |
| 177 EF_BACK_MOUSE_BUTTON, PointerEvent::kMousePointerId, 0, | 177 EF_BACK_MOUSE_BUTTON, PointerEvent::kMousePointerId, 0, |
| 178 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), base::TimeTicks()}, | 178 PointerDetails(EventPointerType::POINTER_TYPE_MOUSE), base::TimeTicks()}, |
| 179 | 179 |
| 180 // Touch pointer events: | 180 // Touch pointer events: |
| 181 {ET_POINTER_DOWN, gfx::Point(10, 10), gfx::Point(20, 30), EF_NONE, 1, 0, | 181 {ET_POINTER_DOWN, gfx::Point(10, 10), gfx::Point(20, 30), EF_NONE, 1, 0, |
| 182 PointerDetails(EventPointerType::POINTER_TYPE_TOUCH, 1.0, 2.0, 3.0, 4.0, | 182 PointerDetails(EventPointerType::POINTER_TYPE_TOUCH, 1.0, 2.0, 3.0, 4.0, |
| 183 5.0), | 183 5.0, 0.0f, 0), |
| 184 base::TimeTicks()}, | 184 base::TimeTicks()}, |
| 185 {ET_POINTER_CANCELLED, gfx::Point(120, 120), gfx::Point(2, 3), EF_NONE, 2, | 185 {ET_POINTER_CANCELLED, gfx::Point(120, 120), gfx::Point(2, 3), EF_NONE, 2, |
| 186 0, PointerDetails(EventPointerType::POINTER_TYPE_TOUCH, 5.5, 4.5, 3.5, | 186 0, PointerDetails(EventPointerType::POINTER_TYPE_TOUCH, 5.5, 4.5, 3.5, |
| 187 2.5, 0.5), | 187 2.5, 0.5, 0.0f, 0), |
| 188 base::TimeTicks()}, | 188 base::TimeTicks()}, |
| 189 }; | 189 }; |
| 190 | 190 |
| 191 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); | 191 mojom::TraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 192 for (size_t i = 0; i < arraysize(kTestData); i++) { | 192 for (size_t i = 0; i < arraysize(kTestData); i++) { |
| 193 std::unique_ptr<Event> output; | 193 std::unique_ptr<Event> output; |
| 194 proxy->EchoEvent(Event::Clone(kTestData[i]), &output); | 194 proxy->EchoEvent(Event::Clone(kTestData[i]), &output); |
| 195 EXPECT_TRUE(output->IsPointerEvent()); | 195 EXPECT_TRUE(output->IsPointerEvent()); |
| 196 | 196 |
| 197 const PointerEvent* output_ptr_event = output->AsPointerEvent(); | 197 const PointerEvent* output_ptr_event = output->AsPointerEvent(); |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 EXPECT_EQ(kTestData[i].flags(), output_pointer_event->flags()); | 229 EXPECT_EQ(kTestData[i].flags(), output_pointer_event->flags()); |
| 230 EXPECT_EQ(kTestData[i].location(), output_pointer_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_pointer_event->root_location()); | 232 output_pointer_event->root_location()); |
| 233 EXPECT_EQ(kTestData[i].offset(), | 233 EXPECT_EQ(kTestData[i].offset(), |
| 234 output_pointer_event->pointer_details().offset); | 234 output_pointer_event->pointer_details().offset); |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 } // namespace ui | 238 } // namespace ui |
| OLD | NEW |