summaryrefslogtreecommitdiffstats
path: root/devtools/server/tests/xpcshell/test_symbolactor.js
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /devtools/server/tests/xpcshell/test_symbolactor.js
parentInitial commit. (diff)
downloadfirefox-esr-upstream.tar.xz
firefox-esr-upstream.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/server/tests/xpcshell/test_symbolactor.js')
-rw-r--r--devtools/server/tests/xpcshell/test_symbolactor.js53
1 files changed, 53 insertions, 0 deletions
diff --git a/devtools/server/tests/xpcshell/test_symbolactor.js b/devtools/server/tests/xpcshell/test_symbolactor.js
new file mode 100644
index 0000000000..0d04a2bd1d
--- /dev/null
+++ b/devtools/server/tests/xpcshell/test_symbolactor.js
@@ -0,0 +1,53 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+"use strict";
+
+const {
+ SymbolActor,
+} = require("resource://devtools/server/actors/object/symbol.js");
+
+function run_test() {
+ test_SA_destroy();
+ test_SA_form();
+ test_SA_raw();
+}
+
+const SYMBOL_NAME = "abc";
+const TEST_SYMBOL = Symbol(SYMBOL_NAME);
+
+function makeMockSymbolActor() {
+ const symbol = TEST_SYMBOL;
+ const mockConn = null;
+ const actor = new SymbolActor(mockConn, symbol);
+ actor.actorID = "symbol1";
+ const parentPool = {
+ symbolActors: {
+ [symbol]: actor,
+ },
+ unmanage: () => {},
+ };
+ actor.getParent = () => parentPool;
+ return actor;
+}
+
+function test_SA_destroy() {
+ const actor = makeMockSymbolActor();
+ strictEqual(actor.getParent().symbolActors[TEST_SYMBOL], actor);
+
+ actor.destroy();
+ strictEqual(TEST_SYMBOL in actor.getParent().symbolActors, false);
+}
+
+function test_SA_form() {
+ const actor = makeMockSymbolActor();
+ const form = actor.form();
+ strictEqual(form.type, "symbol");
+ strictEqual(form.actor, actor.actorID);
+ strictEqual(form.name, SYMBOL_NAME);
+}
+
+function test_SA_raw() {
+ const actor = makeMockSymbolActor();
+ strictEqual(actor.rawValue(), TEST_SYMBOL);
+}