fune/toolkit/components/resistfingerprinting/tests/browser/browser_usercharacteristics.js
Sandor Molnar cc6a87da40 Backed out 7 changesets (bug 1894958) for causing bc failures @ browser_usercharacteristics.js CLOSED TREE
Backed out changeset f0b3873afbbf (bug 1894958)
Backed out changeset 0163ab00de90 (bug 1894958)
Backed out changeset dc5209d0115f (bug 1894958)
Backed out changeset c7c58e406791 (bug 1894958)
Backed out changeset 1ff86ac5480e (bug 1894958)
Backed out changeset 862f163cf35c (bug 1894958)
Backed out changeset 4ad50fcd042b (bug 1894958)
2024-06-05 00:07:37 +03:00

51 lines
1.3 KiB
JavaScript

/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
const emptyPage =
getRootDirectory(gTestPath).replace(
"chrome://mochitests/content",
"https://example.com"
) + "empty.html";
function promiseObserverNotification() {
return TestUtils.topicObserved(
"user-characteristics-populating-data-done",
_ => {
var submitted = false;
GleanPings.userCharacteristics.testBeforeNextSubmit(_ => {
submitted = true;
// Did we assign a value we got out of about:fingerprinting?
// For now, we are sticking the test value in a random telemetry
// metric, but once we have a real metric, we'll update this
Assert.equal(
"Hello World",
Glean.characteristics.timezone.testGetValue()
);
});
GleanPings.userCharacteristics.submit();
return submitted;
}
);
}
add_task(async function run_test() {
info("Starting test...");
await BrowserTestUtils.withNewTab(
{ gBrowser, url: emptyPage },
async function tabTask(_) {
let promise = promiseObserverNotification();
Services.obs.notifyObservers(
null,
"user-characteristics-testing-please-populate-data"
);
let submitted = await promise;
Assert.ok(submitted);
}
);
});