summaryrefslogtreecommitdiffstats
path: root/devtools/client/jsonview/test/browser_jsonview_save_json.js
blob: 4b95c563f9ddbf04e1d319aeb45c02db12369da5 (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
26
27
28
29
30
31
32
33
34
35
36
37
38
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set ts=2 et sw=2 tw=80: */
/* Any copyright is dedicated to the Public Domain.
 * http://creativecommons.org/publicdomain/zero/1.0/ */

"use strict";

const TEST_JSON_URL = URL_ROOT + "valid_json.json";

let { MockFilePicker } = SpecialPowers;

MockFilePicker.init(window);
MockFilePicker.returnValue = MockFilePicker.returnCancel;

registerCleanupFunction(function () {
  MockFilePicker.cleanup();
});

add_task(function* () {
  info("Test save JSON started");

  yield addJsonViewTab(TEST_JSON_URL);

  let promise = new Promise((resolve) => {
    MockFilePicker.showCallback = () => {
      MockFilePicker.showCallback = null;
      ok(true, "File picker was opened");
      resolve();
    };
  });

  let browser = gBrowser.selectedBrowser;
  yield BrowserTestUtils.synthesizeMouseAtCenter(
    ".jsonPanelBox button.save",
    {}, browser);

  yield promise;
});