From 65e959c068bc9c7e39e6209f6bc011aec4f279c7 Mon Sep 17 00:00:00 2001 From: Thom Chiovoloni Date: Fri, 5 May 2017 14:54:03 -0400 Subject: [PATCH] Bug 1357814 - Changes to sync's TPS tests to allow running from automation r=markh 1. Ensure we wait for browser-delayed-startup-finished 2. Parse the profile we're cleaning up from the cleanup phase name instead of using the selectedProfile. 3. Ensure that bookmark repair doesn't run randomly (this isn't necessary, but the repair code can make the actual reason for failure much more difficult to debug, and could probably cause a test to pass when it should not). 4. Add multiprocessCompatible flags so that TPS can still start in nightly (and because it is). MozReview-Commit-ID: 98UvRoFOdzv --HG-- extra : rebase_source : ff1f199eafdcc569cfdf9cb373ee4d059b37ec35 --- .../sync/tps/extensions/mozmill/install.rdf | 1 + .../extensions/tps/components/tps-cmdline.js | 25 ++++++++++--------- services/sync/tps/extensions/tps/install.rdf | 1 + .../sync/tps/extensions/tps/resource/tps.jsm | 5 ++-- testing/tps/tps/testrunner.py | 1 + 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/services/sync/tps/extensions/mozmill/install.rdf b/services/sync/tps/extensions/mozmill/install.rdf index bbc759cf1e15..997a7dfec5ab 100755 --- a/services/sync/tps/extensions/mozmill/install.rdf +++ b/services/sync/tps/extensions/mozmill/install.rdf @@ -20,5 +20,6 @@ 38.* + true diff --git a/services/sync/tps/extensions/tps/components/tps-cmdline.js b/services/sync/tps/extensions/tps/components/tps-cmdline.js index 8d0f1c84a4f2..71bed6208e14 100644 --- a/services/sync/tps/extensions/tps/components/tps-cmdline.js +++ b/services/sync/tps/extensions/tps/components/tps-cmdline.js @@ -20,6 +20,7 @@ const nsISupportsString = Components.interfaces.nsISupportsString; const nsIWindowWatcher = Components.interfaces.nsIWindowWatcher; Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); +Components.utils.import("resource://gre/modules/Services.jsm"); function TPSCmdLineHandler() {} @@ -56,20 +57,20 @@ TPSCmdLineHandler.prototype = { options.ignoreUnusedEngines = cmdLine.handleFlag("ignore-unused-engines", false); - - - /* Ignore the platform's online/offline status while running tests. */ - var ios = Components.classes["@mozilla.org/network/io-service;1"] - .getService(Components.interfaces.nsIIOService2); - ios.manageOfflineStatus = false; - ios.offline = false; - - Components.utils.import("resource://tps/tps.jsm"); - Components.utils.import("resource://tps/quit.js", TPS); let uri = cmdLine.resolveURI(uristr).spec; - TPS.RunTestPhase(uri, phase, logfile, options); - // cmdLine.preventDefault = true; + const onStartupFinished = () => { + Services.obs.removeObserver(onStartupFinished, "browser-delayed-startup-finished"); + /* Ignore the platform's online/offline status while running tests. */ + var ios = Components.classes["@mozilla.org/network/io-service;1"] + .getService(Components.interfaces.nsIIOService2); + ios.manageOfflineStatus = false; + ios.offline = false; + Components.utils.import("resource://tps/tps.jsm"); + Components.utils.import("resource://tps/quit.js", TPS); + TPS.RunTestPhase(uri, phase, logfile, options); + }; + Services.obs.addObserver(onStartupFinished, "browser-delayed-startup-finished"); }, helpInfo: " --tps Run TPS tests with the given test file.\n" + diff --git a/services/sync/tps/extensions/tps/install.rdf b/services/sync/tps/extensions/tps/install.rdf index 3dcdc5e44522..76375235d180 100644 --- a/services/sync/tps/extensions/tps/install.rdf +++ b/services/sync/tps/extensions/tps/install.rdf @@ -24,5 +24,6 @@ Jonathan Griffin Henrik Skupin https://developer.mozilla.org/en-US/docs/TPS + true diff --git a/services/sync/tps/extensions/tps/resource/tps.jsm b/services/sync/tps/extensions/tps/resource/tps.jsm index faab2704f6e2..c5486a6cfeec 100644 --- a/services/sync/tps/extensions/tps/resource/tps.jsm +++ b/services/sync/tps/extensions/tps/resource/tps.jsm @@ -900,10 +900,9 @@ var TPS = { // parse the test file Services.scriptloader.loadSubScript(file, this); this._currentPhase = phase; + // cleanup phases are in the format `cleanup-${profileName}`. if (this._currentPhase.startsWith("cleanup-")) { - let profileToClean = Cc["@mozilla.org/toolkit/profile-service;1"] - .getService(Ci.nsIToolkitProfileService) - .selectedProfile.name; + let profileToClean = this._currentPhase.slice("cleanup-".length); this.phases[this._currentPhase] = profileToClean; this.Phase(this._currentPhase, [[this.Cleanup]]); } else { diff --git a/testing/tps/tps/testrunner.py b/testing/tps/tps/testrunner.py index 06af7b33f157..fb59403aefbc 100644 --- a/testing/tps/tps/testrunner.py +++ b/testing/tps/tps/testrunner.py @@ -77,6 +77,7 @@ class TPSTestRunner(object): # hrm - not sure what the release/beta channels will do? 'xpinstall.signatures.required': False, 'services.sync.testing.tps': True, + 'engine.bookmarks.repair.enabled': False, } debug_preferences = {