summaryrefslogtreecommitdiffstats
path: root/devtools/client/jsonview/test/browser_jsonview_save_json.js
diff options
context:
space:
mode:
Diffstat (limited to 'devtools/client/jsonview/test/browser_jsonview_save_json.js')
-rw-r--r--devtools/client/jsonview/test/browser_jsonview_save_json.js38
1 files changed, 38 insertions, 0 deletions
diff --git a/devtools/client/jsonview/test/browser_jsonview_save_json.js b/devtools/client/jsonview/test/browser_jsonview_save_json.js
new file mode 100644
index 000000000..4b95c563f
--- /dev/null
+++ b/devtools/client/jsonview/test/browser_jsonview_save_json.js
@@ -0,0 +1,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;
+});