Bug 1317164 - ensure browser_967000_button_sync.js cleans up after itself completely. r=malayaleecoder
authorMark Hammond <mhammond@skippinet.com.au>
Fri, 25 Nov 2016 18:12:55 +1100
changeset 372295 8ea964e7ab596c985f0b8d9ab86e251b64cadf49
parent 372294 437aab812660f23db1cb6cc9f321c56856da48f7
child 372296 6060c3c5634270024b22c7ef28f29063ce3e35fa
push id1419
push userjlund@mozilla.com
push dateMon, 10 Apr 2017 20:44:07 +0000
treeherdermozilla-release@5e6801b73ef6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmalayaleecoder
bugs1317164
milestone53.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 1317164 - ensure browser_967000_button_sync.js cleans up after itself completely. r=malayaleecoder MozReview-Commit-ID: DO5RbkGj0Dv
browser/components/customizableui/test/browser_967000_button_sync.js
--- a/browser/components/customizableui/test/browser_967000_button_sync.js
+++ b/browser/components/customizableui/test/browser_967000_button_sync.js
@@ -37,18 +37,28 @@ let mockedInternal = {
   hasSyncedThisSession: false,
 };
 
 
 add_task(function* setup() {
   let oldInternal = SyncedTabs._internal;
   SyncedTabs._internal = mockedInternal;
 
+  // This test hacks some observer states to simulate a user being signed
+  // in to Sync - restore them when the test completes.
+  let initialObserverStates = {};
+  for (let id of ["sync-reauth-state", "sync-setup-state", "sync-syncnow-state"]) {
+    initialObserverStates[id] = document.getElementById(id).hidden;
+  }
+
   registerCleanupFunction(() => {
     SyncedTabs._internal = oldInternal;
+    for (let [id, initial] of Object.entries(initialObserverStates)) {
+      document.getElementById(id).hidden = initial;
+    }
   });
 });
 
 // The test expects the about:preferences#sync page to open in the current tab
 function* openPrefsFromMenuPanel(expectedPanelId, entryPoint) {
   info("Check Sync button functionality");
   Services.prefs.setCharPref("identity.fxaccounts.remote.signup.uri", "http://example.com/");