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