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

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

Issue 6439460933730304: Issue 616 - Add tests for $generichide and $genericblock (Closed)
Left Patch Set: Fixed contentpolicy tests with recent changes to underlying logic Created Sept. 5, 2015, 2:41 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/matcher.js ('k') | no next file » | 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 let server = null; 3 let server = null;
4 let frame = null; 4 let frame = null;
5 let requestNotifier = null; 5 let requestNotifier = null;
6 let httpProtocol = null; 6 let httpProtocol = null;
7 7
8 module("Content policy", { 8 module("Content policy", {
9 setup: function() 9 setup: function()
10 { 10 {
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 if (prevWnd == wnd && prevItem.location == item.location && prevItem.type == item.type && prevItem.docDomain == item.docDomain) 290 if (prevWnd == wnd && prevItem.location == item.location && prevItem.type == item.type && prevItem.docDomain == item.docDomain)
291 policyHits.pop(); 291 policyHits.pop();
292 } 292 }
293 policyHits.push([wnd, node, item]); 293 policyHits.push([wnd, node, item]);
294 } 294 }
295 295
296 function runTest([name, body, expectedURL, expectedType, expectedThirdParty, e xplicitEvent], stage) 296 function runTest([name, body, expectedURL, expectedType, expectedThirdParty, e xplicitEvent], stage)
297 { 297 {
298 defaultMatcher.clear(); 298 defaultMatcher.clear();
299 299
300 if (stage > 1) 300 if (stage == 7)
301 if (stage == 7) 301 defaultMatcher.add(Filter.fromText(expectedURL + "$domain=127.0.0.1"));
Felix Dahlke 2015/09/28 18:24:07 I think this block can be simplified: if (stage =
kzar 2015/09/29 11:07:02 Done.
302 defaultMatcher.add(Filter.fromText(expectedURL + "$domain=127.0.0.1")); 302 else if (stage > 1)
303 else 303 defaultMatcher.add(Filter.fromText(expectedURL));
304 defaultMatcher.add(Filter.fromText(expectedURL));
305 304
306 if (stage == 3) 305 if (stage == 3)
307 defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$document")); 306 defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$document"));
308 if (stage == 4) 307 if (stage == 4)
309 defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$~document")); 308 defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$~document"));
310 if (stage == 5) 309 if (stage == 5)
311 defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$document,site key=" + publickey)); 310 defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$document,site key=" + publickey));
312 if (stage == 6 || stage == 7) 311 if (stage == 6 || stage == 7)
313 defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$genericblock" )); 312 defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$genericblock" ));
314 if (stage == 8) 313 if (stage == 8)
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 for (let stage = 1; stage in stageDescriptions; stage++) 420 for (let stage = 1; stage in stageDescriptions; stage++)
422 { 421 {
423 let stageDescription = stageDescriptions[stage]; 422 let stageDescription = stageDescriptions[stage];
424 if (stageDescription.indexOf("%S") >= 0) 423 if (stageDescription.indexOf("%S") >= 0)
425 stageDescription = stageDescription.replace("%S", expectedURL); 424 stageDescription = stageDescription.replace("%S", expectedURL);
426 425
427 asyncTest(name + " (" + stageDescription + ")", runTest.bind(null, tests[t est], stage)); 426 asyncTest(name + " (" + stageDescription + ")", runTest.bind(null, tests[t est], stage));
428 } 427 }
429 } 428 }
430 })(); 429 })();
LEFTRIGHT

Powered by Google App Engine
This is Rietveld