mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1098357 - Make Session Restore talos test e10s-friendly. r=mconley
This commit is contained in:
parent
31627ba5e2
commit
c7efc1902d
@ -297,14 +297,6 @@ def get_counters(config):
|
||||
def get_active_tests(config):
|
||||
activeTests = config.pop('activeTests').strip().split(':')
|
||||
|
||||
# temporary hack for now until we have e10s running on all tests
|
||||
if config['e10s'] and not config['develop']:
|
||||
for testname in ('sessionrestore',
|
||||
'sessionrestore_no_auto_restore'):
|
||||
if testname in activeTests:
|
||||
print "%s is unsupported on e10s, removing from list of " \
|
||||
"tests to run" % testname
|
||||
activeTests.remove(testname)
|
||||
# ensure tests are available
|
||||
availableTests = test.test_dict()
|
||||
if not set(activeTests).issubset(availableTests):
|
||||
|
@ -0,0 +1,89 @@
|
||||
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
||||
/* vim: set ts=2 et sw=2 tw=80 filetype=javascript: */
|
||||
/* 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/. */
|
||||
|
||||
"use strict";
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "Services",
|
||||
"resource://gre/modules/Services.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "setTimeout",
|
||||
"resource://gre/modules/Timer.jsm");
|
||||
|
||||
// Observer Service topics.
|
||||
const STARTUP_TOPIC = "profile-after-change";
|
||||
const RESTORED_TOPIC = "sessionstore-windows-restored";
|
||||
|
||||
// Process Message Manager topics.
|
||||
const MSG_REQUEST = "session-restore-test?duration";
|
||||
const MSG_PROVIDE = "session-restore-test:duration";
|
||||
|
||||
function nsSessionRestoreTalosTest() {}
|
||||
|
||||
nsSessionRestoreTalosTest.prototype = {
|
||||
classID: Components.ID("{716346e5-0c45-4aa2-b601-da36f3c74bd8}"),
|
||||
|
||||
_xpcom_factory: XPCOMUtils.generateSingletonFactory(nsSessionRestoreTalosTest),
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// nsISupports
|
||||
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
//// nsIObserver
|
||||
|
||||
observe: function DS_observe(aSubject, aTopic, aData) {
|
||||
switch (aTopic) {
|
||||
case STARTUP_TOPIC:
|
||||
this.init();
|
||||
break;
|
||||
case RESTORED_TOPIC:
|
||||
this.onRestored();
|
||||
break;
|
||||
default:
|
||||
throw new Error(`Unknown topic ${aTopic}`);
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Perform initialization on profile-after-change.
|
||||
*/
|
||||
init: function() {
|
||||
Services.obs.addObserver(this, RESTORED_TOPIC, false);
|
||||
},
|
||||
|
||||
/**
|
||||
* Session Restore is complete, hurray.
|
||||
*/
|
||||
onRestored: function() {
|
||||
setTimeout(function() {
|
||||
// `sessionRestored` actually becomes available only on the next tick.
|
||||
let startup_info = Services.startup.getStartupInfo();
|
||||
let duration = startup_info.sessionRestored - startup_info.sessionRestoreInit;
|
||||
|
||||
// Broadcast startup duration information immediately, in case the talos
|
||||
// page is already loaded.
|
||||
Services.ppmm.broadcastAsyncMessage(MSG_PROVIDE, {duration});
|
||||
|
||||
// Now, in case the talos page isn't loaded yet, prepare to respond if it
|
||||
// requestions the duration information.
|
||||
Services.ppmm.addMessageListener(MSG_REQUEST, function listener() {
|
||||
Services.ppmm.removeMessageListener(MSG_REQUEST, listener);
|
||||
Services.ppmm.broadcastAsyncMessage(MSG_PROVIDE, {duration});
|
||||
});
|
||||
}, 0);
|
||||
},
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//// Module
|
||||
|
||||
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([nsSessionRestoreTalosTest]);
|
@ -0,0 +1,8 @@
|
||||
# Register a component to be informed of startup. This component can then register
|
||||
# itself to watch sessionstore-windows-restored. Once it has observed
|
||||
# sessionstore-windows-restored, it will open the webpage with the harness.
|
||||
component {716346e5-0c45-4aa2-b601-da36f3c74bd8} SessionRestoreTalosTest.js
|
||||
contract @mozilla.org/talos/session-restore-test;1 {716346e5-0c45-4aa2-b601-da36f3c74bd8}
|
||||
category profile-after-change nsSessionRestoreTalosTest @mozilla.org/talos/session-restore-test;1
|
||||
|
||||
content session-restore-test content/
|
@ -0,0 +1,20 @@
|
||||
<?xml version="1.0"?><RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#"><Description about="urn:mozilla:install-manifest">
|
||||
|
||||
<!-- Required Items -->
|
||||
<em:id>session-restore-test@mozilla.org</em:id>
|
||||
<em:name>Session Restore Startup Performance Test</em:name>
|
||||
<em:version>1.2.0</em:version>
|
||||
|
||||
<em:targetApplication>
|
||||
<Description>
|
||||
<em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
|
||||
<em:minVersion>1.5</em:minVersion>
|
||||
<em:maxVersion>99.0.*</em:maxVersion>
|
||||
</Description>
|
||||
</em:targetApplication>
|
||||
|
||||
<!-- Optional Items -->
|
||||
<em:creator>David Rajchenbach-Teller</em:creator>
|
||||
<em:description>Bug 936630, bug 1098357. This add-on broadcasts the duration of session restore.</em:description>
|
||||
<em:homepageURL>https://bugzilla.mozilla.org/show_bug.cgi?id=1098357</em:homepageURL>
|
||||
</Description></RDF>
|
@ -2,53 +2,41 @@
|
||||
|
||||
var Services = Components.utils.import("resource://gre/modules/Services.jsm", {}).Services;
|
||||
|
||||
/**
|
||||
* Display the result, send it to the harness and quit.
|
||||
*/
|
||||
function finish() {
|
||||
Profiler.pause("This test measures the time between sessionRestoreInit and sessionRestored, ignore everything around that");
|
||||
Profiler.initFromURLQueryParams(location.search);
|
||||
Profiler.finishStartupProfiling();
|
||||
// Process Message Manager topics.
|
||||
const MSG_REQUEST = "session-restore-test?duration";
|
||||
const MSG_PROVIDE = "session-restore-test:duration";
|
||||
|
||||
setTimeout(function () {
|
||||
var startup_info = Services.startup.getStartupInfo();
|
||||
Services.cpmm.addMessageListener(MSG_PROVIDE,
|
||||
/**
|
||||
* Display the result, send it to the harness and quit.
|
||||
*/
|
||||
function finish(msg) {
|
||||
console.log(`main.js: received data on ${MSG_PROVIDE}`, msg);
|
||||
Services.cpmm.removeMessageListener(MSG_PROVIDE, finish);
|
||||
var duration = msg.data.duration;
|
||||
|
||||
var duration = startup_info.sessionRestored - startup_info.sessionRestoreInit;
|
||||
Profiler.pause("This test measures the time between sessionRestoreInit and sessionRestored, ignore everything around that");
|
||||
Profiler.initFromURLQueryParams(location.search);
|
||||
Profiler.finishStartupProfiling();
|
||||
|
||||
// Show result on screen. Nice but not really necessary.
|
||||
document.getElementById("sessionRestoreInit-to-sessionRestored").textContent = duration + "ms";
|
||||
setTimeout(function () {
|
||||
// Show result on screen. Nice but not really necessary.
|
||||
document.getElementById("sessionRestoreInit-to-sessionRestored").textContent = duration + "ms";
|
||||
|
||||
// Report data to Talos, if possible
|
||||
dumpLog("__start_report" +
|
||||
duration +
|
||||
"__end_report\n\n");
|
||||
// Report data to Talos, if possible
|
||||
dumpLog("__start_report" +
|
||||
duration +
|
||||
"__end_report\n\n");
|
||||
|
||||
// Next one is required by the test harness but not used
|
||||
dumpLog("__startTimestamp" +
|
||||
Date.now() +
|
||||
"__endTimestamp\n\n");
|
||||
// Next one is required by the test harness but not used
|
||||
dumpLog("__startTimestamp" +
|
||||
Date.now() +
|
||||
"__endTimestamp\n\n");
|
||||
|
||||
goQuitApplication();
|
||||
}, 0);
|
||||
}
|
||||
goQuitApplication();
|
||||
}, 0);
|
||||
});
|
||||
|
||||
function main() {
|
||||
// Collect (and display) data
|
||||
var startup_info = Services.startup.getStartupInfo();
|
||||
|
||||
// The script may be triggered before or after sessionRestored
|
||||
// and sessionRestoreInit are available. If both are available,
|
||||
// we are done.
|
||||
if (typeof startup_info.sessionRestored != "undefined"
|
||||
&& typeof startup_info.sessionRestoreInit != "undefined") {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
// Otherwise, we need to wait until *after* sesionstore-windows-restored,
|
||||
// which is the event that sets sessionRestored - since sessionRestoreInit
|
||||
// is set before sessionRestored, we are certain that both are now set.
|
||||
Services.obs.addObserver(finish, "sessionstore-windows-restored", false);
|
||||
}
|
||||
|
||||
main();
|
||||
// In case the add-on has broadcasted the message before we were loaded,
|
||||
// request a second broadcast.
|
||||
Services.cpmm.sendAsyncMessage(MSG_REQUEST, {});
|
||||
|
@ -0,0 +1 @@
|
||||
{"profile-after-change":true,"final-ui-startup":true,"sessionstore-windows-restored":true,"quit-application-granted":true,"quit-application":true,"sessionstore-final-state-write-complete":true,"profile-change-net-teardown":true,"profile-change-teardown":true,"profile-before-change":true}
|
@ -148,6 +148,7 @@ class sessionrestore(TsBase):
|
||||
2. Launch Firefox.
|
||||
3. Measure the delta between firstPaint and sessionRestored.
|
||||
"""
|
||||
extensions = '${talos}/startup_test/sessionrestore/addon'
|
||||
cycles = 10
|
||||
timeout = 1000000
|
||||
sps_profile_startup = True
|
||||
@ -155,7 +156,7 @@ class sessionrestore(TsBase):
|
||||
profile_path = '${talos}/startup_test/sessionrestore/profile'
|
||||
url = 'startup_test/sessionrestore/index.html'
|
||||
shutdown = False
|
||||
reinstall = ['sessionstore.js']
|
||||
reinstall = ['sessionstore.js', 'sessionCheckpoints.json']
|
||||
# Restore the session
|
||||
preferences = {'browser.startup.page': 3}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user