summaryrefslogtreecommitdiffstats
path: root/uriloader/exthandler/tests/mochitest/browser_download_always_ask_preferred_app.js
blob: 40f7ef71e2f57241f38f2c8f153be433efd6a6f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
add_task(function*() {
  // Create mocked objects for test
  let launcher = createMockedObjects(false);
  // Open helper app dialog with mocked launcher
  let dlg = yield* 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.");
    yield 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.documentElement.cancelDialog();
  yield helperAppDialogHiddenPromise;
});