Bug 1043805 - Add tests for checking mixedblockdisabled and trackingblockdisabled attributes. r=adw

This commit is contained in:
Alex Bardas 2014-09-17 10:39:00 +02:00
parent f60e558849
commit 50a3b6ef92
2 changed files with 21 additions and 0 deletions

View File

@ -43,6 +43,10 @@ function overrideMCB()
ok(notification, "Mixed Content Doorhanger should appear");
notification.reshow();
ok(PopupNotifications.panel.firstChild.isMixedContentBlocked, "OK: Mixed Content is being blocked");
// Make sure the notification has no mixedblockdisabled attribute
ok(!PopupNotifications.panel.firstChild.hasAttribute("mixedblockdisabled"),
"Doorhanger must have no mixedblockdisabled attribute");
// Click on the doorhanger to allow mixed content (and reload page)
PopupNotifications.panel.firstChild.disableMixedContentProtection();
notification.remove();
@ -56,6 +60,15 @@ function mixedContentOverrideTest()
is(gTestBrowser.docShell.hasMixedActiveContentLoaded, true, "hasMixedActiveContentLoaded flag has not been set");
is(gTestBrowser.docShell.hasMixedDisplayContentBlocked, false, "second hasMixedDisplayContentBlocked flag has been set");
is(gTestBrowser.docShell.hasMixedActiveContentBlocked, false, "second hasMixedActiveContentBlocked flag has been set");
let notification = PopupNotifications.getNotification("bad-content", gTestBrowser);
ok(notification, "Mixed Content Doorhanger should appear");
notification.reshow();
// Make sure the notification has the mixedblockdisabled attribute set to true
is(PopupNotifications.panel.firstChild.getAttribute("mixedblockdisabled"), "true",
"Doorhanger must have [mixedblockdisabled='true'] attribute");
gBrowser.removeCurrentTab();
finish();
}

View File

@ -68,6 +68,10 @@ function testTrackingPage(gTestBrowser)
isnot(PopupNotifications.panel.firstChild.isTrackingContentBlocked, 0,
"Tracking Content is being blocked");
// Make sure the notification has no trackingblockdisabled attribute
ok(!PopupNotifications.panel.firstChild.hasAttribute("trackingblockdisabled"),
"Doorhanger must have no trackingblockdisabled attribute");
// Disable Tracking Content Protection for the page (which reloads the page)
PopupNotifications.panel.firstChild.disableTrackingContentProtection();
}
@ -81,6 +85,10 @@ function testTrackingPageWhitelisted(gTestBrowser)
// Make sure the state of the doorhanger does NOT include blocking tracking elements
is(PopupNotifications.panel.firstChild.isTrackingContentBlocked, 0,
"Tracking Content is NOT being blocked");
// Make sure the notification has the trackingblockdisabled attribute set to true
is(PopupNotifications.panel.firstChild.getAttribute("trackingblockdisabled"), "true",
"Doorhanger must have [trackingblockdisabled='true'] attribute");
}
function testTrackingPageOFF(gTestBrowser)