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

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

Issue 1618963006: Mojo C++ bindings: support enum validation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 26 matching lines...) Expand all
37 StructA? struct_a; 37 StructA? struct_a;
38 [MinVersion=3] 38 [MinVersion=3]
39 string? str; 39 string? str;
40 [MinVersion=3] 40 [MinVersion=3]
41 bool b; 41 bool b;
42 }; 42 };
43 43
44 interface InterfaceA { 44 interface InterfaceA {
45 }; 45 };
46 46
47 enum EnumA {
48 ENUM_A_0,
49 ENUM_A_1
50 };
51
52 [Extensible=True]
53 enum EnumB {
54 ENUM_B_0,
55 ENUM_B_1,
56 ENUM_B_2
57 };
58
47 // This interface is used for testing bounds-checking in the mojom 59 // This interface is used for testing bounds-checking in the mojom
48 // binding code. If you add a method please update the files 60 // binding code. If you add a method please update the files
49 // ./data/validation/boundscheck_*. If you add a response please update 61 // ./data/validation/boundscheck_*. If you add a response please update
50 // ./data/validation/resp_boundscheck_*. 62 // ./data/validation/resp_boundscheck_*.
51 interface BoundsCheckTestInterface { 63 interface BoundsCheckTestInterface {
52 Method0(uint8 param0) => (uint8 param0); 64 Method0(uint8 param0) => (uint8 param0);
53 Method1(uint8 param0); 65 Method1(uint8 param0);
54 }; 66 };
55 67
56 interface ConformanceTestInterface { 68 interface ConformanceTestInterface {
57 Method0(float param0); 69 Method0(float param0);
58 Method1(StructA param0); 70 Method1(StructA param0);
59 Method2(StructB param0, StructA param1); 71 Method2(StructB param0, StructA param1);
60 Method3(array<bool> param0); 72 Method3(array<bool> param0);
61 Method4(StructC param0, array<uint8> param1); 73 Method4(StructC param0, array<uint8> param1);
62 Method5(StructE param0, handle<data_pipe_producer> param1); 74 Method5(StructE param0, handle<data_pipe_producer> param1);
63 Method6(array<array<uint8>> param0); 75 Method6(array<array<uint8>> param0);
64 Method7(StructF param0, array<array<uint8, 3>?, 2> param1); 76 Method7(StructF param0, array<array<uint8, 3>?, 2> param1);
65 Method8(array<array<string>?> param0); 77 Method8(array<array<string>?> param0);
66 Method9(array<array<handle?>>? param0); 78 Method9(array<array<handle?>>? param0);
67 Method10(map<string, uint8> param0); 79 Method10(map<string, uint8> param0);
68 Method11(StructG param0); 80 Method11(StructG param0);
69 Method12(float param0) => (float param0); 81 Method12(float param0) => (float param0);
70 Method13(InterfaceA? param0, uint32 param1, InterfaceA? param2); 82 Method13(InterfaceA? param0, uint32 param1, InterfaceA? param2);
83 Method14(EnumA param0, EnumB param1);
84 Method15(array<EnumA>? param0, array<EnumB>? param1);
71 }; 85 };
72 86
73 struct BasicStruct { 87 struct BasicStruct {
74 int32 a; 88 int32 a;
75 }; 89 };
76 90
77 interface IntegrationTestInterface { 91 interface IntegrationTestInterface {
78 Method0(BasicStruct param0) => (array<uint8> param0); 92 Method0(BasicStruct param0) => (array<uint8> param0);
79 }; 93 };
80 94
81 // An enum generates a enum-value validation function, so we want to test it. 95 // An enum generates a enum-value validation function, so we want to test it.
82 // E.g., valid enum values for this enum should be: -3, 0, 1, 10 96 // E.g., valid enum values for this enum should be: -3, 0, 1, 10
83 enum BasicEnum { 97 enum BasicEnum {
84 A, 98 A,
85 B, 99 B,
86 C = A, 100 C = A,
87 D = -3, 101 D = -3,
88 E = 0xA 102 E = 0xA
89 }; 103 };
90 104
91 // The enum validation function should be generated within the scope of this 105 // The enum validation function should be generated within the scope of this
92 // struct. 106 // struct.
93 struct StructWithEnum { 107 struct StructWithEnum {
94 enum EnumWithin { 108 enum EnumWithin {
95 A, B, C, D 109 A, B, C, D
96 }; 110 };
97 }; 111 };
OLDNEW
« no previous file with comments | « mojo/public/interfaces/bindings/tests/test_unions.mojom ('k') | mojo/public/js/validation_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698