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

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

Issue 29329486: Issue 3208 - Adjust unit tests for the content policy changes (Closed)
Patch Set: Created Oct. 29, 2015, 1:59 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/test_requestList.html » ('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 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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 if (policyHits.length == 1) 380 if (policyHits.length == 1)
381 { 381 {
382 let [wnd, node, item] = policyHits[0]; 382 let [wnd, node, item] = policyHits[0];
383 383
384 equal(item.location, expectedURL, "Request URL"); 384 equal(item.location, expectedURL, "Request URL");
385 385
386 expectedStatus = (stage == 1 ? "allowed" : "blocked"); 386 expectedStatus = (stage == 1 ? "allowed" : "blocked");
387 let actualStatus = (item.filter ? "blocked" : "allowed"); 387 let actualStatus = (item.filter ? "blocked" : "allowed");
388 388
389 equal(actualStatus, expectedStatus, "Request blocked"); 389 equal(actualStatus, expectedStatus, "Request blocked");
390 equal(item.typeDescr.toLowerCase(), expectedType, "Request type"); 390 equal(item.type.toLowerCase(), expectedType, "Request type");
391 equal(item.thirdParty, expectedThirdParty, "Third-party flag"); 391 equal(item.thirdParty, expectedThirdParty, "Third-party flag");
392 equal(item.docDomain, "127.0.0.1", "Document domain"); 392 equal(item.docDomain, "127.0.0.1", "Document domain");
393 } 393 }
394 } 394 }
395 server.registerPathHandler(expectedURL.replace(/http:\/\/[^\/]+/, ""), nul l); 395 server.registerPathHandler(expectedURL.replace(/http:\/\/[^\/]+/, ""), nul l);
396 equal(serverHit, expectedStatus == "allowed", "Request received by server" ); 396 equal(serverHit, expectedStatus == "allowed", "Request received by server" );
397 397
398 frame.removeEventListener("abp:frameready", callback, false); 398 frame.removeEventListener("abp:frameready", callback, false);
399 399
400 start(); 400 start();
(...skipping 19 matching lines...) Expand all
420 for (let stage = 1; stage in stageDescriptions; stage++) 420 for (let stage = 1; stage in stageDescriptions; stage++)
421 { 421 {
422 let stageDescription = stageDescriptions[stage]; 422 let stageDescription = stageDescriptions[stage];
423 if (stageDescription.indexOf("%S") >= 0) 423 if (stageDescription.indexOf("%S") >= 0)
424 stageDescription = stageDescription.replace("%S", expectedURL); 424 stageDescription = stageDescription.replace("%S", expectedURL);
425 425
426 asyncTest(name + " (" + stageDescription + ")", runTest.bind(null, tests[t est], stage)); 426 asyncTest(name + " (" + stageDescription + ")", runTest.bind(null, tests[t est], stage));
427 } 427 }
428 } 428 }
429 })(); 429 })();
OLDNEW
« no previous file with comments | « no previous file | chrome/content/tests/test_requestList.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld