From 5f8de423f190bbb79a62f804151bc24824fa32d8 Mon Sep 17 00:00:00 2001 From: "Matt A. Tobin" Date: Fri, 2 Feb 2018 04:16:08 -0500 Subject: Add m-esr52 at 52.6.0 --- devtools/shared/platform/content/test/.eslintrc.js | 6 +++ .../shared/platform/content/test/mochitest.ini | 5 ++ .../platform/content/test/test_clipboard.html | 53 ++++++++++++++++++++++ .../shared/platform/content/test/test_stack.js | 48 ++++++++++++++++++++ devtools/shared/platform/content/test/xpcshell.ini | 7 +++ 5 files changed, 119 insertions(+) create mode 100644 devtools/shared/platform/content/test/.eslintrc.js create mode 100644 devtools/shared/platform/content/test/mochitest.ini create mode 100644 devtools/shared/platform/content/test/test_clipboard.html create mode 100644 devtools/shared/platform/content/test/test_stack.js create mode 100644 devtools/shared/platform/content/test/xpcshell.ini (limited to 'devtools/shared/platform/content/test') diff --git a/devtools/shared/platform/content/test/.eslintrc.js b/devtools/shared/platform/content/test/.eslintrc.js new file mode 100644 index 000000000..59adf410a --- /dev/null +++ b/devtools/shared/platform/content/test/.eslintrc.js @@ -0,0 +1,6 @@ +"use strict"; + +module.exports = { + // Extend from the common devtools xpcshell eslintrc config. + "extends": "../../../../.eslintrc.xpcshell.js" +}; diff --git a/devtools/shared/platform/content/test/mochitest.ini b/devtools/shared/platform/content/test/mochitest.ini new file mode 100644 index 000000000..f62cada6b --- /dev/null +++ b/devtools/shared/platform/content/test/mochitest.ini @@ -0,0 +1,5 @@ +[DEFAULT] +support-files = + +[test_clipboard.html] +subsuite = clipboard diff --git a/devtools/shared/platform/content/test/test_clipboard.html b/devtools/shared/platform/content/test/test_clipboard.html new file mode 100644 index 000000000..ccf5e6ccf --- /dev/null +++ b/devtools/shared/platform/content/test/test_clipboard.html @@ -0,0 +1,53 @@ + + + + + Test for Bug 1290230 - clipboard helpers + + + + + + + + + + + + +
Type Here
+ diff --git a/devtools/shared/platform/content/test/test_stack.js b/devtools/shared/platform/content/test/test_stack.js new file mode 100644 index 000000000..4dbb66541 --- /dev/null +++ b/devtools/shared/platform/content/test/test_stack.js @@ -0,0 +1,48 @@ +/* Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ */ + +// There isn't really very much about the content stack.js that we can +// test, but we'll do what we can. + +"use strict"; + +var Cu = Components.utils; +const {require} = Cu.import("resource://devtools/shared/Loader.jsm", {}); + +// Make sure to explicitly require the content version of this module. +// We have to use the ".." trick due to the way the loader remaps +// devtools/shared/platform. +const { + callFunctionWithAsyncStack, + getStack, + describeNthCaller +} = require("devtools/shared/platform/../content/stack"); + +function f3() { + return describeNthCaller(2); +} + +function f2() { + return f3(); +} + +function f1() { + return f2(); +} + +function run_test() { + let value = 7; + + const changeValue = () => { + value = 9; + }; + + callFunctionWithAsyncStack(changeValue, getStack(), "test_stack"); + equal(value, 9, "callFunctionWithAsyncStack worked"); + + let stack = getStack(); + equal(JSON.parse(JSON.stringify(stack)), stack, "stack is serializable"); + + let desc = f1(); + ok(desc.includes("f1"), "stack description includes f1"); +} diff --git a/devtools/shared/platform/content/test/xpcshell.ini b/devtools/shared/platform/content/test/xpcshell.ini new file mode 100644 index 000000000..fa475165a --- /dev/null +++ b/devtools/shared/platform/content/test/xpcshell.ini @@ -0,0 +1,7 @@ +[DEFAULT] +tags = devtools +head = +tail = +firefox-appdir = browser + +[test_stack.js] -- cgit v1.2.3