Bug 1461515 - Make TP test fail if it uses the wrong list. r=dimi

I added a test case in one of the tracking protection tests which will
fail if the annotation list gets pulled into the TP ones.

I also removed unnecessary prefs that were being set in the test.

Differential Revision: https://phabricator.services.mozilla.com/D2486

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Francois Marier 2018-08-01 11:53:14 +00:00
parent e98e918836
commit c370f17bbc
2 changed files with 5 additions and 4 deletions

View File

@ -17,6 +17,8 @@
<!-- The image cache can cache JS handlers, so make sure we use a different URL for raptor.jpg each time -->
<img id="badimage" data-touched="not sure" src="http://tracking.example.com/tests/toolkit/components/url-classifier/tests/mochitest/raptor.jpg?pbmode=test" onload="this.dataset.touched = 'yes';" onerror="this.dataset.touched = 'no';"/>
<img id="goodimage" data-touched="not sure" src="http://tracking.example.org/tests/toolkit/components/url-classifier/tests/mochitest/raptor.jpg?pbmode=test2" onload="this.dataset.touched = 'yes';" onerror="this.dataset.touched = 'no';"/>
The following should not be hidden:
<div id="styleCheck">STYLE TEST</div>

View File

@ -56,6 +56,7 @@ function checkLoads(aWindow, aBlocked) {
is(win.document.getElementById("badscript").dataset.touched, aBlocked ? "no" : "yes", "Should not load tracking javascript");
is(win.document.getElementById("badimage").dataset.touched, aBlocked ? "no" : "yes", "Should not load tracking images");
is(win.document.getElementById("goodscript").dataset.touched, "yes", "Should load whitelisted tracking javascript");
is(win.document.getElementById("goodimage").dataset.touched, "yes", "Should load non-blacklisted image");
var elt = win.document.getElementById("styleCheck");
var style = win.document.defaultView.getComputedStyle(elt);
@ -97,10 +98,8 @@ function checkLoads(aWindow, aBlocked) {
}
SpecialPowers.pushPrefEnv(
{"set": [["urlclassifier.trackingTable", "test-track-simple"],
["privacy.trackingprotection.enabled", false],
["privacy.trackingprotection.pbmode.enabled", true],
["channelclassifier.allowlist_example", true]]},
{"set": [["privacy.trackingprotection.enabled", false],
["privacy.trackingprotection.pbmode.enabled", true]]},
test);
function test() {