Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(399)

Side by Side Diff: mojo/public/interfaces/bindings/tests/validation_test_interfaces.mojom

Issue 2286513002: Mojo C++ bindings: fix inlined union validation. (Closed)
Patch Set: add a test case Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 5
6 [JavaPackage="org.chromium.mojo.bindings.test.mojom.mojo"] 6 [JavaPackage="org.chromium.mojo.bindings.test.mojom.mojo"]
7 module mojo.test; 7 module mojo.test;
8 8
9 struct StructA { 9 struct StructA {
10 uint64 i; 10 uint64 i;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 ENUM_A_1 49 ENUM_A_1
50 }; 50 };
51 51
52 [Extensible] 52 [Extensible]
53 enum EnumB { 53 enum EnumB {
54 ENUM_B_0, 54 ENUM_B_0,
55 ENUM_B_1, 55 ENUM_B_1,
56 ENUM_B_2 56 ENUM_B_2
57 }; 57 };
58 58
59 union UnionA {
60 StructA struct_a;
61 bool b;
62 };
63
59 // This interface is used for testing bounds-checking in the mojom 64 // This interface is used for testing bounds-checking in the mojom
60 // binding code. If you add a method please update the files 65 // binding code. If you add a method please update the files
61 // ./data/validation/boundscheck_*. If you add a response please update 66 // ./data/validation/boundscheck_*. If you add a response please update
62 // ./data/validation/resp_boundscheck_*. 67 // ./data/validation/resp_boundscheck_*.
63 interface BoundsCheckTestInterface { 68 interface BoundsCheckTestInterface {
64 Method0(uint8 param0) => (uint8 param0); 69 Method0(uint8 param0) => (uint8 param0);
65 Method1(uint8 param0); 70 Method1(uint8 param0);
66 }; 71 };
67 72
68 interface ConformanceTestInterface { 73 interface ConformanceTestInterface {
69 Method0(float param0); 74 Method0(float param0);
70 Method1(StructA param0); 75 Method1(StructA param0);
71 Method2(StructB param0, StructA param1); 76 Method2(StructB param0, StructA param1);
72 Method3(array<bool> param0); 77 Method3(array<bool> param0);
73 Method4(StructC param0, array<uint8> param1); 78 Method4(StructC param0, array<uint8> param1);
74 Method5(StructE param0, handle<data_pipe_producer> param1); 79 Method5(StructE param0, handle<data_pipe_producer> param1);
75 Method6(array<array<uint8>> param0); 80 Method6(array<array<uint8>> param0);
76 Method7(StructF param0, array<array<uint8, 3>?, 2> param1); 81 Method7(StructF param0, array<array<uint8, 3>?, 2> param1);
77 Method8(array<array<string>?> param0); 82 Method8(array<array<string>?> param0);
78 Method9(array<array<handle?>>? param0); 83 Method9(array<array<handle?>>? param0);
79 Method10(map<string, uint8> param0); 84 Method10(map<string, uint8> param0);
80 Method11(StructG param0); 85 Method11(StructG param0);
81 Method12(float param0) => (float param0); 86 Method12(float param0) => (float param0);
82 Method13(InterfaceA? param0, uint32 param1, InterfaceA? param2); 87 Method13(InterfaceA? param0, uint32 param1, InterfaceA? param2);
83 Method14(EnumA param0, EnumB param1); 88 Method14(EnumA param0, EnumB param1);
84 Method15(array<EnumA>? param0, array<EnumB>? param1); 89 Method15(array<EnumA>? param0, array<EnumB>? param1);
85 Method16(map<EnumA, EnumA>? param0); 90 Method16(map<EnumA, EnumA>? param0);
86 Method17(array<InterfaceA> param0); 91 Method17(array<InterfaceA> param0);
92 Method18(UnionA? param0);
87 }; 93 };
88 94
89 struct BasicStruct { 95 struct BasicStruct {
90 int32 a; 96 int32 a;
91 }; 97 };
92 98
93 interface IntegrationTestInterface { 99 interface IntegrationTestInterface {
94 Method0(BasicStruct param0) => (array<uint8> param0); 100 Method0(BasicStruct param0) => (array<uint8> param0);
95 }; 101 };
96 102
97 // An enum generates a enum-value validation function, so we want to test it. 103 // An enum generates a enum-value validation function, so we want to test it.
98 // E.g., valid enum values for this enum should be: -3, 0, 1, 10 104 // E.g., valid enum values for this enum should be: -3, 0, 1, 10
99 enum BasicEnum { 105 enum BasicEnum {
100 A, 106 A,
101 B, 107 B,
102 C = A, 108 C = A,
103 D = -3, 109 D = -3,
104 E = 0xA 110 E = 0xA
105 }; 111 };
106 112
107 // The enum validation function should be generated within the scope of this 113 // The enum validation function should be generated within the scope of this
108 // struct. 114 // struct.
109 struct StructWithEnum { 115 struct StructWithEnum {
110 enum EnumWithin { 116 enum EnumWithin {
111 A, B, C, D 117 A, B, C, D
112 }; 118 };
113 }; 119 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698