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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // anchr item with the same ID. A dist8 and anchr pair can be used to easily | 53 // anchr item with the same ID. A dist8 and anchr pair can be used to easily |
54 // represent an encoded pointer. A dist4 and anchr pair can be used to easily | 54 // represent an encoded pointer. A dist4 and anchr pair can be used to easily |
55 // calculate struct/array size. | 55 // calculate struct/array size. |
56 // Value Format: The value is an ID: [0-9a-zA-Z_]+ | 56 // Value Format: The value is an ID: [0-9a-zA-Z_]+ |
57 // | 57 // |
58 // Type: anchr | 58 // Type: anchr |
59 // Description: Mark an anchor location. It doesn’t translate into any actual | 59 // Description: Mark an anchor location. It doesn’t translate into any actual |
60 // data. | 60 // data. |
61 // Value Format: The value is an ID of the same format as that of dist4/8. | 61 // Value Format: The value is an ID of the same format as that of dist4/8. |
62 // | 62 // |
| 63 // Type: handles |
| 64 // 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 // first item. |
| 67 // Value Format: The same format as u1/2/4/8. |
| 68 // |
63 // EXAMPLE: | 69 // EXAMPLE: |
64 // | 70 // |
65 // Suppose you have the following Mojo types defined: | 71 // Suppose you have the following Mojo types defined: |
66 // struct Bar { | 72 // struct Bar { |
67 // int32 a; | 73 // int32 a; |
68 // bool b; | 74 // bool b; |
69 // bool c; | 75 // bool c; |
70 // }; | 76 // }; |
71 // struct Foo { | 77 // struct Foo { |
72 // Bar x; | 78 // Bar x; |
(...skipping 19 matching lines...) Expand all Loading... |
92 // | 98 // |
93 // [anchr]bar_ptr | 99 // [anchr]bar_ptr |
94 // [dist4]bar // num_bytes | 100 // [dist4]bar // num_bytes |
95 // [u4]3 // num_fields | 101 // [u4]3 // num_fields |
96 // [s4]-1 // a | 102 // [s4]-1 // a |
97 // [b]00000010 // b and c | 103 // [b]00000010 // b and c |
98 // 0 0 0 // padding | 104 // 0 0 0 // padding |
99 // [anchr]bar | 105 // [anchr]bar |
100 | 106 |
101 // Parses validation test input. | 107 // Parses validation test input. |
102 // On success, |parsed_input| stores the parsing result and |error_message| is | 108 // On success, |data| and |num_handles| store the parsing result, |
103 // cleared; on failure, |error_message| is set to a message describing the error | 109 // |error_message| is cleared; on failure, |error_message| is set to a message |
104 // and |parsed_input| is cleared. | 110 // describing the error, |data| is cleared and |num_handles| set to 0. |
105 // Note: For now, this method only works on little-endian platforms. | 111 // Note: For now, this method only works on little-endian platforms. |
106 bool ParseValidationTestInput(const std::string& input, | 112 bool ParseValidationTestInput(const std::string& input, |
107 std::vector<uint8_t>* parsed_input, | 113 std::vector<uint8_t>* data, |
| 114 size_t* num_handles, |
108 std::string* error_message); | 115 std::string* error_message); |
109 | 116 |
110 } // namespace test | 117 } // namespace test |
111 } // namespace mojo | 118 } // namespace mojo |
112 | 119 |
113 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_ | 120 #endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_TEST_INPUT_PARSER_H_ |
OLD | NEW |