OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 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 "mojo/public/cpp/bindings/array.h" | 5 #include "mojo/public/cpp/bindings/array.h" |
6 #include "mojo/public/cpp/bindings/lib/array_internal.h" | 6 #include "mojo/public/cpp/bindings/lib/array_internal.h" |
7 #include "mojo/public/cpp/bindings/lib/array_serialization.h" | 7 #include "mojo/public/cpp/bindings/lib/array_serialization.h" |
8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" | 8 #include "mojo/public/cpp/bindings/lib/fixed_buffer.h" |
9 #include "mojo/public/cpp/bindings/tests/container_test_util.h" | 9 #include "mojo/public/cpp/bindings/tests/container_test_util.h" |
10 #include "mojo/public/cpp/environment/environment.h" | 10 #include "mojo/public/cpp/environment/environment.h" |
11 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h" | 11 #include "mojo/public/interfaces/bindings/tests/test_structs.mojom.h" |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace mojo { | 14 namespace mojo { |
15 namespace test { | 15 namespace test { |
16 namespace { | 16 namespace { |
17 | 17 |
18 using mojo::internal::Array_Data; | 18 using mojo::internal::Array_Data; |
19 using mojo::internal::ArrayValidateParams; | 19 using mojo::internal::ArrayValidateParams; |
20 using mojo::internal::FixedBuffer; | 20 using mojo::internal::FixedBuffer; |
21 using mojo::internal::NoValidateParams; | 21 using mojo::internal::NoValidateParams; |
22 using mojo::internal::String_Data; | 22 using mojo::internal::String_Data; |
23 | 23 |
24 class ArrayTest : public testing::Test { | 24 class ArrayTest : public testing::Test { |
25 public: | 25 public: |
26 virtual ~ArrayTest() {} | 26 ~ArrayTest() override {} |
27 | 27 |
28 private: | 28 private: |
29 Environment env_; | 29 Environment env_; |
30 }; | 30 }; |
31 | 31 |
32 // Tests that basic Array operations work. | 32 // Tests that basic Array operations work. |
33 TEST_F(ArrayTest, Basic) { | 33 TEST_F(ArrayTest, Basic) { |
34 Array<char> array(8); | 34 Array<char> array(8); |
35 for (size_t i = 0; i < array.size(); ++i) { | 35 for (size_t i = 0; i < array.size(); ++i) { |
36 char val = static_cast<char>(i * 2); | 36 char val = static_cast<char>(i * 2); |
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
441 EXPECT_TRUE(array[i].moved()); | 441 EXPECT_TRUE(array[i].moved()); |
442 EXPECT_EQ(value_ptrs[i], array[i].ptr()); | 442 EXPECT_EQ(value_ptrs[i], array[i].ptr()); |
443 } | 443 } |
444 array.reset(); | 444 array.reset(); |
445 EXPECT_EQ(0u, MoveOnlyType::num_instances()); | 445 EXPECT_EQ(0u, MoveOnlyType::num_instances()); |
446 } | 446 } |
447 | 447 |
448 } // namespace | 448 } // namespace |
449 } // namespace test | 449 } // namespace test |
450 } // namespace mojo | 450 } // namespace mojo |
OLD | NEW |