OLD | NEW |
(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 |
OLD | NEW |