| 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 <stddef.h> | 5 #include <stddef.h> |
| 6 #include <stdint.h> | 6 #include <stdint.h> |
| 7 #include <stdio.h> | 7 #include <stdio.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| (...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 148 std::vector<uint8_t> data; | 148 std::vector<uint8_t> data; |
| 149 size_t num_handles; | 149 size_t num_handles; |
| 150 if (!ReadAndParseDataFile(GetPath(test, ".data"), &data, &num_handles) || | 150 if (!ReadAndParseDataFile(GetPath(test, ".data"), &data, &num_handles) || |
| 151 !ReadResultFile(GetPath(test, ".expected"), expected)) { | 151 !ReadResultFile(GetPath(test, ".expected"), expected)) { |
| 152 return false; | 152 return false; |
| 153 } | 153 } |
| 154 | 154 |
| 155 message->Initialize(static_cast<uint32_t>(data.size()), | 155 message->Initialize(static_cast<uint32_t>(data.size()), |
| 156 false /* zero_initialized */); | 156 false /* zero_initialized */); |
| 157 if (!data.empty()) | 157 if (!data.empty()) |
| 158 memcpy(message->buffer()->Allocate(data.size()), &data[0], data.size()); | 158 memcpy(message->mutable_data(), &data[0], data.size()); |
| 159 message->mutable_handles()->resize(num_handles); | 159 message->mutable_handles()->resize(num_handles); |
| 160 | 160 |
| 161 return true; | 161 return true; |
| 162 } | 162 } |
| 163 | 163 |
| 164 void RunValidationTests(const std::string& prefix, | 164 void RunValidationTests(const std::string& prefix, |
| 165 MessageReceiver* test_message_receiver) { | 165 MessageReceiver* test_message_receiver) { |
| 166 std::vector<std::string> names = | 166 std::vector<std::string> names = |
| 167 EnumerateSourceRootRelativeDirectory(GetPath("", "")); | 167 EnumerateSourceRootRelativeDirectory(GetPath("", "")); |
| 168 std::vector<std::string> tests = GetMatchingTests(names, prefix); | 168 std::vector<std::string> tests = GetMatchingTests(names, prefix); |
| (...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(0))); | 490 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(0))); |
| 491 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(1))); | 491 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(1))); |
| 492 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(2))); | 492 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(2))); |
| 493 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(3))); | 493 EXPECT_TRUE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(3))); |
| 494 EXPECT_FALSE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(4))); | 494 EXPECT_FALSE(IsKnownEnumValue(static_cast<StructWithEnum::EnumWithin>(4))); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace | 497 } // namespace |
| 498 } // namespace test | 498 } // namespace test |
| 499 } // namespace mojo | 499 } // namespace mojo |
| OLD | NEW |