tor-browser

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

hooks.py (1113B)


      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 import os
      5 
      6 from mozperftest.test.browsertime import add_option, add_options
      7 
      8 sites = os.path.join(os.path.dirname(__file__), "sites.txt")
      9 with open(sites) as f:
     10    sites = [site for site in f.read().split("\n") if site.strip()]
     11 
     12 
     13 def next_site():
     14    yield from sites
     15 
     16 
     17 get_site = next_site()
     18 
     19 options = [
     20    ("firefox.preference", "network.http.speculative-parallel-limit:6"),
     21    # XXX potentially move those as first class options in mozperf?
     22    ("pageCompleteWaitTime", "10000"),
     23    ("visualMetrics", "true"),
     24    ("video", "true"),
     25    ("firefox.windowRecorder", "false"),
     26    ("videoParams.addTimer", "false"),
     27    ("videoParams.createFilmstrip", "false"),
     28    ("videoParams.keepOriginalVideo", "true"),
     29 ]
     30 
     31 
     32 def before_runs(env, **kw):
     33    env.set_arg("cycles", len(sites))
     34    add_options(env, options)
     35 
     36 
     37 def before_cycle(env, **kw):
     38    url = next(get_site)
     39    add_option(env, "browsertime.url", url)