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

Unified Diff: chrome/content/tests/policy.js

Issue 6439460933730304: Issue 616 - Add tests for $generichide and $genericblock (Closed)
Patch Set: Fixed contentpolicy tests with recent changes to underlying logic Created Sept. 5, 2015, 2:41 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« chrome/content/tests/matcher.js ('K') | « chrome/content/tests/matcher.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/content/tests/policy.js
diff --git a/chrome/content/tests/policy.js b/chrome/content/tests/policy.js
index d977b44850f4a2718fc04d45e971dce7e1e1c259..65460cc85e1d9e13cb23cea2a4a9e47e9cfa7b96 100644
--- a/chrome/content/tests/policy.js
+++ b/chrome/content/tests/policy.js
@@ -298,13 +298,21 @@
defaultMatcher.clear();
if (stage > 1)
- defaultMatcher.add(Filter.fromText(expectedURL));
+ if (stage == 7)
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.
+ defaultMatcher.add(Filter.fromText(expectedURL + "$domain=127.0.0.1"));
+ else
+ defaultMatcher.add(Filter.fromText(expectedURL));
+
if (stage == 3)
defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$document"));
if (stage == 4)
defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$~document"));
if (stage == 5)
defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$document,sitekey=" + publickey));
+ if (stage == 6 || stage == 7)
+ defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$genericblock"));
+ if (stage == 8)
+ defaultMatcher.add(Filter.fromText("@@||127.0.0.1:1234/test|$genericblock,sitekey=" + publickey));
if (!explicitEvent)
{
@@ -367,7 +375,7 @@
equal(policyHits.length, 0, "Number of policy hits");
// We cannot rely on the correctness of policy hits for sitekey filters due to blocking
// filter hits being counted even if the resource doesn't end up getting blocked
- else if (stage != 5)
+ else if (stage != 5 && stage != 6 && stage != 8)
{
equal(policyHits.length, 1, "Number of policy hits");
if (policyHits.length == 1)
@@ -401,7 +409,10 @@
2: "running with filter %S",
3: "running with filter %S and site exception",
4: "running with filter %S and exception not applicable to sites",
- 5: "running with filter %S and sitekey exception"
+ 5: "running with filter %S and sitekey exception",
+ 6: "running with filter %S and $genericblock exception",
+ 7: "running with filter %S$domain=127.0.0.1 and $genericblock exception",
+ 8: "running with filter %S and $genericblock,sitekey exception"
};
for (let test = 0; test < tests.length; test++)
« chrome/content/tests/matcher.js ('K') | « chrome/content/tests/matcher.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld