dom/bindings/parser/tests/test_callback.py

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 import WebIDL
     3 def WebIDLTest(parser, harness):
     4     parser.parse("""
     5         interface TestCallback {
     6           attribute CallbackType? listener;
     7         };
     9         callback CallbackType = boolean (unsigned long arg);
    10     """)
    12     results = parser.finish()
    14     harness.ok(True, "TestCallback interface parsed without error.")
    15     harness.check(len(results), 2, "Should be two productions.")
    16     iface = results[0]
    17     harness.ok(isinstance(iface, WebIDL.IDLInterface),
    18                "Should be an IDLInterface")
    19     harness.check(iface.identifier.QName(), "::TestCallback", "Interface has the right QName")
    20     harness.check(iface.identifier.name, "TestCallback", "Interface has the right name")
    21     harness.check(len(iface.members), 1, "Expect %s members" % 1)
    23     attr = iface.members[0]
    24     harness.ok(isinstance(attr, WebIDL.IDLAttribute),
    25                "Should be an IDLAttribute")
    26     harness.ok(attr.isAttr(), "Should be an attribute")
    27     harness.ok(not attr.isMethod(), "Attr is not an method")
    28     harness.ok(not attr.isConst(), "Attr is not a const")
    29     harness.check(attr.identifier.QName(), "::TestCallback::listener", "Attr has the right QName")
    30     harness.check(attr.identifier.name, "listener", "Attr has the right name")
    31     t = attr.type
    32     harness.ok(not isinstance(t, WebIDL.IDLWrapperType), "Attr has the right type")
    33     harness.ok(isinstance(t, WebIDL.IDLNullableType), "Attr has the right type")
    34     harness.ok(t.isCallback(), "Attr has the right type")

mercurial