Commit b6743027 authored by Luca Greco's avatar Luca Greco
Browse files

Bug 1886252 - Refresh amosigned.xpi and applied tweak AOM mochitest-browser...

Bug 1886252 - Refresh amosigned.xpi and applied tweak AOM mochitest-browser tests for the new xpi file. r=willdurand

Depends on D205768

Differential Revision: https://phabricator.services.mozilla.com/D205769
parent 2f7a0599
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -66,7 +66,7 @@ AddonTestUtils.registerJSON(server, "/updates-now-compatible.json", {

add_task(async function test_local_install_blocklisted() {
  let id = "amosigned-xpi@tests.mozilla.org";
  let version = "2.1";
  let version = "2.2";

  await AddonTestUtils.loadBlocklistRawData({
    extensionsMLBF: [
+21 −11
Original line number Diff line number Diff line
@@ -17,12 +17,11 @@ const TESTPAGE = `${SECURE_TESTROOT}${TESTPATH}`;
const XPI_URL = `${SECURE_TESTROOT}../xpinstall/amosigned.xpi`;
const XPI_ADDON_ID = "amosigned-xpi@tests.mozilla.org";

const XPI_SHA =
  "sha256:91121ed2c27f670f2307b9aebdd30979f147318c7fb9111c254c14ddbb84e4b0";

const ID = "amosigned-xpi@tests.mozilla.org";
// eh, would be good to just stat the real file instead of this...
const XPI_LEN = 4287;
// Actual XPI file size and hash are computed in the add_setup callback.
let XPI_LEN = -1;
let XPI_SHA =
  "sha256:0000000000000000000000000000000000000000000000000000000000000000";

AddonTestUtils.initMochitest(this);

@@ -50,6 +49,17 @@ add_setup(async function () {
    ],
  });
  info("added preferences");

  // Get the file size (used in this test file to assert the
  // expected maxProgress value set in the addon download
  // dialog).
  const xpiFilePath = getTestFilePath("../xpinstall/amosigned.xpi");
  const xpiStat = await IOUtils.stat(xpiFilePath);
  XPI_LEN = xpiStat.size;

  // Compute the file hash.
  const xpiFileHash = await IOUtils.computeHexDigest(xpiFilePath, "sha256");
  XPI_SHA = `sha256:${xpiFileHash}`;
});

// Wrapper around a common task to run in the content process to test
@@ -165,7 +175,7 @@ async function testInstall(browser, args, steps, description) {
              }
            } catch (err) {
              if (!nextStep.expectError) {
                throw new Error("Install failed unexpectedly");
                throw new Error("Install failed unexpectedly: " + err);
              }
            }
          } else if (nextStep.action == "cancel") {
@@ -287,12 +297,12 @@ add_task(
    "install with empty string for hash works"
  )
);
add_task(
  makeRegularTest(
add_task(async function test_install_successfully_with_filehash() {
  await makeRegularTest(
    { url: XPI_URL, addonId, hash: XPI_SHA },
    "install with hash works"
  )
  );
});

add_task(
  makeInstallTest(async function (browser) {
@@ -531,7 +541,7 @@ add_task(
add_task(
  makeInstallTest(async function (browser) {
    let id = "amosigned-xpi@tests.mozilla.org";
    let version = "2.1";
    let version = "2.2";

    await AddonTestUtils.loadBlocklistRawData({
      extensionsMLBF: [