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 name1, | 10 name1, |
| 11 name2 | 11 name2 |
| 12 }; | 12 }; |
| 13 | 13 |
| 14 dictionary MyType1 { | 14 dictionary MyType1 { |
| 15 // This comment tests "double-quotes". | 15 // This comment tests "double-quotes". |
| 16 [legalValues=(1,2)] long x; | 16 [legalValues=(1,2)] long x; |
| 17 DOMString y; | 17 DOMString y; |
| 18 }; | 18 }; |
| 19 | 19 |
| 20 dictionary MyType2 { | 20 dictionary MyType2 { |
| 21 DOMString x; | 21 DOMString x; |
| 22 }; | 22 }; |
| 23 | 23 |
| 24 callback Callback1 = void(); | 24 callback Callback1 = void(); |
| 25 callback Callback2 = void(long x); | 25 callback Callback2 = void(long x); |
| 26 callback Callback3 = void(MyType1 arg); | 26 callback Callback3 = void(MyType1 arg); |
| 27 callback Callback4 = void(MyType2[] arg); | 27 callback Callback4 = void(MyType2[] arg); |
| 28 callback Callback5 = void(EnumType type); | 28 callback Callback5 = void(EnumType type); |
| 29 // A comment on a callback. | |
| 30 // |x|: A parameter. | |
| 31 callback Callback6 = void(long x); | |
| 32 // |x|: A parameter with no parent callback. | |
|
asargent_no_longer_on_chrome
2012/11/01 16:55:37
nit: I don't quite understand the "with no parent
cduvall
2012/11/01 22:56:01
Done, should be more clear now.
| |
| 33 callback Callback7 = void(long x); | |
| 29 | 34 |
| 30 interface Functions { | 35 interface Functions { |
| 31 static void function1(); | 36 static void function1(); |
| 32 static void function2(long x); | 37 static void function2(long x); |
| 33 // This comment should appear in the documentation, | 38 // This comment should appear in the documentation, |
| 34 // despite occupying multiple lines. | 39 // despite occupying multiple lines. |
| 35 // | 40 // |
| 36 // |arg|: So should this comment | 41 // |arg|: So should this comment |
| 37 // about the argument. | 42 // about the argument. |
| 38 // <em>HTML</em> is fine too. | 43 // <em>HTML</em> is fine too. |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 53 static void function11(MyType1[] arg); | 58 static void function11(MyType1[] arg); |
| 54 | 59 |
| 55 static void function12(Callback4 cb); | 60 static void function12(Callback4 cb); |
| 56 | 61 |
| 57 static void function13(EnumType type, Callback5 cb); | 62 static void function13(EnumType type, Callback5 cb); |
| 58 static void function14(EnumType[] types); | 63 static void function14(EnumType[] types); |
| 59 | 64 |
| 60 // "switch" is a reserved word and should cause a C++ compile error if we | 65 // "switch" is a reserved word and should cause a C++ compile error if we |
| 61 // emit code for this declaration. | 66 // emit code for this declaration. |
| 62 [nocompile] static void function15(long switch); | 67 [nocompile] static void function15(long switch); |
| 68 | |
| 69 static void function16(Callback6 cb); | |
| 70 static void function17(Callback7 cb); | |
| 71 // |cb|: Override callback comment. | |
| 72 static void function18(Callback7 cb); | |
| 63 }; | 73 }; |
| 64 | 74 |
| 65 interface Events { | 75 interface Events { |
| 66 static void onFoo1(); | 76 static void onFoo1(); |
| 67 static void onFoo2(long x); | 77 static void onFoo2(long x); |
| 68 static void onFoo2(MyType1 arg); | 78 static void onFoo2(MyType1 arg); |
| 69 static void onFoo3(EnumType type); | 79 static void onFoo3(EnumType type); |
| 70 }; | 80 }; |
| 71 }; | 81 }; |
| OLD | NEW |