browser_jsonview_save_json.js 897 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. /* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
  2. /* Any copyright is dedicated to the Public Domain.
  3. * http://creativecommons.org/publicdomain/zero/1.0/ */
  4. "use strict";
  5. const TEST_JSON_URL = URL_ROOT + "valid_json.json";
  6. let { MockFilePicker } = SpecialPowers;
  7. MockFilePicker.init(window);
  8. MockFilePicker.returnValue = MockFilePicker.returnCancel;
  9. registerCleanupFunction(function () {
  10. MockFilePicker.cleanup();
  11. });
  12. add_task(function* () {
  13. info("Test save JSON started");
  14. yield addJsonViewTab(TEST_JSON_URL);
  15. let promise = new Promise((resolve) => {
  16. MockFilePicker.showCallback = () => {
  17. MockFilePicker.showCallback = null;
  18. ok(true, "File picker was opened");
  19. resolve();
  20. };
  21. });
  22. let browser = gBrowser.selectedBrowser;
  23. yield BrowserTestUtils.synthesizeMouseAtCenter(
  24. ".jsonPanelBox button.save",
  25. {}, browser);
  26. yield promise;
  27. });