diff --git a/testing/talos/talos/tests/devtools/addon/bootstrap.js b/testing/talos/talos/tests/devtools/addon/bootstrap.js index 7a6fa61c561f..f753c05b0e8b 100644 --- a/testing/talos/talos/tests/devtools/addon/bootstrap.js +++ b/testing/talos/talos/tests/devtools/addon/bootstrap.js @@ -11,7 +11,6 @@ // 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"); const windowTracker = { @@ -35,12 +34,6 @@ const windowTracker = { }, }; -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")); windowTracker.init(); diff --git a/testing/talos/talos/tests/devtools/addon/content/addon-test-frontend.js b/testing/talos/talos/tests/devtools/addon/content/addon-test-frontend.js index e00c562c4fc7..35452b13b747 100644 --- a/testing/talos/talos/tests/devtools/addon/content/addon-test-frontend.js +++ b/testing/talos/talos/tests/devtools/addon/content/addon-test-frontend.js @@ -1,12 +1,6 @@ // This file is the common bits for the test runner frontend, originally // extracted out of the tart.html frontend when creating the damp test. -/* globals updateConfig, defaultConfig, config */ /* from damp.html */ - -function $(id) { - return document.getElementById(id); -} - // Executes command at the chrome process. // Limited to one argument (data), which is enough for TART. // doneCallback will be called once done and, if applicable, with the result as argument. @@ -29,136 +23,12 @@ function chromeExec(commandName, data, doneCallback) { ); } -function toClipboard(text) { - chromeExec("toClipboard", text); -} - function runTest(config, doneCallback) { chromeExec("runTest", config, doneCallback); } -function sum(values) { - return values.reduce(function(a, b) { return a + b; }); -} - -function average(values) { - return values.length ? sum(values) / values.length : 999999999; -} - -function stddev(values, avg) { - if (undefined == avg) avg = average(values); - if (values.length <= 1) return 0; - - return Math.sqrt( - values.map(function(v) { return Math.pow(v - avg, 2); }) - .reduce(function(a, b) { return a + b; }) / (values.length - 1)); -} - -var lastResults = '["[no results collected]"]'; - -function doneTest(dispResult) { - $("hide-during-run").style.display = "block"; - $("show-during-run").style.display = "none"; - if (dispResult) { - // Array of test results, each element has .name and .value (test name and test result). - // Test result may also be an array of numeric values (all the intervals) - - lastResults = JSON.stringify(dispResult); // for "Copy to clipboard" button - - var stats = {}; // Used for average, stddev when repeat!=1 - var isRepeat = false; - - for (var i in dispResult) { - var di = dispResult[i]; - var disp = [].concat(di.value).map(function(a) { return " " + (isNaN(a) ? -1 : a.toFixed(1)); }).join("  "); - dispResult[i] = String(di.name) + ": " + disp; - if (di.name.includes(".half") || di.name.includes(".all")) - dispResult[i] = "" + dispResult[i] + ""; - if (di.name.includes(".raw")) - dispResult[i] = "
" + dispResult[i]; // Add space before raw results (which are the first result of an animation) - - // stats: - if (!di.name.includes(".raw")) { - if (!stats[di.name]) { - stats[di.name] = []; - } else { - isRepeat = true; - } - - stats[di.name].push(di.value); - } - } - - var dispStats = ""; - if (isRepeat) { - dispStats = "
Aggregated:
"; - for (var s in stats) { - if (s.includes(".half") ) - dispStats += "
"; - dispStats += s + "    Average (" + stats[s].length + "): " + average(stats[s]).toFixed(2) + " stddev: " + stddev(stats[s]).toFixed(2) + "
"; - } - - dispStats += "
Individual animations:
"; - } - - // eslint-disable-next-line no-unsanitized/property - $("run-results").innerHTML = "

Results :
" + dispStats + dispResult.join("
"); - } -} - -function triggerStart() { - updateConfig(); - $("hide-during-run").style.display = "none"; - $("show-during-run").style.display = "block"; - $("run-results").innerHTML = ""; - - runTest(config, doneTest); -} - -function deselectAll() { - for (var test of defaultConfig.subtests) { - $("subtest-" + test.name).checked = false; - } -} - -// E.g. returns "world" for key "hello", "2014" for key "year", and "" for key "dummy": -// http://localhost/x.html#hello=world&x=12&year=2014 -function getUriHashValue(key) { - var k = String(key) + "="; - var uriVars = unescape(document.location.hash).substr(1).split("&"); - for (var i in uriVars) { - if (uriVars[i].indexOf(k) == 0) - return uriVars[i].substr(k.length); - } - return ""; -} - -// URL e.g. chrome://devtools/content/devtools.html#auto&tests=["simple","iconFadeDpiCurrent"] -// Note - there's no error checking for arguments parsing errors. -// Any errors will express as either javascript errors or not reading the args correctly. -// This is not an "official" part of the UI, and when used in talos, will fail early -// enough to not cause "weird" issues too late. -function updateOptionsFromUrl() { - var uriTests = getUriHashValue("tests"); - var tests = uriTests ? JSON.parse(uriTests) : []; - - if (tests.length) { - for (var test of defaultConfig.subtests) { - $("subtest-" + test.name).checked = false; - for (var t in tests) { - if (tests[t] == test.name) { - $("subtest-" + test.name).checked = true; - } - } - } - } -} - function init() { - updateOptionsFromUrl(); - if (document.location.hash.indexOf("#auto") == 0) { - triggerStart(); - } + runTest(); } addEventListener("load", init); diff --git a/testing/talos/talos/tests/devtools/addon/content/damp-tests.js b/testing/talos/talos/tests/devtools/addon/content/damp-tests.js index e8eddfd1dc70..d747605ad88a 100644 --- a/testing/talos/talos/tests/devtools/addon/content/damp-tests.js +++ b/testing/talos/talos/tests/devtools/addon/content/damp-tests.js @@ -4,6 +4,8 @@ "use strict"; +/* globals module */ + /** * This is the registry for all DAMP tests. Tests will be run in the order specified by * the DAMP_TESTS array. @@ -17,7 +19,7 @@ * - {Boolean} cold: set to true to run the test only during the first run of the browser */ -window.DAMP_TESTS = [ +module.exports = [ { name: "inspector.cold-open", path: "inspector/cold-open.js", diff --git a/testing/talos/talos/tests/devtools/addon/content/damp.html b/testing/talos/talos/tests/devtools/addon/content/damp.html index 00b83f6461f9..817f5f3a6048 100644 --- a/testing/talos/talos/tests/devtools/addon/content/damp.html +++ b/testing/talos/talos/tests/devtools/addon/content/damp.html @@ -1,68 +1,11 @@ - -DAMP - Devtools At Maximum Performance + + DAMP - Devtools At Maximum Performance - - - + -

DAMP - Devtools At Maximum Performance

-
- Visit talos/TART for detailed info.
- - -Utilities: - simple page    - complicated page    -

-Configure DAMP (CTRL-F5 to reset to talos defaults)
- -
- Repeat: times
- Delay before starting a measured animation: ms
- -     -
-
- +

DAMP - Devtools At Maximum Performance

diff --git a/testing/talos/talos/tests/devtools/addon/content/damp.js b/testing/talos/talos/tests/devtools/addon/content/damp.js index 103ecd8c8edb..50bb3b35a1a9 100644 --- a/testing/talos/talos/tests/devtools/addon/content/damp.js +++ b/testing/talos/talos/tests/devtools/addon/content/damp.js @@ -199,7 +199,7 @@ Damp.prototype = { async testSetup(url) { let tab = await this.addTab(url); await new Promise(resolve => { - setTimeout(resolve, this._config.rest); + setTimeout(resolve, 100); }); return tab; }, @@ -219,7 +219,6 @@ Damp.prototype = { _win: undefined, _dampTab: undefined, _results: [], - _config: {subtests: [], repeat: 1, rest: 100}, _nextTestIndex: 0, _tests: [], _onSequenceComplete: 0, @@ -397,7 +396,7 @@ Damp.prototype = { await this.garbageCollect(); }, - startTest(doneCallback, config) { + startTest(doneCallback) { try { dump("Initialize the head file with a reference to this DAMP instance\n"); let head = require("chrome://damp/content/tests/head.js"); @@ -407,7 +406,6 @@ Damp.prototype = { TalosParentProfiler.pause("DAMP - end"); doneCallback(results); }; - this._config = config; this._win = Services.wm.getMostRecentWindow("navigator:browser"); this._dampTab = this._win.gBrowser.selectedTab; @@ -418,8 +416,9 @@ Damp.prototype = { // Filter tests via `./mach --subtests filter` command line argument let filter = Services.prefs.getCharPref("talos.subtests", ""); - let tests = config.subtests.filter(test => !test.disabled) - .filter(test => test.name.includes(filter)); + let DAMP_TESTS = require("chrome://damp/content/damp-tests.js"); + let tests = DAMP_TESTS.filter(test => !test.disabled) + .filter(test => test.name.includes(filter)); if (tests.length === 0) { this.error(`Unable to find any test matching '${filter}'`); @@ -436,9 +435,7 @@ Damp.prototype = { // Construct the sequence array while filtering tests let sequenceArray = []; for (let test of tests) { - for (let r = 0; r < config.repeat; r++) { - sequenceArray.push(test.path); - } + sequenceArray.push(test.path); } this.waitBeforeRunningTests().then(() => { diff --git a/testing/talos/talos/tests/devtools/addon/content/initialize_browser.js b/testing/talos/talos/tests/devtools/addon/content/initialize_browser.js index 9bc28eedc7ba..5cc899e5a7f6 100644 --- a/testing/talos/talos/tests/devtools/addon/content/initialize_browser.js +++ b/testing/talos/talos/tests/devtools/addon/content/initialize_browser.js @@ -9,12 +9,6 @@ function initializeBrowser(win) { runTest(config, callback) { (new win.Damp()).startTest(callback, config); }, - - toClipboard(text) { - const gClipboardHelper = Cc["@mozilla.org/widget/clipboardhelper;1"] - .getService(Ci.nsIClipboardHelper); - gClipboardHelper.copyString(text); - } }; var groupMM = win.getGroupMessageManager("browsers");