Bug 1915045 Ensure decode tasks are scheduled on BufferingState::Enter() r=media...
[gecko.git] / dom / bindings / parser / tests / test_callback_interface.py
blob102e96401bf88bc512d1a1f91c73820e3cb1aaa4
1 import WebIDL
4 def WebIDLTest(parser, harness):
5 parser.parse(
6 """
7 callback interface TestCallbackInterface {
8 attribute boolean bool;
9 };
10 """
13 results = parser.finish()
15 iface = results[0]
17 harness.ok(iface.isCallback(), "Interface should be a callback")
19 parser = parser.reset()
20 threw = False
21 try:
22 parser.parse(
23 """
24 interface TestInterface {
26 callback interface TestCallbackInterface : TestInterface {
27 attribute boolean bool;
29 """
31 parser.finish()
32 except WebIDL.WebIDLError:
33 threw = True
35 harness.ok(threw, "Should not allow non-callback parent of callback interface")
37 parser = parser.reset()
38 threw = False
39 try:
40 parser.parse(
41 """
42 interface TestInterface : TestCallbackInterface {
44 callback interface TestCallbackInterface {
45 attribute boolean bool;
47 """
49 parser.finish()
50 except WebIDL.WebIDLError:
51 threw = True
53 harness.ok(threw, "Should not allow callback parent of non-callback interface")
55 parser = parser.reset()
56 parser.parse(
57 """
58 callback interface TestCallbackInterface1 {
59 undefined foo();
61 callback interface TestCallbackInterface2 {
62 undefined foo(DOMString arg);
63 undefined foo(TestCallbackInterface1 arg);
65 callback interface TestCallbackInterface3 {
66 undefined foo(DOMString arg);
67 undefined foo(TestCallbackInterface1 arg);
68 static undefined bar();
70 callback interface TestCallbackInterface4 {
71 undefined foo(DOMString arg);
72 undefined foo(TestCallbackInterface1 arg);
73 static undefined bar();
74 const long baz = 5;
76 callback interface TestCallbackInterface5 {
77 static attribute boolean bool;
78 undefined foo();
80 callback interface TestCallbackInterface6 {
81 undefined foo(DOMString arg);
82 undefined foo(TestCallbackInterface1 arg);
83 undefined bar();
85 callback interface TestCallbackInterface7 {
86 static attribute boolean bool;
88 callback interface TestCallbackInterface8 {
89 attribute boolean bool;
91 callback interface TestCallbackInterface9 : TestCallbackInterface1 {
92 undefined foo();
94 callback interface TestCallbackInterface10 : TestCallbackInterface1 {
95 undefined bar();
97 """
99 results = parser.finish()
100 for i, iface in enumerate(results):
101 harness.check(
102 iface.isSingleOperationInterface(),
103 i < 4,
104 "Interface %s should be a single operation interface"
105 % iface.identifier.name,