Bug 1201437 - Add tests to ensure correct icon is displayed in control center for user-added security exceptions. r=paolo
authorNihanth Subramanya <nhnt11@gmail.com>
Wed, 24 Feb 2016 22:45:59 -0800
changeset 321684 8661318f11a994191eccd1ee8c1210db53ca9b58
parent 321683 aa26b10363b144af9c29fd21ced94d6297bf16ca
child 321685 ad029c4e30b017efb2a255294b4528071d951430
child 321914 8ce7a3436936ed07c42de816f2a824b98559fb62
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerspaolo
bugs1201437
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1201437 - Add tests to ensure correct icon is displayed in control center for user-added security exceptions. r=paolo MozReview-Commit-ID: 1WDKYOhbzUf
browser/base/content/test/general/browser_addCertException.js
--- a/browser/base/content/test/general/browser_addCertException.js
+++ b/browser/base/content/test/general/browser_addCertException.js
@@ -3,17 +3,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 // Test adding a certificate exception by attempting to browse to a site with
 // 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);
 }
 
 // Attempt to load https://expired.example.com (which has an expired cert).
 function loadBadCertPage() {
   gBrowser.addProgressListener(certErrorProgressListener);
@@ -62,24 +62,54 @@ var certExceptionDialogObserver = {
     }
   }
 };
 
 // Finally, we should successfully load https://expired.example.com.
 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);
     gBrowser.removeTab(gBrowser.selectedTab);
     finish();
   }
 };
 
+// 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) {
   let wm = Cc["@mozilla.org/appshell/window-mediator;1"]
              .getService(Ci.nsIWindowMediator);
   let enumerator = wm.getXULWindowEnumerator(null);
 
   while (enumerator.hasMoreElements()) {