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

Side by Side Diff: mojo/public/cpp/bindings/tests/struct_unittest.cc

Issue 294833002: Mojo: more idiomatic C++ bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more Created 6 years, 7 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 | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright 2014 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 "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
6 #include "testing/gtest/include/gtest/gtest.h"
7
8 namespace mojo {
9 namespace test {
10 namespace {
11
12 RectPtr MakeRect() {
13 RectPtr rect(Rect::New());
14 rect->x = 1;
15 rect->y = 2;
16 rect->width = 10;
17 rect->height = 20;
18 return rect.Pass();
19 }
20
21 void CheckRect(const Rect& rect) {
22 EXPECT_EQ(1, rect.x);
23 EXPECT_EQ(2, rect.y);
24 EXPECT_EQ(10, rect.width);
25 EXPECT_EQ(20, rect.height);
26 }
27
28 } // namespace
29
30 TEST(StructTest, Rect) {
31 RectPtr rect;
32 EXPECT_TRUE(rect.is_null());
33 EXPECT_TRUE(!rect);
34 EXPECT_FALSE(rect);
35
36 rect = MakeRect();
37 EXPECT_FALSE(rect.is_null());
38 EXPECT_FALSE(!rect);
39 EXPECT_TRUE(rect);
40
41 CheckRect(*rect);
42 }
43
44 } // namespace test
45 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698