summaryrefslogtreecommitdiffstats
path: root/uriloader/exthandler/tests/mochitest/browser_download_always_ask_preferred_app.js
blob: b4bfe5e51a638ef94ae4aed4f4d5d7dd1e3d7b40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
add_task(async function () {
  // Create mocked objects for test
  let launcher = createMockedObjects(false);
  // Open helper app dialog with mocked launcher
  let dlg = await openHelperAppDialog(launcher);
  let doc = dlg.document;
  let location = doc.getElementById("source");
  let expectedValue = launcher.source.prePath;
  if (location.value != expectedValue) {
    info("Waiting for dialog to be populated.");
    await BrowserTestUtils.waitForAttribute("value", location, expectedValue);
  }
  is(
    doc.getElementById("mode").selectedItem.id,
    "open",
    "Should be opening the file."
  );
  ok(
    !dlg.document.getElementById("openHandler").selectedItem.hidden,
    "Should not have selected a hidden item."
  );
  let helperAppDialogHiddenPromise = BrowserTestUtils.windowClosed(dlg);
  doc.getElementById("unknownContentType").cancelDialog();
  await helperAppDialogHiddenPromise;
});