summaryrefslogtreecommitdiffstats
path: root/toolkit/components/glean/tests/xpcshell/test_Glean.js
diff options
context:
space:
mode:
Diffstat (limited to 'toolkit/components/glean/tests/xpcshell/test_Glean.js')
-rw-r--r--toolkit/components/glean/tests/xpcshell/test_Glean.js76
1 files changed, 71 insertions, 5 deletions
diff --git a/toolkit/components/glean/tests/xpcshell/test_Glean.js b/toolkit/components/glean/tests/xpcshell/test_Glean.js
index 18b450a69b..f5661f91b6 100644
--- a/toolkit/components/glean/tests/xpcshell/test_Glean.js
+++ b/toolkit/components/glean/tests/xpcshell/test_Glean.js
@@ -514,7 +514,7 @@ add_task(async function test_fog_object_works() {
let expected = [
{ colour: "red", diameter: 5 },
{ colour: "blue", diameter: 7 },
- { colour: "orange", diameter: null },
+ { colour: "orange" },
];
Assert.deepEqual(expected, result);
@@ -528,10 +528,10 @@ add_task(async function test_fog_object_works() {
Glean.testOnly.balloons.set(balloons);
result = Glean.testOnly.balloons.testGetValue();
expected = [
- { colour: "inf", diameter: null },
- { colour: "negative-inf", diameter: null },
- { colour: "nan", diameter: null },
- { colour: "undef", diameter: null },
+ { colour: "inf" },
+ { colour: "negative-inf" },
+ { colour: "nan" },
+ { colour: "undef" },
];
Assert.deepEqual(expected, result);
@@ -562,3 +562,69 @@ add_task(async function test_fog_object_works() {
"Should throw because last object was invalid."
);
});
+
+add_task(async function test_fog_complex_object_works() {
+ if (!Glean.testOnly.crashStack) {
+ // FIXME(bug 1883857): object metric type not available, e.g. in artifact builds.
+ // Skipping this test.
+ return;
+ }
+
+ Assert.equal(
+ undefined,
+ Glean.testOnly.crashStack.testGetValue(),
+ "No object stored"
+ );
+
+ Glean.testOnly.crashStack.set({});
+ let result = Glean.testOnly.crashStack.testGetValue();
+ Assert.deepEqual({}, result);
+
+ let stack = {
+ status: "OK",
+ crash_info: {
+ typ: "main",
+ address: "0xf001ba11",
+ crashing_thread: 1,
+ },
+ main_module: 0,
+ modules: [
+ {
+ base_addr: "0x00000000",
+ end_addr: "0x00004000",
+ },
+ ],
+ };
+
+ Glean.testOnly.crashStack.set(stack);
+ result = Glean.testOnly.crashStack.testGetValue();
+ Assert.deepEqual(stack, result);
+
+ stack = {
+ status: "OK",
+ modules: [
+ {
+ base_addr: "0x00000000",
+ end_addr: "0x00004000",
+ },
+ ],
+ };
+ Glean.testOnly.crashStack.set(stack);
+ result = Glean.testOnly.crashStack.testGetValue();
+ Assert.deepEqual(stack, result);
+
+ stack = {
+ status: "OK",
+ modules: [],
+ };
+ Glean.testOnly.crashStack.set(stack);
+ result = Glean.testOnly.crashStack.testGetValue();
+ Assert.deepEqual({ status: "OK" }, result);
+
+ stack = {
+ status: "OK",
+ };
+ Glean.testOnly.crashStack.set(stack);
+ result = Glean.testOnly.crashStack.testGetValue();
+ Assert.deepEqual(stack, result);
+});