tor-browser

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

browser_updateRestart.js (1394B)


      1 /* Any copyright is dedicated to the Public Domain.
      2 * http://creativecommons.org/publicdomain/zero/1.0/ */
      3 
      4 // Checks the UPDATE_RESTART tip.
      5 //
      6 // The update parts of this test are adapted from:
      7 // https://searchfox.org/mozilla-central/source/toolkit/mozapps/update/tests/browser/browser_aboutDialog_bc_downloaded_staged.js
      8 
      9 "use strict";
     10 
     11 let params = {
     12  queryString: "&invalidCompleteSize=1",
     13  backgroundUpdate: true,
     14  continueFile: CONTINUE_STAGING,
     15  waitForUpdateState: STATE_APPLIED,
     16 };
     17 
     18 let preSteps = [
     19  {
     20    panelId: "apply",
     21    checkActiveUpdate: { state: STATE_APPLIED },
     22    continueFile: null,
     23  },
     24 ];
     25 
     26 add_task(async function test() {
     27  // Enable the pref that automatically downloads and installs updates.
     28  await SpecialPowers.pushPrefEnv({
     29    set: [
     30      [PREF_APP_UPDATE_STAGING_ENABLED, true],
     31      ["browser.urlbar.suggest.quickactions", false],
     32    ],
     33  });
     34 
     35  // Set up the "apply" update state.
     36  await initUpdate(params);
     37  UrlbarProviderInterventions.checkForBrowserUpdate(true);
     38  await processUpdateSteps(preSteps);
     39 
     40  // Picking the tip should attempt to restart the browser.
     41  await doUpdateTest({
     42    searchString: SEARCH_STRINGS.UPDATE,
     43    tip: UrlbarProviderInterventions.TIP_TYPE.UPDATE_RESTART,
     44    title: /^The latest .+ is downloaded and ready to install\.$/,
     45    button: "Restart to Update",
     46    awaitCallback: awaitAppRestartRequest,
     47  });
     48 });