Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / tools / json_schema_compiler / test / idl_basics.idl
blob9ee49229460cdde6c2c7a64eb4b56cd937aece46
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.
5 // Tests a variety of basic API definition features.
7 [internal] namespace idl_basics {
8 // Enum description
9 enum EnumType {
10 // comment1
11 name1,
12 name2
15 [nodoc] enum EnumTypeWithNoDoc {
16 name1,
17 name2
20 dictionary MyType1 {
21 // This comment tests "double-quotes".
22 [legalValues=(1,2)] long x;
23 DOMString y;
24 DOMString z;
25 DOMString a;
26 DOMString b;
27 DOMString c;
30 dictionary MyType2 {
31 DOMString x;
34 dictionary UnionType {
35 (EnumType or DOMString)? x;
36 (DOMString or EnumType) y;
39 callback Callback1 = void();
40 callback Callback2 = void(long x);
41 callback Callback3 = void(MyType1 arg);
42 callback Callback4 = void(MyType2[] arg);
43 callback Callback5 = void(EnumType type);
44 // A comment on a callback.
45 // |x|: A parameter.
46 callback Callback6 = void(long x);
47 // |x|: Just a parameter comment, with no comment on the callback.
48 callback Callback7 = void(long x);
50 interface Functions {
51 static void function1();
52 static void function2(long x);
53 // This comment should appear in the documentation,
54 // despite occupying multiple lines.
56 // |arg|: So should this comment
57 // about the argument.
58 // <em>HTML</em> is fine too.
59 static void function3(MyType1 arg);
61 // This tests if "double-quotes" are escaped correctly.
63 // It also tests a comment with two newlines.
64 static void function4(Callback1 cb);
65 static void function5(Callback2 cb);
66 static void function6(Callback3 cb);
68 static void function7(optional long arg);
69 static void function8(long arg1, optional DOMString arg2);
70 static void function9(optional MyType1 arg);
72 static void function10(long x, long[] y);
73 static void function11(MyType1[] arg);
75 static void function12(Callback4 cb);
77 static void function13(EnumType type, Callback5 cb);
78 static void function14(EnumType[] types);
80 // "switch" is a reserved word and should cause a C++ compile error if we
81 // emit code for this declaration.
82 [nocompile] static void function15(long switch);
84 static void function16(Callback6 cb);
85 static void function17(Callback7 cb);
86 // |cb|: Override callback comment.
87 static void function18(Callback7 cb);
89 static void function20(idl_other_namespace.SomeType value);
90 static void function21(idl_other_namespace.SomeType[] values);
91 static void function22(
92 idl_other_namespace.sub_namespace.AnotherType value);
93 static void function23(
94 idl_other_namespace.sub_namespace.AnotherType[] values);
96 static long function24();
97 static MyType1 function25();
98 static MyType1[] function26();
99 static EnumType function27();
100 static EnumType[] function28();
101 static idl_other_namespace.SomeType function29();
102 static idl_other_namespace.SomeType[] function30();
105 interface Events {
106 static void onFoo1();
107 static void onFoo2(long x);
108 static void onFoo2(MyType1 arg);
109 static void onFoo3(EnumType type);