Bug 1940064: Move GleanTest.js to SimpleTest dir. r=chutten,frontend-codestyle-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D233255
This commit is contained in:
Fatih Kilic
2025-01-08 20:02:24 +00:00
parent a8b98e5d03
commit 5209cca4e4
24 changed files with 113 additions and 131 deletions

View File

@@ -1,53 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
"use strict";
// Took from dom/notification/test/mochitest/GleanTest.js, modified a bit because we don't use cateogry label
// Bug 1799977: Using workaround to test telemetry in plain mochitests
const GleanTest = new Proxy(
{
async testResetFOG() {
return SpecialPowers.spawnChrome([], async () => {
await Services.fog.testFlushAllChildren();
Services.fog.testResetFOG();
});
},
async flush() {
return SpecialPowers.spawnChrome([], async () => {
await Services.fog.testFlushAllChildren();
});
},
},
{
get(gleanTestObj, catProp) {
if (catProp in gleanTestObj) {
return gleanTestObj[catProp];
}
return new Proxy(
{},
{
get(categoryObj, metProp) {
return {
async testGetValue() {
return SpecialPowers.spawnChrome(
[catProp, metProp],
async (categoryName, metricName) => {
await Services.fog.testFlushAllChildren();
const window = this.browsingContext.topChromeWindow;
return window.Glean[categoryName][
metricName
].testGetValue();
}
);
},
};
},
}
);
},
}
);

View File

@@ -4,7 +4,6 @@ prefs = [
]
scheme="https"
support-files = [
"GleanTest.js",
"CaptchaTestingUtils.js"
]

View File

@@ -5,7 +5,7 @@
<title>ArkoseLabs Puzzle Completion Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>

View File

@@ -5,7 +5,7 @@
<title>AWS WAF Puzzle Completion Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>

View File

@@ -5,7 +5,7 @@
<title>Cloudflare Turnstile Completion Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>

View File

@@ -5,7 +5,7 @@
<title>Cloudflare Turnstile Completion Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>

View File

@@ -5,7 +5,7 @@
<title>Datadome Puzzle Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>

View File

@@ -5,7 +5,7 @@
<title>Google ReCaptcha V2 Auto Completion Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>

View File

@@ -5,7 +5,7 @@
<title>Google ReCaptcha V2 Manual/Puzzle Completion Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>

View File

@@ -5,7 +5,7 @@
<title>hCaptcha Auto Completion Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>

View File

@@ -5,7 +5,7 @@
<title>hCaptcha Manual/Puzzle Completion Detection Test</title>
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" href="/tests/SimpleTest/test.css" />
<script src="GleanTest.js"></script>
<script src="/tests/SimpleTest/GleanTest.js"></script>
<script src="CaptchaTestingUtils.js"></script>
</head>
<body>