| Index: third_party/WebKit/Source/platform/mojo/WebGeometryStructTraitsTest.cpp
|
| diff --git a/third_party/WebKit/Source/platform/mojo/WebGeometryStructTraitsTest.cpp b/third_party/WebKit/Source/platform/mojo/WebGeometryStructTraitsTest.cpp
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..79dc5deefca619c3ac82e8d7b472ef18b19c21c0
|
| --- /dev/null
|
| +++ b/third_party/WebKit/Source/platform/mojo/WebGeometryStructTraitsTest.cpp
|
| @@ -0,0 +1,98 @@
|
| +// Copyright 2016 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "base/message_loop/message_loop.h"
|
| +#include "mojo/public/cpp/bindings/binding_set.h"
|
| +#include "public/platform/WebSize.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +#include "ui/gfx/geometry/mojo/geometry_traits_test_service.mojom-blink.h"
|
| +#include "ui/gfx/geometry/point.h"
|
| +
|
| +namespace blink {
|
| +
|
| +namespace {
|
| +
|
| +class WebGeometryStructTraitsTest : public testing::Test, public gfx::mojom::blink::GeometryTraitsTestService {
|
| +public:
|
| + WebGeometryStructTraitsTest() {}
|
| +
|
| +protected:
|
| + gfx::mojom::blink::GeometryTraitsTestServicePtr GetTraitsTestProxy()
|
| + {
|
| + return m_TraitsTestBindings.CreateInterfacePtrAndBind(this);
|
| + }
|
| +
|
| +private:
|
| + // GeometryTraitsTestService:
|
| + void EchoPoint(const gfx::mojom::blink::PointPtr, const EchoPointCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + void EchoPointF(const gfx::mojom::blink::PointFPtr, const EchoPointFCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + void EchoSize(const WebSize& s, const EchoSizeCallback& callback)
|
| + {
|
| + callback.Run(s);
|
| + }
|
| +
|
| + void EchoSizeF(const gfx::mojom::blink::SizeFPtr, const EchoSizeFCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + void EchoRect(const gfx::mojom::blink::RectPtr, const EchoRectCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + void EchoRectF(const gfx::mojom::blink::RectFPtr, const EchoRectFCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + void EchoInsets(const gfx::mojom::blink::InsetsPtr, const EchoInsetsCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + void EchoInsetsF(const gfx::mojom::blink::InsetsFPtr, const EchoInsetsFCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + void EchoVector2d(const gfx::mojom::blink::Vector2dPtr, const EchoVector2dCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + void EchoVector2dF(const gfx::mojom::blink::Vector2dFPtr, const EchoVector2dFCallback&)
|
| + {
|
| + NOTIMPLEMENTED();
|
| + }
|
| +
|
| + base::MessageLoop m_loop;
|
| + mojo::BindingSet<gfx::mojom::blink::GeometryTraitsTestService> m_TraitsTestBindings;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(WebGeometryStructTraitsTest);
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| +TEST_F(WebGeometryStructTraitsTest, Size)
|
| +{
|
| + const int32_t width = 1234;
|
| + const int32_t height = 5678;
|
| + WebSize input(width, height);
|
| + gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy();
|
| + WebSize output;
|
| + proxy->EchoSize(input, &output);
|
| + EXPECT_EQ(width, output.width);
|
| + EXPECT_EQ(height, output.height);
|
| +}
|
| +
|
| +} // namespace blink
|
|
|