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

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

Issue 2928413002: Add RectF and PointF typemaps in blink. (Closed)
Patch Set: address comment Created 3 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/platform/mojo/GeometryStructTraits.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 15 matching lines...) Expand all
26 return proxy; 26 return proxy;
27 } 27 }
28 28
29 private: 29 private:
30 // GeometryTraitsTestService: 30 // GeometryTraitsTestService:
31 void EchoPoint(gfx::mojom::blink::PointPtr, EchoPointCallback) override { 31 void EchoPoint(gfx::mojom::blink::PointPtr, EchoPointCallback) override {
32 // The type map is not specified. 32 // The type map is not specified.
33 NOTREACHED(); 33 NOTREACHED();
34 } 34 }
35 35
36 void EchoPointF(gfx::mojom::blink::PointFPtr, EchoPointFCallback) override { 36 void EchoPointF(const WebFloatPoint& p,
37 // The type map is not specified. 37 EchoPointFCallback callback) override {
38 NOTREACHED(); 38 std::move(callback).Run(p);
39 } 39 }
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(gfx::mojom::blink::RectPtr, EchoRectCallback) override {
51 // The type map is not specified. 51 // The type map is not specified.
52 NOTREACHED(); 52 NOTREACHED();
53 } 53 }
54 54
55 void EchoRectF(gfx::mojom::blink::RectFPtr, EchoRectFCallback) override { 55 void EchoRectF(const WebFloatRect& r, EchoRectFCallback callback) override {
56 // The type map is not specified. 56 std::move(callback).Run(r);
57 NOTREACHED();
58 } 57 }
59 58
60 void EchoInsets(gfx::mojom::blink::InsetsPtr, EchoInsetsCallback) override { 59 void EchoInsets(gfx::mojom::blink::InsetsPtr, EchoInsetsCallback) override {
61 // The type map is not specified. 60 // The type map is not specified.
62 NOTREACHED(); 61 NOTREACHED();
63 } 62 }
64 63
65 void EchoInsetsF(gfx::mojom::blink::InsetsFPtr, 64 void EchoInsetsF(gfx::mojom::blink::InsetsFPtr,
66 EchoInsetsFCallback) override { 65 EchoInsetsFCallback) override {
67 // The type map is not specified. 66 // The type map is not specified.
(...skipping 25 matching lines...) Expand all
93 TEST_F(GeometryStructTraitsTest, Size) { 92 TEST_F(GeometryStructTraitsTest, Size) {
94 const int32_t kWidth = 1234; 93 const int32_t kWidth = 1234;
95 const int32_t kHeight = 5678; 94 const int32_t kHeight = 5678;
96 WebSize input(kWidth, kHeight); 95 WebSize input(kWidth, kHeight);
97 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy(); 96 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy();
98 WebSize output; 97 WebSize output;
99 proxy->EchoSize(input, &output); 98 proxy->EchoSize(input, &output);
100 EXPECT_EQ(input, output); 99 EXPECT_EQ(input, output);
101 } 100 }
102 101
102 TEST_F(GeometryStructTraitsTest, PointF) {
103 const float kX = 1.234;
104 const float kY = 5.678;
105 WebFloatPoint input(kX, kY);
106 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy();
107 WebFloatPoint output;
108 proxy->EchoPointF(input, &output);
109 EXPECT_EQ(input, output);
110 }
111
112 TEST_F(GeometryStructTraitsTest, RectF) {
113 const float kX = 1.234;
114 const float kY = 2.345;
115 const float kWidth = 3.456;
116 const float kHeight = 4.567;
117 WebFloatRect input(kX, kY, kWidth, kHeight);
118 gfx::mojom::blink::GeometryTraitsTestServicePtr proxy = GetTraitsTestProxy();
119 WebFloatRect output;
120 proxy->EchoRectF(input, &output);
121 EXPECT_EQ(input, output);
122 }
123
103 } // namespace blink 124 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/mojo/GeometryStructTraits.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698