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 <utility> | 5 #include <utility> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "mojo/public/cpp/bindings/binding_set.h" | 8 #include "mojo/public/cpp/bindings/binding_set.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "ui/gfx/geometry/mojo/geometry_traits_test_service.mojom-blink.h" | 10 #include "ui/gfx/geometry/mojo/geometry_traits_test_service.mojom-blink.h" |
(...skipping 29 matching lines...) Expand all Loading... |
40 | 40 |
41 void EchoSize(const WebSize& s, EchoSizeCallback callback) override { | 41 void EchoSize(const WebSize& s, EchoSizeCallback callback) override { |
42 std::move(callback).Run(s); | 42 std::move(callback).Run(s); |
43 } | 43 } |
44 | 44 |
45 void EchoSizeF(gfx::mojom::blink::SizeFPtr, EchoSizeFCallback) override { | 45 void EchoSizeF(gfx::mojom::blink::SizeFPtr, EchoSizeFCallback) override { |
46 // The type map is not specified. | 46 // The type map is not specified. |
47 NOTREACHED(); | 47 NOTREACHED(); |
48 } | 48 } |
49 | 49 |
50 void EchoRect(gfx::mojom::blink::RectPtr, EchoRectCallback) override { | 50 void EchoRect(const WebRect& r, EchoRectCallback callback) override { |
51 // The type map is not specified. | 51 std::move(callback).Run(r); |
52 NOTREACHED(); | |
53 } | 52 } |
54 | 53 |
55 void EchoRectF(const WebFloatRect& r, EchoRectFCallback callback) override { | 54 void EchoRectF(const WebFloatRect& r, EchoRectFCallback callback) override { |
56 std::move(callback).Run(r); | 55 std::move(callback).Run(r); |
57 } | 56 } |
58 | 57 |
59 void EchoInsets(gfx::mojom::blink::InsetsPtr, EchoInsetsCallback) override { | 58 void EchoInsets(gfx::mojom::blink::InsetsPtr, EchoInsetsCallback) override { |
60 // The type map is not specified. | 59 // The type map is not specified. |
61 NOTREACHED(); | 60 NOTREACHED(); |
62 } | 61 } |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 TEST_F(GeometryStructTraitsTest, PointF) { | 101 TEST_F(GeometryStructTraitsTest, PointF) { |
103 const float kX = 1.234; | 102 const float kX = 1.234; |
104 const float kY = 5.678; | 103 const float kY = 5.678; |
105 WebFloatPoint input(kX, kY); | 104 WebFloatPoint input(kX, kY); |
106 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy(); | 105 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy(); |
107 WebFloatPoint output; | 106 WebFloatPoint output; |
108 proxy->EchoPointF(input, &output); | 107 proxy->EchoPointF(input, &output); |
109 EXPECT_EQ(input, output); | 108 EXPECT_EQ(input, output); |
110 } | 109 } |
111 | 110 |
| 111 TEST_F(GeometryStructTraitsTest, Rect) { |
| 112 const float kX = 1; |
| 113 const float kY = 2; |
| 114 const float kWidth = 3; |
| 115 const float kHeight = 4; |
| 116 WebRect input(kX, kY, kWidth, kHeight); |
| 117 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy(); |
| 118 WebRect output; |
| 119 proxy->EchoRect(input, &output); |
| 120 EXPECT_EQ(input, output); |
| 121 } |
| 122 |
112 TEST_F(GeometryStructTraitsTest, RectF) { | 123 TEST_F(GeometryStructTraitsTest, RectF) { |
113 const float kX = 1.234; | 124 const float kX = 1.234; |
114 const float kY = 2.345; | 125 const float kY = 2.345; |
115 const float kWidth = 3.456; | 126 const float kWidth = 3.456; |
116 const float kHeight = 4.567; | 127 const float kHeight = 4.567; |
117 WebFloatRect input(kX, kY, kWidth, kHeight); | 128 WebFloatRect input(kX, kY, kWidth, kHeight); |
118 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy(); | 129 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy(); |
119 WebFloatRect output; | 130 WebFloatRect output; |
120 proxy->EchoRectF(input, &output); | 131 proxy->EchoRectF(input, &output); |
121 EXPECT_EQ(input, output); | 132 EXPECT_EQ(input, output); |
122 } | 133 } |
123 | 134 |
124 } // namespace blink | 135 } // namespace blink |
OLD | NEW |