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
This commit is contained in:
Thom Chiovoloni 2017-05-05 14:54:03 -04:00
parent 495d4a991a
commit 65e959c068
5 changed files with 18 additions and 15 deletions

View File

@ -20,5 +20,6 @@
<em:maxVersion>38.*</em:maxVersion>
</Description>
</em:targetApplication>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
</Description>
</RDF>

View File

@ -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 <file> Run TPS tests with the given test file.\n" +

View File

@ -24,5 +24,6 @@
<em:creator>Jonathan Griffin</em:creator>
<em:contributor>Henrik Skupin</em:contributor>
<em:homepageURL>https://developer.mozilla.org/en-US/docs/TPS</em:homepageURL>
<em:multiprocessCompatible>true</em:multiprocessCompatible>
</Description>
</RDF>

View File

@ -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 {

View File

@ -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 = {