diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-06-12 05:43:14 +0000 |
commit | 8dd16259287f58f9273002717ec4d27e97127719 (patch) | |
tree | 3863e62a53829a84037444beab3abd4ed9dfc7d0 /toolkit/components/glean/tests/xpcshell/test_Glean.js | |
parent | Releasing progress-linux version 126.0.1-1~progress7.99u1. (diff) | |
download | firefox-8dd16259287f58f9273002717ec4d27e97127719.tar.xz firefox-8dd16259287f58f9273002717ec4d27e97127719.zip |
Merging upstream version 127.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'toolkit/components/glean/tests/xpcshell/test_Glean.js')
-rw-r--r-- | toolkit/components/glean/tests/xpcshell/test_Glean.js | 76 |
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); +}); |