Bug 996061 - part 0 - make tests use [scriptable] interfaces; r=ted

Smart xpt linking will keep around [scriptable] interfaces and anything
those interfaces depend on.  Modify the tests that deal with xpt linking
so they use [scriptable] interfaces, ensuring that the tests continue to
work in the face of smarter linkers.
This commit is contained in:
Nathan Froyd 2014-05-19 12:35:21 -04:00
parent 9d661195b2
commit 0c64deb27f
2 changed files with 28 additions and 24 deletions

View File

@ -647,10 +647,14 @@ class TestManifestFile(TestWithTmpDir):
# Compiled typelib for the following IDL:
# interface foo;
# [uuid(5f70da76-519c-4858-b71e-e3c92333e2d6)]
# [scriptable, uuid(5f70da76-519c-4858-b71e-e3c92333e2d6)]
# interface bar {
# void bar(in foo f);
# };
# We need to make this [scriptable] so it doesn't get deleted from the
# typelib. We don't need to make the foo interfaces below [scriptable],
# because they will be automatically included by virtue of being an
# argument to a method of |bar|.
bar_xpt = GeneratedFile(
b'\x58\x50\x43\x4F\x4D\x0A\x54\x79\x70\x65\x4C\x69\x62\x0D\x0A\x1A' +
b'\x01\x02\x00\x02\x00\x00\x00\x7B\x00\x00\x00\x24\x00\x00\x00\x5C' +
@ -659,7 +663,7 @@ bar_xpt = GeneratedFile(
b'\x70\xDA\x76\x51\x9C\x48\x58\xB7\x1E\xE3\xC9\x23\x33\xE2\xD6\x00' +
b'\x00\x00\x05\x00\x00\x00\x00\x00\x00\x00\x0D\x00\x66\x6F\x6F\x00' +
b'\x62\x61\x72\x00\x62\x61\x72\x00\x00\x00\x00\x01\x00\x00\x00\x00' +
b'\x09\x01\x80\x92\x00\x01\x80\x06\x00\x00\x00'
b'\x09\x01\x80\x92\x00\x01\x80\x06\x00\x00\x80'
)
# Compiled typelib for the following IDL:

View File

@ -388,10 +388,10 @@ class TestXPTLink(unittest.TestCase):
"""
t1 = xpt.Typelib()
# add an unresolved interface
t1.interfaces.append(xpt.Interface("IFoo"))
t1.interfaces.append(xpt.Interface("IFoo", scriptable=True))
t2 = xpt.Typelib()
# add an unresolved interface
t2.interfaces.append(xpt.Interface("IBar"))
t2.interfaces.append(xpt.Interface("IBar", scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))
@ -402,10 +402,10 @@ class TestXPTLink(unittest.TestCase):
# Add some IID values
t1 = xpt.Typelib()
# add an unresolved interface
t1.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff"))
t1.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff", scriptable=True))
t2 = xpt.Typelib()
# add an unresolved interface
t2.interfaces.append(xpt.Interface("IBar", iid="44332211-6655-8877-0099-aabbccddeeff"))
t2.interfaces.append(xpt.Interface("IBar", iid="44332211-6655-8877-0099-aabbccddeeff", scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))
@ -447,7 +447,7 @@ class TestXPTLink(unittest.TestCase):
# Unresolved in both, but t1 has an IID value
t1 = xpt.Typelib()
# add an unresolved interface with a valid IID
t1.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff"))
t1.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff", scriptable=True))
t2 = xpt.Typelib()
# add an unresolved interface, no IID
t2.interfaces.append(xpt.Interface("IFoo"))
@ -462,7 +462,7 @@ class TestXPTLink(unittest.TestCase):
t1.interfaces.append(xpt.Interface("IFoo"))
t2 = xpt.Typelib()
# add an unresolved interface with a valid IID
t2.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff"))
t2.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff", scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(1, len(t3.interfaces))
@ -486,7 +486,7 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.SimpleType(xpt.Type.Tags.void))
m = xpt.Method("Bar", p)
t2.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(1, len(t3.interfaces))
@ -502,7 +502,7 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.SimpleType(xpt.Type.Tags.void))
m = xpt.Method("Bar", p)
t1.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t2 = xpt.Typelib()
# add an unresolved interface
t2.interfaces.append(xpt.Interface("IFoo"))
@ -530,13 +530,13 @@ class TestXPTLink(unittest.TestCase):
t1.interfaces.append(pi)
# add a child of the unresolved interface
t1.interfaces.append(xpt.Interface("IChild", iid="11111111-1111-1111-1111-111111111111",
resolved=True, parent=pi))
resolved=True, parent=pi, scriptable=True))
t2 = xpt.Typelib()
# add a resolved interface
p = xpt.Param(xpt.SimpleType(xpt.Type.Tags.void))
m = xpt.Method("Bar", p)
t2.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))
@ -557,14 +557,14 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.SimpleType(xpt.Type.Tags.void))
m = xpt.Method("Bar", p)
t1.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t2 = xpt.Typelib()
# add an unresolved interface
pi = xpt.Interface("IFoo")
t2.interfaces.append(pi)
# add a child of the unresolved interface
t2.interfaces.append(xpt.Interface("IChild", iid="11111111-1111-1111-1111-111111111111",
resolved=True, parent=pi))
resolved=True, parent=pi, scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))
@ -595,13 +595,13 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.InterfaceType(i))
m = xpt.Method("ReturnIface", p)
t1.interfaces.append(xpt.Interface("IRetval", iid="11111111-1111-1111-1111-111111111111",
methods=[m]))
methods=[m], scriptable=True))
t2 = xpt.Typelib()
# add a resolved interface
p = xpt.Param(xpt.SimpleType(xpt.Type.Tags.void))
m = xpt.Method("Bar", p)
t2.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))
@ -624,7 +624,7 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.SimpleType(xpt.Type.Tags.void))
m = xpt.Method("Bar", p)
t1.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t2 = xpt.Typelib()
# add an unresolved interface
i = xpt.Interface("IFoo")
@ -634,7 +634,7 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.InterfaceType(i))
m = xpt.Method("ReturnIface", p)
t2.interfaces.append(xpt.Interface("IRetval", iid="11111111-1111-1111-1111-111111111111",
methods=[m]))
methods=[m], scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))
@ -668,12 +668,12 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.InterfaceType(i))
m = xpt.Method("IfaceParam", vp, params=[p])
t1.interfaces.append(xpt.Interface("IParam", iid="11111111-1111-1111-1111-111111111111",
methods=[m]))
methods=[m], scriptable=True))
t2 = xpt.Typelib()
# add a resolved interface
m = xpt.Method("Bar", vp)
t2.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))
@ -695,7 +695,7 @@ class TestXPTLink(unittest.TestCase):
# add a resolved interface
m = xpt.Method("Bar", vp)
t1.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t2 = xpt.Typelib()
# add an unresolved interface
i = xpt.Interface("IFoo")
@ -706,7 +706,7 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.InterfaceType(i))
m = xpt.Method("IfaceParam", vp, params=[p])
t2.interfaces.append(xpt.Interface("IParam", iid="11111111-1111-1111-1111-111111111111",
methods=[m]))
methods=[m], scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))
@ -743,12 +743,12 @@ class TestXPTLink(unittest.TestCase):
p = xpt.Param(xpt.ArrayType(xpt.InterfaceType(i), 1, 2))
m = xpt.Method("ArrayIfaceParam", vp, params=[p, intp, intp])
t1.interfaces.append(xpt.Interface("IParam", iid="11111111-1111-1111-1111-111111111111",
methods=[m]))
methods=[m], scriptable=True))
t2 = xpt.Typelib()
# add a resolved interface
m = xpt.Method("Bar", vp)
t2.interfaces.append(xpt.Interface("IFoo", iid="11223344-5566-7788-9900-aabbccddeeff",
methods=[m]))
methods=[m], scriptable=True))
t3 = xpt.xpt_link([t1, t2])
self.assertEqual(2, len(t3.interfaces))