Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: chrome/content/tests/filterClasses.js

Issue 6439460933730304: Issue 616 - Add tests for $generichide and $genericblock (Closed)
Left Patch Set: Rebased onto typeMask changes Created July 14, 2015, 4:45 p.m.
Right Patch Set: Couple more tweaks Created Oct. 2, 2015, 10:37 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « chrome/content/tests/elemhide.js ('k') | chrome/content/tests/matcher.js » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 (function() 1 (function()
2 { 2 {
3 module("Filter classes", {setup: prepareFilterComponents, teardown: restoreFil terComponents}); 3 module("Filter classes", {setup: prepareFilterComponents, teardown: restoreFil terComponents});
4 4
5 function serializeFilter(filter) 5 function serializeFilter(filter)
6 { 6 {
7 // Filter serialization only writes out essential properties, need to do a f ull serialization here 7 // Filter serialization only writes out essential properties, need to do a f ull serialization here
8 let result = []; 8 let result = [];
9 result.push("text=" + filter.text); 9 result.push("text=" + filter.text);
10 if (filter instanceof InvalidFilter) 10 if (filter instanceof InvalidFilter)
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 } 85 }
86 86
87 if (type == "whitelist" || type == "filterlist" || type == "elemhide" || typ e == "elemhideexception") 87 if (type == "whitelist" || type == "filterlist" || type == "elemhide" || typ e == "elemhideexception")
88 { 88 {
89 addProperty("disabled", "false"); 89 addProperty("disabled", "false");
90 addProperty("lastHit", "0"); 90 addProperty("lastHit", "0");
91 addProperty("hitCount", "0"); 91 addProperty("hitCount", "0");
92 } 92 }
93 if (type == "whitelist" || type == "filterlist") 93 if (type == "whitelist" || type == "filterlist")
94 { 94 {
95 addProperty("contentType", 0x7FFFFFFF & ~(RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeMap.ELEMHIDE | RegExpFilter.typeMap.POPUP | 95 addProperty("contentType", 0x7FFFFFFF & ~(
96 RegExpFilter.typeMap.GENERICHIDE | RegExpFilter.typeMap.GENERICBLOCK)); 96 RegExpFilter.typeMap.DOCUMENT | RegExpFilter.typeMap.ELEMHIDE |
97 RegExpFilter.typeMap.POPUP | RegExpFilter.typeMap.GENERICHIDE |
98 RegExpFilter.typeMap.GENERICBLOCK
99 ));
97 addProperty("matchCase", "false"); 100 addProperty("matchCase", "false");
98 addProperty("thirdParty", "null"); 101 addProperty("thirdParty", "null");
99 addProperty("domains", ""); 102 addProperty("domains", "");
100 addProperty("sitekeys", ""); 103 addProperty("sitekeys", "");
101 } 104 }
102 if (type == "filterlist") 105 if (type == "filterlist")
103 { 106 {
104 addProperty("collapse", "null"); 107 addProperty("collapse", "null");
105 } 108 }
106 if (type == "elemhide" || type == "elemhideexception") 109 if (type == "elemhide" || type == "elemhideexception")
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 compareFilter("#@ddd(fff)(foo=bar)", ["type=elemhideexception", "text=#@ddd( fff)(foo=bar)", 'selector=ddd.fff[foo="bar"],ddd#fff[foo="bar"]']); 269 compareFilter("#@ddd(fff)(foo=bar)", ["type=elemhideexception", "text=#@ddd( fff)(foo=bar)", 'selector=ddd.fff[foo="bar"],ddd#fff[foo="bar"]']);
267 compareFilter("#@*(fff)", ["type=elemhideexception", "text=#@*(fff)", "selec tor=.fff,#fff"]); 270 compareFilter("#@*(fff)", ["type=elemhideexception", "text=#@*(fff)", "selec tor=.fff,#fff"]);
268 compareFilter("#@*(foo=bar)", ["type=elemhideexception", "text=#@*(foo=bar)" , 'selector=[foo="bar"]']); 271 compareFilter("#@*(foo=bar)", ["type=elemhideexception", "text=#@*(foo=bar)" , 'selector=[foo="bar"]']);
269 compareFilter("#@#body > div:first-child", ["type=elemhideexception", "text= #@#body > div:first-child", "selector=body > div:first-child"]); 272 compareFilter("#@#body > div:first-child", ["type=elemhideexception", "text= #@#body > div:first-child", "selector=body > div:first-child"]);
270 compareFilter("foo#@ddd", ["type=elemhideexception", "text=foo#@ddd", "selec torDomain=foo", "selector=ddd", "domains=FOO"]); 273 compareFilter("foo#@ddd", ["type=elemhideexception", "text=foo#@ddd", "selec torDomain=foo", "selector=ddd", "domains=FOO"]);
271 compareFilter("foo,bar#@ddd", ["type=elemhideexception", "text=foo,bar#@ddd" , "selectorDomain=foo,bar", "selector=ddd", "domains=BAR|FOO"]); 274 compareFilter("foo,bar#@ddd", ["type=elemhideexception", "text=foo,bar#@ddd" , "selectorDomain=foo,bar", "selector=ddd", "domains=BAR|FOO"]);
272 compareFilter("foo,~bar#@ddd", ["type=elemhideexception", "text=foo,~bar#@dd d", "selectorDomain=foo", "selector=ddd", "domains=FOO|~BAR"]); 275 compareFilter("foo,~bar#@ddd", ["type=elemhideexception", "text=foo,~bar#@dd d", "selectorDomain=foo", "selector=ddd", "domains=FOO|~BAR"]);
273 compareFilter("foo,~baz,bar#@ddd", ["type=elemhideexception", "text=foo,~baz ,bar#@ddd", "selectorDomain=foo,bar", "selector=ddd", "domains=BAR|FOO|~BAZ"]); 276 compareFilter("foo,~baz,bar#@ddd", ["type=elemhideexception", "text=foo,~baz ,bar#@ddd", "selectorDomain=foo,bar", "selector=ddd", "domains=BAR|FOO|~BAZ"]);
274 }); 277 });
275 })(); 278 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld