Bug 1201437 - Add tests to ensure correct icon is displayed in control center for user-added security exceptions. r=paolo

MozReview-Commit-ID: 1WDKYOhbzUf

--HG--
extra : rebase_source : 24f61418c3d6f9c7466bb49701b29ce1e7f1031e
This commit is contained in:
Nihanth Subramanya 2016-02-24 22:45:59 -08:00
Родитель 6e71a5e6cf
Коммит 3ba8a40226
1 изменённых файлов: 31 добавлений и 1 удалений

Просмотреть файл

@ -8,7 +8,7 @@
// a bad certificate, being redirected to the internal about:certerror page,
// using the button contained therein to load the certificate exception
// dialog, using that to add an exception, and finally successfully visiting
// the site.
// the site, including showing the right identity box and control center icons.
function test() {
waitForExplicitFinish();
whenNewTabLoaded(window, loadBadCertPage);
@ -67,6 +67,7 @@ var certExceptionDialogObserver = {
var successfulLoadListener = {
handleEvent: function() {
gBrowser.selectedBrowser.removeEventListener("load", this, true);
checkControlPanelIcons();
let certOverrideService = Cc["@mozilla.org/security/certoverride;1"]
.getService(Ci.nsICertOverrideService);
certOverrideService.clearValidityOverride("expired.example.com", -1);
@ -75,6 +76,35 @@ var successfulLoadListener = {
}
};
// Check for the correct icons in the identity box and control center.
function checkControlPanelIcons() {
let { gIdentityHandler } = gBrowser.ownerGlobal;
gIdentityHandler._identityBox.click();
document.getElementById("identity-popup-security-expander").click();
is_element_visible(document.getElementById("connection-icon"));
let connectionIconImage = gBrowser.ownerGlobal
.getComputedStyle(document.getElementById("connection-icon"), "")
.getPropertyValue("list-style-image");
let securityViewBG = gBrowser.ownerGlobal
.getComputedStyle(document.getElementById("identity-popup-securityView"), "")
.getPropertyValue("background-image");
let securityContentBG = gBrowser.ownerGlobal
.getComputedStyle(document.getElementById("identity-popup-security-content"), "")
.getPropertyValue("background-image");
is(connectionIconImage,
"url(\"chrome://browser/skin/identity-mixed-passive-loaded.svg\")",
"Using expected icon image in the identity block");
is(securityViewBG,
"url(\"chrome://browser/skin/identity-mixed-passive-loaded.svg\")",
"Using expected icon image in the Control Center main view");
is(securityContentBG,
"url(\"chrome://browser/skin/identity-mixed-passive-loaded.svg\")",
"Using expected icon image in the Control Center subview");
gIdentityHandler._identityPopup.hidden = true;
}
// Utility function to get a handle on the certificate exception dialog.
// Modified from toolkit/components/passwordmgr/test/prompt_common.js
function getDialog(aLocation) {