Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 // Tests a variety of basic API definition features. | 5 // Tests a variety of basic API definition features. |
| 6 | 6 |
| 7 [internal] namespace idl_basics { | 7 [internal] namespace idl_basics { |
| 8 // Enum description | 8 // Enum description |
| 9 enum EnumType { | 9 enum EnumType { |
| 10 // comment1 | 10 // comment1 |
| 11 name1, | 11 name1, |
| 12 name2 | 12 name2 |
| 13 }; | 13 }; |
| 14 | 14 |
| 15 [nodoc] enum EnumTypeWithNoDoc { | 15 [nodoc] enum EnumTypeWithNoDoc { |
| 16 name1, | 16 name1, |
| 17 name2 | 17 name2 |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 [cpp_enum_prefix_override="prefix"] enum EnumWithPrefix { | |
|
Devlin
2016/05/17 19:04:10
Do we want to support prefixes for vanilla enums?
tapted
2016/05/18 09:35:54
Ah, it's actually the prefixes for class-enums tha
| |
| 21 name1, | |
| 22 name2 | |
| 23 }; | |
| 24 | |
| 25 [class] enum EnumClass { | |
| 26 name1, | |
| 27 name2 | |
| 28 }; | |
| 29 | |
| 30 [class,cpp_enum_prefix_override="prefix"] enum EnumClassWithPrefix { | |
|
Devlin
2016/05/17 19:04:10
nit: cpp_enum_prefix_override is quite a mouthful.
tapted
2016/05/18 09:35:54
Yup I agree 'class' is a bit terse - went with enu
| |
| 31 name1, | |
| 32 name2 | |
| 33 }; | |
| 34 | |
| 20 dictionary MyType1 { | 35 dictionary MyType1 { |
| 21 // This comment tests "double-quotes". | 36 // This comment tests "double-quotes". |
| 22 [legalValues=(1,2)] long x; | 37 [legalValues=(1,2)] long x; |
| 23 DOMString y; | 38 DOMString y; |
| 24 DOMString z; | 39 DOMString z; |
| 25 DOMString a; | 40 DOMString a; |
| 26 DOMString b; | 41 DOMString b; |
| 27 DOMString c; | 42 DOMString c; |
| 28 }; | 43 }; |
| 29 | 44 |
| 30 dictionary MyType2 { | 45 dictionary MyType2 { |
| 31 DOMString x; | 46 DOMString x; |
| 32 }; | 47 }; |
| 33 | 48 |
| 49 dictionary MyType3 { | |
| 50 EnumType w; | |
| 51 EnumWithPrefix x; | |
| 52 EnumClass y; | |
| 53 EnumClassWithPrefix z; | |
| 54 }; | |
| 55 | |
| 34 dictionary UnionType { | 56 dictionary UnionType { |
| 35 (EnumType or DOMString)? x; | 57 (EnumType or DOMString)? x; |
| 36 (DOMString or EnumType) y; | 58 (DOMString or EnumType) y; |
| 37 }; | 59 }; |
| 38 | 60 |
| 39 callback Callback1 = void(); | 61 callback Callback1 = void(); |
| 40 callback Callback2 = void(long x); | 62 callback Callback2 = void(long x); |
| 41 callback Callback3 = void(MyType1 arg); | 63 callback Callback3 = void(MyType1 arg); |
| 42 callback Callback4 = void(MyType2[] arg); | 64 callback Callback4 = void(MyType2[] arg); |
| 43 callback Callback5 = void(EnumType type); | 65 callback Callback5 = void(EnumType type); |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 104 [nodefine] static void function31(long switch); | 126 [nodefine] static void function31(long switch); |
| 105 }; | 127 }; |
| 106 | 128 |
| 107 interface Events { | 129 interface Events { |
| 108 static void onFoo1(); | 130 static void onFoo1(); |
| 109 static void onFoo2(long x); | 131 static void onFoo2(long x); |
| 110 static void onFoo2(MyType1 arg); | 132 static void onFoo2(MyType1 arg); |
| 111 static void onFoo3(EnumType type); | 133 static void onFoo3(EnumType type); |
| 112 }; | 134 }; |
| 113 }; | 135 }; |
| OLD | NEW |