| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "components/mus/example/wm/move_loop.h" | 5 #include "components/mus/example/wm/move_loop.h" |
| 6 | 6 |
| 7 #include "components/mus/public/cpp/tests/test_window.h" | 7 #include "components/mus/public/cpp/tests/test_window.h" |
| 8 #include "mojo/converters/input_events/input_events_type_converters.h" | 8 #include "mojo/converters/input_events/input_events_type_converters.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 if (window->bounds().IsEmpty()) | 22 if (window->bounds().IsEmpty()) |
| 23 window->SetBounds(gfx::Rect(100, 200, 300, 400)); | 23 window->SetBounds(gfx::Rect(100, 200, 300, 400)); |
| 24 | 24 |
| 25 gfx::Rect client_area(window->bounds().size()); | 25 gfx::Rect client_area(window->bounds().size()); |
| 26 client_area.Inset(MoveLoop::kResizeSize, MoveLoop::kResizeSize + 10, | 26 client_area.Inset(MoveLoop::kResizeSize, MoveLoop::kResizeSize + 10, |
| 27 MoveLoop::kResizeSize, MoveLoop::kResizeSize); | 27 MoveLoop::kResizeSize, MoveLoop::kResizeSize); |
| 28 window->SetClientArea(client_area); | 28 window->SetClientArea(client_area); |
| 29 } | 29 } |
| 30 | 30 |
| 31 mus::mojom::EventPtr CreatePointerDownEvent(const gfx::Point& location) { | 31 mus::mojom::EventPtr CreatePointerDownEvent(const gfx::Point& location) { |
| 32 const ui::TouchEvent event(ui::ET_TOUCH_PRESSED, gfx::PointF(location), 1, | 32 const ui::TouchEvent event(ui::ET_TOUCH_PRESSED, location, 1, |
| 33 base::TimeDelta()); | 33 base::TimeDelta()); |
| 34 return mus::mojom::Event::From(static_cast<const ui::Event&>(event)); | 34 return mus::mojom::Event::From(static_cast<const ui::Event&>(event)); |
| 35 } | 35 } |
| 36 | 36 |
| 37 mus::mojom::EventPtr CreatePointerMove(const gfx::Point& location) { | 37 mus::mojom::EventPtr CreatePointerMove(const gfx::Point& location) { |
| 38 const ui::TouchEvent event(ui::ET_TOUCH_MOVED, gfx::PointF(location), 1, | 38 const ui::TouchEvent event(ui::ET_TOUCH_MOVED, location, 1, |
| 39 base::TimeDelta()); | 39 base::TimeDelta()); |
| 40 return mus::mojom::Event::From(static_cast<const ui::Event&>(event)); | 40 return mus::mojom::Event::From(static_cast<const ui::Event&>(event)); |
| 41 } | 41 } |
| 42 | 42 |
| 43 enum class HorizontalLocation { | 43 enum class HorizontalLocation { |
| 44 LEFT, | 44 LEFT, |
| 45 MIDDLE, | 45 MIDDLE, |
| 46 RIGHT, | 46 RIGHT, |
| 47 }; | 47 }; |
| 48 | 48 |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 171 ASSERT_TRUE(move_loop.get()) << i; | 171 ASSERT_TRUE(move_loop.get()) << i; |
| 172 for (int j = 0; j < data[i].delta_count; ++j) { | 172 for (int j = 0; j < data[i].delta_count; ++j) { |
| 173 pointer_location.Offset(data[i].delta_x[j], data[i].delta_y[j]); | 173 pointer_location.Offset(data[i].delta_x[j], data[i].delta_y[j]); |
| 174 ASSERT_EQ(MoveLoop::MoveResult::CONTINUE, | 174 ASSERT_EQ(MoveLoop::MoveResult::CONTINUE, |
| 175 move_loop->Move(*CreatePointerMove(pointer_location))) | 175 move_loop->Move(*CreatePointerMove(pointer_location))) |
| 176 << i << " " << j; | 176 << i << " " << j; |
| 177 } | 177 } |
| 178 ASSERT_EQ(data[i].expected_bounds, window.bounds()); | 178 ASSERT_EQ(data[i].expected_bounds, window.bounds()); |
| 179 } | 179 } |
| 180 } | 180 } |
| OLD | NEW |