| 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 #ifndef MOJO_UI_ASSOCIATES_TEST_HELPERS_H_ | 5 #ifndef MOJO_UI_ASSOCIATES_TEST_HELPERS_H_ |
| 6 #define MOJO_UI_ASSOCIATES_TEST_HELPERS_H_ | 6 #define MOJO_UI_ASSOCIATES_TEST_HELPERS_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| 11 #include "mojo/services/ui/views/interfaces/view_associates.mojom.h" | 11 #include "mojo/services/ui/views/interfaces/view_associates.mojom.h" |
| 12 | 12 |
| 13 namespace test { | 13 namespace test { |
| 14 | 14 |
| 15 template <typename T> | 15 template <typename T> |
| 16 void Capture(const base::Closure& quit, T* out, T value) { | 16 void Capture(const base::Closure& quit, T* out, T value) { |
| 17 *out = std::move(value); | 17 *out = std::move(value); |
| 18 quit.Run(); | 18 quit.Run(); |
| 19 } | 19 } |
| 20 | 20 |
| 21 inline mojo::PointPtr MakePoint(int32_t x, int32_t y) { | 21 inline mojo::PointFPtr MakePointF(float x, float y) { |
| 22 auto result = mojo::Point::New(); | 22 auto result = mojo::PointF::New(); |
| 23 result->x = x; | 23 result->x = x; |
| 24 result->y = y; | 24 result->y = y; |
| 25 return result.Pass(); | 25 return result.Pass(); |
| 26 } | 26 } |
| 27 | 27 |
| 28 inline mojo::TransformPtr MakeDummyTransform(float x) { | 28 inline mojo::TransformPtr MakeDummyTransform(float x) { |
| 29 auto result = mojo::Transform::New(); | 29 auto result = mojo::Transform::New(); |
| 30 result->matrix.resize(16u); | 30 result->matrix.resize(16u); |
| 31 result->matrix[0] = x; | 31 result->matrix[0] = x; |
| 32 return result.Pass(); | 32 return result.Pass(); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 58 } | 58 } |
| 59 | 59 |
| 60 inline mojo::gfx::composition::HitTestResultPtr MakeSimpleHitTestResult( | 60 inline mojo::gfx::composition::HitTestResultPtr MakeSimpleHitTestResult( |
| 61 mojo::gfx::composition::SceneTokenPtr scene_token) { | 61 mojo::gfx::composition::SceneTokenPtr scene_token) { |
| 62 return MakeSimpleHitTestResult(scene_token.Pass(), MakeDummyTransform(0.f)); | 62 return MakeSimpleHitTestResult(scene_token.Pass(), MakeDummyTransform(0.f)); |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace test | 65 } // namespace test |
| 66 | 66 |
| 67 #endif // MOJO_UI_ASSOCIATES_TEST_HELPERS_H_ | 67 #endif // MOJO_UI_ASSOCIATES_TEST_HELPERS_H_ |
| OLD | NEW |