From 8d5696d571ead7356ca4ae4c4c473ff0f74ab1ae Mon Sep 17 00:00:00 2001 From: Julian Descottes Date: Mon, 1 May 2017 17:42:28 +0200 Subject: [PATCH] Bug 1361054 - move scratchpad sessions test to devtools/client/scratchpad;r=mikedeboer DevTools are moving out of mozilla central, and since this test is relying on scratchpad being available, it would probably make sense to move it to the scratchpad test suite which will still be run in the new devtools continuous integration setup. MozReview-Commit-ID: 19x6Ccp85ND --HG-- rename : browser/components/sessionstore/test/browser_644409-scratchpads.js => devtools/client/scratchpad/test/browser_scratchpad_sessions.js extra : rebase_source : bf564025199748b43ef56333f5c5626b266be1ca --- .../components/sessionstore/test/browser.ini | 1 - devtools/client/scratchpad/test/browser.ini | 1 + .../test/browser_scratchpad_sessions.js | 21 ++++++++++++------- 3 files changed, 14 insertions(+), 9 deletions(-) rename browser/components/sessionstore/test/browser_644409-scratchpads.js => devtools/client/scratchpad/test/browser_scratchpad_sessions.js (69%) diff --git a/browser/components/sessionstore/test/browser.ini b/browser/components/sessionstore/test/browser.ini index b10f7283ca5f..4c7d758521de 100644 --- a/browser/components/sessionstore/test/browser.ini +++ b/browser/components/sessionstore/test/browser.ini @@ -198,7 +198,6 @@ skip-if = true # Needs to be rewritten as Marionette test, bug 995916 [browser_635418.js] [browser_636279.js] [browser_637020.js] -[browser_644409-scratchpads.js] [browser_645428.js] [browser_659591.js] [browser_662743.js] diff --git a/devtools/client/scratchpad/test/browser.ini b/devtools/client/scratchpad/test/browser.ini index cc67ce1ab6d7..5d33d915eb65 100644 --- a/devtools/client/scratchpad/test/browser.ini +++ b/devtools/client/scratchpad/test/browser.ini @@ -17,6 +17,7 @@ support-files = head.js [browser_scratchpad_recent_files.js] # [browser_scratchpad_confirm_close.js] # Disable test due to bug 807234 becoming basically permanent +[browser_scratchpad_sessions.js] [browser_scratchpad_tab.js] [browser_scratchpad_wrong_window_focus.js] [browser_scratchpad_unsaved.js] diff --git a/browser/components/sessionstore/test/browser_644409-scratchpads.js b/devtools/client/scratchpad/test/browser_scratchpad_sessions.js similarity index 69% rename from browser/components/sessionstore/test/browser_644409-scratchpads.js rename to devtools/client/scratchpad/test/browser_scratchpad_sessions.js index fbd1d77ff2b7..a6d1728ddd9e 100644 --- a/browser/components/sessionstore/test/browser_644409-scratchpads.js +++ b/devtools/client/scratchpad/test/browser_scratchpad_sessions.js @@ -1,10 +1,15 @@ /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ +"use strict"; + +const {Utils} = Cu.import("resource://gre/modules/sessionstore/Utils.jsm", {}); +const triggeringPrincipalBase64 = Utils.SERIALIZED_SYSTEMPRINCIPAL; +const ss = Cc["@mozilla.org/browser/sessionstore;1"].getService(Ci.nsISessionStore); const testState = { windows: [{ tabs: [ - { entries: [{ url: "about:blank", triggeringPrincipal_base64 }] }, + { entries: [{ url: "about:blank", triggeringPrincipalBase64 }] }, ] }], scratchpads: [ @@ -35,10 +40,10 @@ function test() { ss.setBrowserState(JSON.stringify(testState)); } -function windowObserver(aSubject, aTopic, aData) { - if (aTopic == "domwindowopened") { - let win = aSubject.QueryInterface(Ci.nsIDOMWindow); - win.addEventListener("load", function() { +function windowObserver(subject, topic, data) { + if (topic == "domwindowopened") { + let win = subject.QueryInterface(Ci.nsIDOMWindow); + win.addEventListener("load", function () { if (win.Scratchpad) { win.Scratchpad.addObserver({ onReady() { @@ -56,11 +61,11 @@ function windowObserver(aSubject, aTopic, aData) { } function statesMatch(restored, states) { - return states.every(function(state) { - return restored.some(function(restoredState) { + return states.every(function (state) { + return restored.some(function (restoredState) { return state.filename == restoredState.filename && state.text == restoredState.text && state.executionContext == restoredState.executionContext; - }) + }); }); }