Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1021)

Side by Side Diff: third_party/WebKit/Source/platform/mojo/GeometryStructTraitsTest.cpp

Issue 2379993003: Mojo C++ bindings: make String16 and gfx::Size available in Blink (Closed)
Patch Set: mapping back to WebSize :( Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 "testing/gtest/include/gtest/gtest.h"
8 #include "ui/gfx/geometry/mojo/geometry_traits_test_service.mojom-blink.h"
9
10 namespace blink {
11
12 namespace {
13
14 class GeometryStructTraitsTest
15 : public testing::Test,
16 public gfx::mojom::blink::GeometryTraitsTestService {
17 public:
18 GeometryStructTraitsTest() {}
19
20 protected:
21 gfx::mojom::blink::GeometryTraitsTestServicePtr GetTraitsTestProxy() {
22 return m_TraitsTestBindings.CreateInterfacePtrAndBind(this);
23 }
24
25 private:
26 // GeometryTraitsTestService:
27 void EchoPoint(gfx::mojom::blink::PointPtr, const EchoPointCallback&) {
28 // The type map is not specified.
29 NOTREACHED();
30 }
31
32 void EchoPointF(gfx::mojom::blink::PointFPtr, const EchoPointFCallback&) {
33 // The type map is not specified.
34 NOTREACHED();
35 }
36
37 void EchoSize(const WebSize& s, const EchoSizeCallback& callback) {
38 callback.Run(s);
39 }
40
41 void EchoSizeF(gfx::mojom::blink::SizeFPtr, const EchoSizeFCallback&) {
42 // The type map is not specified.
43 NOTREACHED();
44 }
45
46 void EchoRect(gfx::mojom::blink::RectPtr, const EchoRectCallback&) {
47 // The type map is not specified.
48 NOTREACHED();
49 }
50
51 void EchoRectF(gfx::mojom::blink::RectFPtr, const EchoRectFCallback&) {
52 // The type map is not specified.
53 NOTREACHED();
54 }
55
56 void EchoInsets(gfx::mojom::blink::InsetsPtr, const EchoInsetsCallback&) {
57 // The type map is not specified.
58 NOTREACHED();
59 }
60
61 void EchoInsetsF(gfx::mojom::blink::InsetsFPtr, const EchoInsetsFCallback&) {
62 // The type map is not specified.
63 NOTREACHED();
64 }
65
66 void EchoVector2d(gfx::mojom::blink::Vector2dPtr,
67 const EchoVector2dCallback&) {
68 // The type map is not specified.
69 NOTREACHED();
70 }
71
72 void EchoVector2dF(gfx::mojom::blink::Vector2dFPtr,
73 const EchoVector2dFCallback&) {
74 // The type map is not specified.
75 NOTREACHED();
76 }
77
78 mojo::BindingSet<gfx::mojom::blink::GeometryTraitsTestService>
79 m_TraitsTestBindings;
80
81 base::MessageLoop m_messageLoop;
82
83 DISALLOW_COPY_AND_ASSIGN(GeometryStructTraitsTest);
84 };
85
86 } // namespace
87
88 TEST_F(GeometryStructTraitsTest, Size) {
89 const int32_t width = 1234;
90 const int32_t height = 5678;
91 WebSize input(width, height);
92 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy();
93 WebSize output;
94 proxy->EchoSize(input, &output);
95 EXPECT_EQ(input, output);
96 }
97
98 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698