Bug 1496649 Convert tresize to pageloader r=jmaher

The talos tresize test was originally written as a "startup" test which
is confusing since it doesn't measure anything that happens during
browser startup.  Convert it here to the "pageloader" style, which
mostly involves moving files around, also some changes to how the test
results are reported to the Talos framework.

--HG--
rename : testing/talos/talos/startup_test/tresize/addon/bootstrap.js => testing/talos/talos/tests/tresize/addon/bootstrap.js
rename : testing/talos/talos/startup_test/tresize/addon/chrome.manifest => testing/talos/talos/tests/tresize/addon/chrome.manifest
rename : testing/talos/talos/startup_test/tresize/addon/content/Profiler.js => testing/talos/talos/tests/tresize/addon/content/Profiler.js
rename : testing/talos/talos/startup_test/tresize/addon/content/framescript.js => testing/talos/talos/tests/tresize/addon/content/framescript.js
rename : testing/talos/talos/startup_test/tresize/addon/content/tresize.js => testing/talos/talos/tests/tresize/addon/content/tresize.js
rename : testing/talos/talos/startup_test/tresize/addon/install.rdf => testing/talos/talos/tests/tresize/addon/install.rdf
rename : testing/talos/talos/startup_test/tresize/addon/content/tresize-test.html => testing/talos/talos/tests/tresize/tresize-test.html
extra : rebase_source : a242750692e7449788cf58d620b24bffc53a32ff
This commit is contained in:
Andrew Swan 2018-10-04 17:41:04 -07:00
Родитель 9a1a60c7fb
Коммит 38a8594965
12 изменённых файлов: 59 добавлений и 94 удалений

Просмотреть файл

@ -11,7 +11,7 @@ with Files("**"):
with Files("talos/startup_test/sessionrestore/**"):
BUG_COMPONENT = ("Firefox", "Session Restore")
with Files("talos/startup_test/tresize/**"):
with Files("talos/tests/tresize/**"):
BUG_COMPONENT = ("Core", "XUL")
with Files("talos/tests/a11y/**"):

Просмотреть файл

@ -1,33 +0,0 @@
"use strict";
/* globals initializeBrowser */
// PLEASE NOTE:
//
// The canonical version of this file lives in testing/talos/talos, and
// is duplicated in a number of test add-ons in directories below it.
// Please do not update one withput updating all.
// Reads the chrome.manifest from a legacy non-restartless extension and loads
// its overlays into the appropriate top-level windows.
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
function readSync(uri) {
let channel = NetUtil.newChannel({uri, loadUsingSystemPrincipal: true});
let buffer = NetUtil.readInputStream(channel.open2());
return new TextDecoder().decode(buffer);
}
function startup(data, reason) {
Services.scriptloader.loadSubScript(data.resourceURI.resolve("content/initialize_browser.js"));
Services.obs.addObserver(function observer(window) {
Services.obs.removeObserver(observer, "browser-delayed-startup-finished");
initializeBrowser(window);
}, "browser-delayed-startup-finished");
}
function shutdown(data, reason) {}
function install(data, reason) {}
function uninstall(data, reason) {}

Просмотреть файл

@ -1,19 +0,0 @@
function initializeBrowser(win) {
Services.scriptloader.loadSubScript("chrome://tresize/content/Profiler.js", win);
Services.scriptloader.loadSubScript("chrome://tresize/content/tresize.js", win);
const TRESIZE_PREFIX = "tresize@mozilla.org:";
var groupMM = win.getGroupMessageManager("browsers");
groupMM.loadFrameScript("chrome://tresize/content/framescript.js", true);
// listener/executor on the chrome process for tresize.html
groupMM.addMessageListener(TRESIZE_PREFIX + "chrome-run-message", function listener(m) {
function sendResult(result) {
groupMM.broadcastAsyncMessage(TRESIZE_PREFIX + "chrome-run-reply", {
id: m.data.id,
result
});
}
win.runTest(sendResult, m.data.locationSearch);
});
}

Просмотреть файл

@ -215,22 +215,6 @@ class sessionrestore_many_windows(sessionrestore):
profile_path = '${talos}/startup_test/sessionrestore/profile-manywindows'
@register_test()
class tresize(TsBase):
"""
This test does some resize thing.
"""
extensions = ['${talos}/startup_test/tresize/addon']
cycles = 20
url = 'startup_test/tresize/addon/content/tresize-test.html'
timeout = 150
gecko_profile_interval = 2
gecko_profile_entries = 1000000
tpmozafterpaint = True
filters = filter.ignore_first.prepare(5) + filter.median.prepare()
unit = 'ms'
# pageloader tests(tp5, etc)
# The overall test number is determined by first calculating the median
@ -684,6 +668,22 @@ class dromaeo_dom(dromaeo):
unit = 'score'
@register_test()
class tresize(PageloaderTest):
"""
This test does some resize thing.
"""
tpmanifest = '${talos}/tests/tresize/tresize.manifest'
extensions = ['${talos}/pageloader', '${talos}/tests/tresize/addon']
tppagecycles = 20
timeout = 900
gecko_profile_interval = 2
gecko_profile_entries = 1000000
tpmozafterpaint = True
filters = filter.ignore_first.prepare(5) + filter.median.prepare()
unit = 'ms'
@register_test()
class tsvgm(PageloaderTest):
"""

26
testing/talos/talos/tests/tresize/addon/bootstrap.js поставляемый Normal file
Просмотреть файл

@ -0,0 +1,26 @@
"use strict";
ChromeUtils.import("resource://gre/modules/NetUtil.jsm");
ChromeUtils.import("resource://gre/modules/Services.jsm");
const PREFIX = "tresize@mozilla.org";
function listener({target, data}) {
let win = target.ownerGlobal;
Services.scriptloader.loadSubScript("chrome://tresize/content/Profiler.js", win);
Services.scriptloader.loadSubScript("chrome://tresize/content/tresize.js", win);
function sendResult(result) {
target.messageManager.sendAsyncMessage(`${PREFIX}:chrome-run-reply`, {id: data.id, result});
}
win.runTest(sendResult, data.locationSearch);
}
function startup(data, reason) {
Services.mm.addMessageListener(`${PREFIX}:chrome-run-message`, listener);
Services.mm.loadFrameScript("chrome://tresize/content/framescript.js", true);
}
function shutdown(data, reason) {}
function install(data, reason) {}
function uninstall(data, reason) {}

Просмотреть файл

@ -30,7 +30,7 @@ function resizeTest() {
Profiler.resume("resize " + count);
dataSet[count] = {"start": window.performance.now()};
window.resizeTo(windowSize, windowSize);
} catch (ex) { finish([ex + "\n"]); }
} catch (ex) { finish({error: ex.message}); }
}
function testCompleted() {
@ -44,16 +44,8 @@ function testCompleted() {
diffs.push(diff);
}
var average = (total / count);
var retVal = [];
if (dumpDataSet) {
retVal.push("__start_reporttresize-test.html," + diffs + "__end_report\n");
} else {
retVal.push("__start_report" + average + "__end_report\n");
}
// eslint-disable-next-line mozilla/avoid-Date-timing
retVal.push("__startTimestamp" + Date.now() + "__endTimestamp\n");
finish(retVal);
} catch (ex) { finish([ex + "\n"]); }
finish({diffs, average});
} catch (ex) { finish({error: ex.message}); }
}
function resizeCompleted() {

Просмотреть файл

@ -3,11 +3,10 @@
- You can obtain one at http://mozilla.org/MPL/2.0/. -->
<html>
<head>
<script language="Javascript" type="text/javascript" src="../../../../scripts/Profiler.js"></script>
<script language="Javascript" type="text/javascript" src="../../../../scripts/MozillaFileLogger.js"></script>
<script language="Javascript" type="text/javascript" src="../../../../talos-powers/content/TalosPowersContent.js"></script>
<script language="javascript" type="text/javascript">
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
function runTest() {
dispatchEvent(
new CustomEvent("tresize@mozilla.org:chrome-run-event",
@ -17,18 +16,17 @@ function runTest() {
}
function logResults(data) {
if (typeof dumpLog != "undefined") {
data.forEach(function(line) {
dumpLog(line);
});
window.setTimeout(async function() {
await TalosPowers.loadPromise;
TalosPowersContent.goQuitApplication();
}, 0);
let error = data.error;
if (data.average) {
if (window.tpRecordTime) {
window.tpRecordTime(data.average);
}
} else {
alert(data[0].split("__start_report")[1].split("__end_report")[0]);
error = "data.average and/or window.tpRecordTime is missing!";
}
if (error) {
dump(`TRESIZE ERROR: ${error}\n`);
}
}

Просмотреть файл

@ -0,0 +1 @@
% http://localhost/tests/tresize/tresize-test.html