dom/bindings/parser/tests/test_builtins.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.

michael@0 1 import WebIDL
michael@0 2
michael@0 3 def WebIDLTest(parser, harness):
michael@0 4 parser.parse("""
michael@0 5 interface TestBuiltins {
michael@0 6 attribute boolean b;
michael@0 7 attribute byte s8;
michael@0 8 attribute octet u8;
michael@0 9 attribute short s16;
michael@0 10 attribute unsigned short u16;
michael@0 11 attribute long s32;
michael@0 12 attribute unsigned long u32;
michael@0 13 attribute long long s64;
michael@0 14 attribute unsigned long long u64;
michael@0 15 attribute DOMTimeStamp ts;
michael@0 16 };
michael@0 17 """)
michael@0 18
michael@0 19 results = parser.finish()
michael@0 20
michael@0 21 harness.ok(True, "TestBuiltins interface parsed without error.")
michael@0 22 harness.check(len(results), 1, "Should be one production")
michael@0 23 harness.ok(isinstance(results[0], WebIDL.IDLInterface),
michael@0 24 "Should be an IDLInterface")
michael@0 25 iface = results[0]
michael@0 26 harness.check(iface.identifier.QName(), "::TestBuiltins", "Interface has the right QName")
michael@0 27 harness.check(iface.identifier.name, "TestBuiltins", "Interface has the right name")
michael@0 28 harness.check(iface.parent, None, "Interface has no parent")
michael@0 29
michael@0 30 members = iface.members
michael@0 31 harness.check(len(members), 10, "Should be one production")
michael@0 32
michael@0 33 names = ["b", "s8", "u8", "s16", "u16", "s32", "u32", "s64", "u64", "ts"]
michael@0 34 types = ["Boolean", "Byte", "Octet", "Short", "UnsignedShort", "Long", "UnsignedLong", "LongLong", "UnsignedLongLong", "UnsignedLongLong"]
michael@0 35 for i in range(10):
michael@0 36 attr = members[i]
michael@0 37 harness.ok(isinstance(attr, WebIDL.IDLAttribute), "Should be an IDLAttribute")
michael@0 38 harness.check(attr.identifier.QName(), "::TestBuiltins::" + names[i], "Attr has correct QName")
michael@0 39 harness.check(attr.identifier.name, names[i], "Attr has correct name")
michael@0 40 harness.check(str(attr.type), types[i], "Attr type is the correct name")
michael@0 41 harness.ok(attr.type.isPrimitive(), "Should be a primitive type")

mercurial