Sat, 03 Jan 2015 20:18:00 +0100
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 unittest |
michael@0 | 2 | |
michael@0 | 3 | import pymake.data |
michael@0 | 4 | import pymake.functions |
michael@0 | 5 | |
michael@0 | 6 | class VariableRefTest(unittest.TestCase): |
michael@0 | 7 | def test_get_expansions(self): |
michael@0 | 8 | e = pymake.data.StringExpansion('FOO', None) |
michael@0 | 9 | f = pymake.functions.VariableRef(None, e) |
michael@0 | 10 | |
michael@0 | 11 | exps = list(f.expansions()) |
michael@0 | 12 | self.assertEqual(len(exps), 1) |
michael@0 | 13 | |
michael@0 | 14 | class GetExpansionsTest(unittest.TestCase): |
michael@0 | 15 | def test_get_arguments(self): |
michael@0 | 16 | f = pymake.functions.SubstFunction(None) |
michael@0 | 17 | |
michael@0 | 18 | e1 = pymake.data.StringExpansion('FOO', None) |
michael@0 | 19 | e2 = pymake.data.StringExpansion('BAR', None) |
michael@0 | 20 | e3 = pymake.data.StringExpansion('BAZ', None) |
michael@0 | 21 | |
michael@0 | 22 | f.append(e1) |
michael@0 | 23 | f.append(e2) |
michael@0 | 24 | f.append(e3) |
michael@0 | 25 | |
michael@0 | 26 | exps = list(f.expansions()) |
michael@0 | 27 | self.assertEqual(len(exps), 3) |
michael@0 | 28 | |
michael@0 | 29 | def test_descend(self): |
michael@0 | 30 | f = pymake.functions.StripFunction(None) |
michael@0 | 31 | |
michael@0 | 32 | e = pymake.data.Expansion(None) |
michael@0 | 33 | |
michael@0 | 34 | e1 = pymake.data.StringExpansion('FOO', None) |
michael@0 | 35 | f1 = pymake.functions.VariableRef(None, e1) |
michael@0 | 36 | e.appendfunc(f1) |
michael@0 | 37 | |
michael@0 | 38 | f2 = pymake.functions.WildcardFunction(None) |
michael@0 | 39 | e2 = pymake.data.StringExpansion('foo/*', None) |
michael@0 | 40 | f2.append(e2) |
michael@0 | 41 | e.appendfunc(f2) |
michael@0 | 42 | |
michael@0 | 43 | f.append(e) |
michael@0 | 44 | |
michael@0 | 45 | exps = list(f.expansions()) |
michael@0 | 46 | self.assertEqual(len(exps), 1) |
michael@0 | 47 | |
michael@0 | 48 | exps = list(f.expansions(True)) |
michael@0 | 49 | self.assertEqual(len(exps), 3) |
michael@0 | 50 | |
michael@0 | 51 | self.assertFalse(f.is_filesystem_dependent) |
michael@0 | 52 | |
michael@0 | 53 | if __name__ == '__main__': |
michael@0 | 54 | unittest.main() |