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
{
14 [nodoc
] enum EnumTypeWithNoDoc
{
20 // This comment tests "double-quotes".
21 [legalValues
=(1,2)] long x
;
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.
40 callback Callback6
= void(long x
);
41 // |x|: Just a parameter comment, with no comment on the callback.
42 callback Callback7
= void(long x
);
45 static
void function1
();
46 static
void function2
(long x
);
47 // This comment should appear in the documentation,
48 // despite occupying multiple lines.
50 // |arg|: So should this comment
51 // about the argument.
52 // <em>HTML</em> is fine too.
53 static
void function3
(MyType1 arg
);
55 // This tests if "double-quotes" are escaped correctly.
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
);
62 static
void function7
(optional long arg
);
63 static
void function8
(long arg1
, optional DOMString arg2
);
64 static
void function9
(optional MyType1 arg
);
66 static
void function10
(long x
, long[] y
);
67 static
void function11
(MyType1
[] arg
);
69 static
void function12
(Callback4 cb
);
71 static
void function13
(EnumType type
, Callback5 cb
);
72 static
void function14
(EnumType
[] types
);
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);
78 static
void function16
(Callback6 cb
);
79 static
void function17
(Callback7 cb
);
80 // |cb|: Override callback comment.
81 static
void function18
(Callback7 cb
);
86 static
void onFoo2
(long x
);
87 static
void onFoo2
(MyType1 arg
);
88 static
void onFoo3
(EnumType type
);