tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

perftest_perfstats.js (1814B)


      1 /* This Source Code Form is subject to the terms of the Mozilla Public
      2 * License, v. 2.0. If a copy of the MPL was not distributed with this
      3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
      4 
      5 const urls = [
      6  "https://accounts.google.com",
      7  "https://cnn.com/ampstories/us/why-hurricane-michael-is-a-monster-unlike-any-other",
      8  "https://stackoverflow.com/questions/927358/how-do-i-undo-the-most-recent-commits-in-git",
      9  "https://expedia.com/Hotel-Search?destination=New+York%2C+New+York&latLong=40.756680%2C-73.986470&regionId=178293&startDate=&endDate=&rooms=1&_xpid=11905%7C1&adults=2",
     10  "https://m.imdb.com/title/tt0083943/",
     11 ];
     12 
     13 const idle_delay = 10000;
     14 
     15 async function test(context, commands) {
     16  await commands.wait.byTime(idle_delay);
     17 
     18  await commands.measure.start();
     19 
     20  // Cold
     21  for (const url of urls) {
     22    await commands.navigate(url);
     23    await commands.wait.byTime(idle_delay);
     24  }
     25 
     26  await commands.navigate("about:blank");
     27  await commands.wait.byTime(idle_delay);
     28 
     29  // Warm
     30  for (const url of urls) {
     31    await commands.navigate(url);
     32    await commands.wait.byTime(idle_delay);
     33  }
     34 
     35  return commands.measure.stop();
     36 }
     37 
     38 module.exports = {
     39  test,
     40  owner: "Performance Team",
     41  name: "perfstats",
     42  description: "Collect perfstats for the given site",
     43  longDescription: `
     44  This test launches browsertime with the perfStats option (will collect low-overhead timings, see Bug 1553254).
     45  The test currently runs a short user journey. A selection of popular sites are visited, first as cold pageloads, and then as warm.
     46  `,
     47  usage: `
     48  ./mach perftest --hook testing/performance/hooks_perfstats.py \
     49  testing/performance/perftest_perfstats.js --browsertime-iterations 10 \
     50  --perfherder-metrics name:HttpChannelCompletion_Cache name:HttpChannelCompletion_Network
     51  `,
     52 };