| 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 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_ | 5 #ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_ |
| 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_ | 6 #define MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_ |
| 7 | 7 |
| 8 #include <stddef.h> |
| 8 #include <stdint.h> | 9 #include <stdint.h> |
| 9 | 10 |
| 10 #include <string> | 11 #include <string> |
| 11 #include <vector> | 12 #include <vector> |
| 12 | 13 |
| 13 namespace mojo { | 14 namespace mojo { |
| 14 namespace test { | 15 namespace test { |
| 15 | 16 |
| 16 // Input Format of Mojo Message Validation Tests. | 17 // Input Format of Mojo Message Validation Tests. |
| 17 // | 18 // |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 // Type: handles | 64 // Type: handles |
| 64 // Description: The number of handles that are associated with the message. This | 65 // Description: The number of handles that are associated with the message. This |
| 65 // special item is not part of the message data. If specified, it should be the | 66 // special item is not part of the message data. If specified, it should be the |
| 66 // first item. | 67 // first item. |
| 67 // Value Format: The same format as u1/2/4/8. | 68 // Value Format: The same format as u1/2/4/8. |
| 68 // | 69 // |
| 69 // EXAMPLE: | 70 // EXAMPLE: |
| 70 // | 71 // |
| 71 // Suppose you have the following Mojo types defined: | 72 // Suppose you have the following Mojo types defined: |
| 72 // struct Bar { | 73 // struct Bar { |
| 73 // int32 a; | 74 // int32_t a; |
| 74 // bool b; | 75 // bool b; |
| 75 // bool c; | 76 // bool c; |
| 76 // }; | 77 // }; |
| 77 // struct Foo { | 78 // struct Foo { |
| 78 // Bar x; | 79 // Bar x; |
| 79 // uint32 y; | 80 // uint32_t y; |
| 80 // }; | 81 // }; |
| 81 // | 82 // |
| 82 // The following describes a valid message whose payload is a Foo struct: | 83 // The following describes a valid message whose payload is a Foo struct: |
| 83 // // message header | 84 // // message header |
| 84 // [dist4]message_header // num_bytes | 85 // [dist4]message_header // num_bytes |
| 85 // [u4]3 // version | 86 // [u4]3 // version |
| 86 // [u4]0 // type | 87 // [u4]0 // type |
| 87 // [u4]1 // flags | 88 // [u4]1 // flags |
| 88 // [u8]1234 // request_id | 89 // [u8]1234 // request_id |
| 89 // [anchr]message_header | 90 // [anchr]message_header |
| (...skipping 21 matching lines...) Expand all Loading... |
| 111 // Note: For now, this method only works on little-endian platforms. | 112 // Note: For now, this method only works on little-endian platforms. |
| 112 bool ParseValidationTestInput(const std::string& input, | 113 bool ParseValidationTestInput(const std::string& input, |
| 113 std::vector<uint8_t>* data, | 114 std::vector<uint8_t>* data, |
| 114 size_t* num_handles, | 115 size_t* num_handles, |
| 115 std::string* error_message); | 116 std::string* error_message); |
| 116 | 117 |
| 117 } // namespace test | 118 } // namespace test |
| 118 } // namespace mojo | 119 } // namespace mojo |
| 119 | 120 |
| 120 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_ | 121 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_ |
| OLD | NEW |