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 3 // found in the LICENSE file. 4 5 // Tests a variety of basic API definition features. 6 7 [internal] namespace idl_basics { 8 // Enum description 9 enum EnumType { 10 name1, 11 name2 12 }; 13 14 [nodoc] enum EnumTypeWithNoDoc { 15 name1, 16 name2 17 }; 18 19 dictionary MyType1 { 20 // This comment tests "double-quotes". 21 [legalValues=(1,2)] long x; 22 DOMString y; 23 DOMString z; 24 DOMString a; 25 DOMString b; 26 DOMString c; 27 }; 28 29 dictionary MyType2 { 30 DOMString x; 31 }; 32 33 callback Callback1 = void(); 34 callback Callback2 = void(long x); 35 callback Callback3 = void(MyType1 arg); 36 callback Callback4 = void(MyType2[] arg); 37 callback Callback5 = void(EnumType type); 38 // A comment on a callback. 39 // |x|: A parameter. 40 callback Callback6 = void(long x); 41 // |x|: Just a parameter comment, with no comment on the callback. 42 callback Callback7 = void(long x); 43 44 interface Functions { 45 static void function1(); 46 static void function2(long x); 47 // This comment should appear in the documentation, 48 // despite occupying multiple lines. 49 // 50 // |arg|: So should this comment 51 // about the argument. 52 // <em>HTML</em> is fine too. 53 static void function3(MyType1 arg); 54 55 // This tests if "double-quotes" are escaped correctly. 56 // 57 // It also tests a comment with two newlines. 58 static void function4(Callback1 cb); 59 static void function5(Callback2 cb); 60 static void function6(Callback3 cb); 61 62 static void function7(optional long arg); 63 static void function8(long arg1, optional DOMString arg2); 64 static void function9(optional MyType1 arg); 65 66 static void function10(long x, long[] y); 67 static void function11(MyType1[] arg); 68 69 static void function12(Callback4 cb); 70 71 static void function13(EnumType type, Callback5 cb); 72 static void function14(EnumType[] types); 73 74 // "switch" is a reserved word and should cause a C++ compile error if we 75 // emit code for this declaration. 76 [nocompile] static void function15(long switch); 77 78 static void function16(Callback6 cb); 79 static void function17(Callback7 cb); 80 // |cb|: Override callback comment. 81 static void function18(Callback7 cb); 82 }; 83 84 interface Events { 85 static void onFoo1(); 86 static void onFoo2(long x); 87 static void onFoo2(MyType1 arg); 88 static void onFoo3(EnumType type); 89 }; 90 }; 91