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

Side by Side Diff: chrome/content/tests/matcher.js

Issue 29333048: Issue 3452 - Bring back $ping type option (test changes) (Closed)
Patch Set: Created Dec. 23, 2015, 1:05 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/content/tests/policy.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 (function() 1 (function()
2 { 2 {
3 module("Filter matcher", {setup: prepareFilterComponents, teardown: restoreFil terComponents}); 3 module("Filter matcher", {setup: prepareFilterComponents, teardown: restoreFil terComponents});
4 4
5 function compareKeywords(text, expected) 5 function compareKeywords(text, expected)
6 { 6 {
7 for (let filter of [Filter.fromText(text), Filter.fromText("@@" + text)]) 7 for (let filter of [Filter.fromText(text), Filter.fromText("@@" + text)])
8 { 8 {
9 let matcher = new Matcher(); 9 let matcher = new Matcher();
10 let result = []; 10 let result = [];
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 checkMatch(["@@bar.com$genericblock"], "http://foo.com/bar", "GENERICBLOCK", "foo.com", false, null, false, null); 171 checkMatch(["@@bar.com$genericblock"], "http://foo.com/bar", "GENERICBLOCK", "foo.com", false, null, false, null);
172 checkMatch(["/bar"], "http://foo.com/bar", "IMAGE", "foo.com", false, null, true, null); 172 checkMatch(["/bar"], "http://foo.com/bar", "IMAGE", "foo.com", false, null, true, null);
173 checkMatch(["/bar$domain=foo.com"], "http://foo.com/bar", "IMAGE", "foo.com" , false, null, true, "/bar$domain=foo.com"); 173 checkMatch(["/bar$domain=foo.com"], "http://foo.com/bar", "IMAGE", "foo.com" , false, null, true, "/bar$domain=foo.com");
174 }); 174 });
175 175
176 test("Result cache checks", function() 176 test("Result cache checks", function()
177 { 177 {
178 let matcher = new CombinedMatcher(); 178 let matcher = new CombinedMatcher();
179 matcher.add(Filter.fromText("abc$image")); 179 matcher.add(Filter.fromText("abc$image"));
180 matcher.add(Filter.fromText("abc$script")); 180 matcher.add(Filter.fromText("abc$script"));
181 matcher.add(Filter.fromText("abc$~image,~script,~media")); 181 matcher.add(Filter.fromText("abc$~image,~script,~media,~ping"));
182 matcher.add(Filter.fromText("cba$third-party")); 182 matcher.add(Filter.fromText("cba$third-party"));
183 matcher.add(Filter.fromText("cba$~third-party,~script")); 183 matcher.add(Filter.fromText("cba$~third-party,~script"));
184 matcher.add(Filter.fromText("http://def$image")); 184 matcher.add(Filter.fromText("http://def$image"));
185 matcher.add(Filter.fromText("http://def$script")); 185 matcher.add(Filter.fromText("http://def$script"));
186 matcher.add(Filter.fromText("http://def$~image,~script,~media")); 186 matcher.add(Filter.fromText("http://def$~image,~script,~media,~ping"));
187 matcher.add(Filter.fromText("http://fed$third-party")); 187 matcher.add(Filter.fromText("http://fed$third-party"));
188 matcher.add(Filter.fromText("http://fed$~third-party,~script")); 188 matcher.add(Filter.fromText("http://fed$~third-party,~script"));
189 189
190 cacheCheck(matcher, "http://abc", "IMAGE", null, false, "abc$image"); 190 cacheCheck(matcher, "http://abc", "IMAGE", null, false, "abc$image");
191 cacheCheck(matcher, "http://abc", "SCRIPT", null, false, "abc$script"); 191 cacheCheck(matcher, "http://abc", "SCRIPT", null, false, "abc$script");
192 cacheCheck(matcher, "http://abc", "OTHER", null, false, "abc$~image,~script, ~media"); 192 cacheCheck(matcher, "http://abc", "OTHER", null, false, "abc$~image,~script, ~media,~ping");
193 cacheCheck(matcher, "http://cba", "IMAGE", null, false, "cba$~third-party,~s cript"); 193 cacheCheck(matcher, "http://cba", "IMAGE", null, false, "cba$~third-party,~s cript");
194 cacheCheck(matcher, "http://cba", "IMAGE", null, true, "cba$third-party"); 194 cacheCheck(matcher, "http://cba", "IMAGE", null, true, "cba$third-party");
195 cacheCheck(matcher, "http://def", "IMAGE", null, false, "http://def$image"); 195 cacheCheck(matcher, "http://def", "IMAGE", null, false, "http://def$image");
196 cacheCheck(matcher, "http://def", "SCRIPT", null, false, "http://def$script" ); 196 cacheCheck(matcher, "http://def", "SCRIPT", null, false, "http://def$script" );
197 cacheCheck(matcher, "http://def", "OTHER", null, false, "http://def$~image,~ script,~media"); 197 cacheCheck(matcher, "http://def", "OTHER", null, false, "http://def$~image,~ script,~media,~ping");
198 cacheCheck(matcher, "http://fed", "IMAGE", null, false, "http://fed$~third-p arty,~script"); 198 cacheCheck(matcher, "http://fed", "IMAGE", null, false, "http://fed$~third-p arty,~script");
199 cacheCheck(matcher, "http://fed", "IMAGE", null, true, "http://fed$third-par ty"); 199 cacheCheck(matcher, "http://fed", "IMAGE", null, true, "http://fed$third-par ty");
200 cacheCheck(matcher, "http://abc_cba", "MEDIA", null, false, "cba$~third-part y,~script"); 200 cacheCheck(matcher, "http://abc_cba", "MEDIA", null, false, "cba$~third-part y,~script");
201 cacheCheck(matcher, "http://abc_cba", "MEDIA", null, true, "cba$third-party" ); 201 cacheCheck(matcher, "http://abc_cba", "MEDIA", null, true, "cba$third-party" );
202 cacheCheck(matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script"); 202 cacheCheck(matcher, "http://abc_cba", "SCRIPT", null, false, "abc$script");
203 cacheCheck(matcher, "http://def?http://fed", "MEDIA", null, false, "http://f ed$~third-party,~script"); 203 cacheCheck(matcher, "http://def?http://fed", "MEDIA", null, false, "http://f ed$~third-party,~script");
204 cacheCheck(matcher, "http://def?http://fed", "MEDIA", null, true, "http://fe d$third-party"); 204 cacheCheck(matcher, "http://def?http://fed", "MEDIA", null, true, "http://fe d$third-party");
205 cacheCheck(matcher, "http://def?http://fed", "SCRIPT", null, false, "http:// def$script"); 205 cacheCheck(matcher, "http://def?http://fed", "SCRIPT", null, false, "http:// def$script");
206 }); 206 });
207 })(); 207 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/content/tests/policy.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld