OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/message_loop/message_loop.h" |
| 6 #include "mojo/public/cpp/bindings/binding_set.h" |
| 7 #include "public/platform/WebSize.h" |
| 8 #include "testing/gtest/include/gtest/gtest.h" |
| 9 #include "ui/gfx/geometry/mojo/geometry_traits_test_service.mojom-blink.h" |
| 10 #include "ui/gfx/geometry/point.h" |
| 11 |
| 12 namespace blink { |
| 13 |
| 14 namespace { |
| 15 |
| 16 class WebGeometryStructTraitsTest : public testing::Test, public gfx::mojom::bli
nk::GeometryTraitsTestService { |
| 17 public: |
| 18 WebGeometryStructTraitsTest() {} |
| 19 |
| 20 protected: |
| 21 gfx::mojom::blink::GeometryTraitsTestServicePtr GetTraitsTestProxy() |
| 22 { |
| 23 return m_TraitsTestBindings.CreateInterfacePtrAndBind(this); |
| 24 } |
| 25 |
| 26 private: |
| 27 // GeometryTraitsTestService: |
| 28 void EchoPoint(const gfx::mojom::blink::PointPtr, const EchoPointCallback&) |
| 29 { |
| 30 NOTIMPLEMENTED(); |
| 31 } |
| 32 |
| 33 void EchoPointF(const gfx::mojom::blink::PointFPtr, const EchoPointFCallback
&) |
| 34 { |
| 35 NOTIMPLEMENTED(); |
| 36 } |
| 37 |
| 38 void EchoSize(const WebSize& s, const EchoSizeCallback& callback) |
| 39 { |
| 40 callback.Run(s); |
| 41 } |
| 42 |
| 43 void EchoSizeF(const gfx::mojom::blink::SizeFPtr, const EchoSizeFCallback&) |
| 44 { |
| 45 NOTIMPLEMENTED(); |
| 46 } |
| 47 |
| 48 void EchoRect(const gfx::mojom::blink::RectPtr, const EchoRectCallback&) |
| 49 { |
| 50 NOTIMPLEMENTED(); |
| 51 } |
| 52 |
| 53 void EchoRectF(const gfx::mojom::blink::RectFPtr, const EchoRectFCallback&) |
| 54 { |
| 55 NOTIMPLEMENTED(); |
| 56 } |
| 57 |
| 58 void EchoInsets(const gfx::mojom::blink::InsetsPtr, const EchoInsetsCallback
&) |
| 59 { |
| 60 NOTIMPLEMENTED(); |
| 61 } |
| 62 |
| 63 void EchoInsetsF(const gfx::mojom::blink::InsetsFPtr, const EchoInsetsFCallb
ack&) |
| 64 { |
| 65 NOTIMPLEMENTED(); |
| 66 } |
| 67 |
| 68 void EchoVector2d(const gfx::mojom::blink::Vector2dPtr, const EchoVector2dCa
llback&) |
| 69 { |
| 70 NOTIMPLEMENTED(); |
| 71 } |
| 72 |
| 73 void EchoVector2dF(const gfx::mojom::blink::Vector2dFPtr, const EchoVector2d
FCallback&) |
| 74 { |
| 75 NOTIMPLEMENTED(); |
| 76 } |
| 77 |
| 78 base::MessageLoop m_loop; |
| 79 mojo::BindingSet<gfx::mojom::blink::GeometryTraitsTestService> m_TraitsTestB
indings; |
| 80 |
| 81 DISALLOW_COPY_AND_ASSIGN(WebGeometryStructTraitsTest); |
| 82 }; |
| 83 |
| 84 } // namespace |
| 85 |
| 86 TEST_F(WebGeometryStructTraitsTest, Size) |
| 87 { |
| 88 const int32_t width = 1234; |
| 89 const int32_t height = 5678; |
| 90 WebSize input(width, height); |
| 91 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy()
; |
| 92 WebSize output; |
| 93 proxy->EchoSize(input, &output); |
| 94 EXPECT_EQ(width, output.width); |
| 95 EXPECT_EQ(height, output.height); |
| 96 } |
| 97 |
| 98 } // namespace blink |
OLD | NEW |