dom/bindings/parser/tests/test_mozmap.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 dictionary Dict {};
michael@0 6 interface MozMapArg {
michael@0 7 void foo(MozMap<Dict> arg);
michael@0 8 };
michael@0 9 """)
michael@0 10
michael@0 11 results = parser.finish()
michael@0 12
michael@0 13 harness.check(len(results), 2, "Should know about two things");
michael@0 14 harness.ok(isinstance(results[1], WebIDL.IDLInterface),
michael@0 15 "Should have an interface here");
michael@0 16 members = results[1].members
michael@0 17 harness.check(len(members), 1, "Should have one member")
michael@0 18 harness.ok(members[0].isMethod(), "Should have method")
michael@0 19 signature = members[0].signatures()[0]
michael@0 20 args = signature[1]
michael@0 21 harness.check(len(args), 1, "Should have one arg")
michael@0 22 harness.ok(args[0].type.isMozMap(), "Should have a MozMap type here")
michael@0 23 harness.ok(args[0].type.inner.isDictionary(),
michael@0 24 "Should have a dictionary inner type")
michael@0 25
michael@0 26 parser = parser.reset()
michael@0 27 threw = False
michael@0 28 try:
michael@0 29 parser.parse("""
michael@0 30 interface MozMapVoidArg {
michael@0 31 void foo(MozMap<void> arg);
michael@0 32 };
michael@0 33 """)
michael@0 34
michael@0 35 results = parser.finish()
michael@0 36 except Exception,x:
michael@0 37 threw = True
michael@0 38
michael@0 39 harness.ok(threw, "Should have thrown.")

mercurial