• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    static void function20(idl_other_namespace.SomeType value);
85    static void function21(idl_other_namespace.SomeType[] values);
86    static void function22(
87        idl_other_namespace.sub_namespace.AnotherType value);
88    static void function23(
89        idl_other_namespace.sub_namespace.AnotherType[] values);
90
91    static long function24();
92    static MyType1 function25();
93    static MyType1[] function26();
94    static EnumType function27();
95    static EnumType[] function28();
96    static idl_other_namespace.SomeType function29();
97    static idl_other_namespace.SomeType[] function30();
98  };
99
100  interface Events {
101    static void onFoo1();
102    static void onFoo2(long x);
103    static void onFoo2(MyType1 arg);
104    static void onFoo3(EnumType type);
105  };
106};
107