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

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

Issue 2379993003: Mojo C++ bindings: make String16 and gfx::Size available in Blink (Closed)
Patch Set: addressed esprehn and rockot's comments 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 "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
17 : public testing::Test,
18 public gfx::mojom::blink::GeometryTraitsTestService {
19 public:
20 WebGeometryStructTraitsTest() {}
21
22 protected:
23 gfx::mojom::blink::GeometryTraitsTestServicePtr GetTraitsTestProxy() {
24 return m_TraitsTestBindings.CreateInterfacePtrAndBind(this);
25 }
26
27 private:
28 // GeometryTraitsTestService:
29 void EchoPoint(gfx::mojom::blink::PointPtr, const EchoPointCallback&) {
30 // The type map is not specified.
31 NOTREACHED();
32 }
33
34 void EchoPointF(gfx::mojom::blink::PointFPtr, const EchoPointFCallback&) {
35 // The type map is not specified.
36 NOTREACHED();
37 }
38
39 void EchoSize(const WebSize& s, const EchoSizeCallback& callback) {
40 callback.Run(s);
41 }
42
43 void EchoSizeF(gfx::mojom::blink::SizeFPtr, const EchoSizeFCallback&) {
44 // The type map is not specified.
45 NOTREACHED();
46 }
47
48 void EchoRect(gfx::mojom::blink::RectPtr, const EchoRectCallback&) {
49 // The type map is not specified.
50 NOTREACHED();
51 }
52
53 void EchoRectF(gfx::mojom::blink::RectFPtr, const EchoRectFCallback&) {
54 // The type map is not specified.
55 NOTREACHED();
56 }
57
58 void EchoInsets(gfx::mojom::blink::InsetsPtr, const EchoInsetsCallback&) {
59 // The type map is not specified.
60 NOTREACHED();
61 }
62
63 void EchoInsetsF(gfx::mojom::blink::InsetsFPtr, const EchoInsetsFCallback&) {
64 // The type map is not specified.
65 NOTREACHED();
66 }
67
68 void EchoVector2d(gfx::mojom::blink::Vector2dPtr,
69 const EchoVector2dCallback&) {
70 // The type map is not specified.
71 NOTREACHED();
72 }
73
74 void EchoVector2dF(gfx::mojom::blink::Vector2dFPtr,
75 const EchoVector2dFCallback&) {
76 // The type map is not specified.
77 NOTREACHED();
78 }
79
80 mojo::BindingSet<gfx::mojom::blink::GeometryTraitsTestService>
81 m_TraitsTestBindings;
82
83 base::MessageLoop m_messageLoop;
84
85 DISALLOW_COPY_AND_ASSIGN(WebGeometryStructTraitsTest);
86 };
87
88 } // namespace
89
90 TEST_F(WebGeometryStructTraitsTest, Size) {
91 const int32_t width = 1234;
92 const int32_t height = 5678;
93 WebSize input(width, height);
94 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy();
95 WebSize output;
96 proxy->EchoSize(input, &output);
97 EXPECT_EQ(width, output.width);
98 EXPECT_EQ(height, output.height);
99 }
100
101 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698