| Index: mojo/public/cpp/bindings/tests/struct_unittest.cc
|
| diff --git a/mojo/public/cpp/bindings/tests/struct_unittest.cc b/mojo/public/cpp/bindings/tests/struct_unittest.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..1f73795d0d725cddf137e345799f42372c600e02
|
| --- /dev/null
|
| +++ b/mojo/public/cpp/bindings/tests/struct_unittest.cc
|
| @@ -0,0 +1,45 @@
|
| +// Copyright 2014 The Chromium Authors. All rights reserved.
|
| +// Use of this source code is governed by a BSD-style license that can be
|
| +// found in the LICENSE file.
|
| +
|
| +#include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h"
|
| +#include "testing/gtest/include/gtest/gtest.h"
|
| +
|
| +namespace mojo {
|
| +namespace test {
|
| +namespace {
|
| +
|
| +RectPtr MakeRect() {
|
| + RectPtr rect(Rect::New());
|
| + rect->x = 1;
|
| + rect->y = 2;
|
| + rect->width = 10;
|
| + rect->height = 20;
|
| + return rect.Pass();
|
| +}
|
| +
|
| +void CheckRect(const Rect& rect) {
|
| + EXPECT_EQ(1, rect.x);
|
| + EXPECT_EQ(2, rect.y);
|
| + EXPECT_EQ(10, rect.width);
|
| + EXPECT_EQ(20, rect.height);
|
| +}
|
| +
|
| +} // namespace
|
| +
|
| +TEST(StructTest, Rect) {
|
| + RectPtr rect;
|
| + EXPECT_TRUE(rect.is_null());
|
| + EXPECT_TRUE(!rect);
|
| + EXPECT_FALSE(rect);
|
| +
|
| + rect = MakeRect();
|
| + EXPECT_FALSE(rect.is_null());
|
| + EXPECT_FALSE(!rect);
|
| + EXPECT_TRUE(rect);
|
| +
|
| + CheckRect(*rect);
|
| +}
|
| +
|
| +} // namespace test
|
| +} // namespace mojo
|
|
|