From 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Fri, 19 Apr 2024 03:47:29 +0200 Subject: Adding upstream version 115.8.0esr. Signed-off-by: Daniel Baumann --- mobile/android/actors/tests/mochitests/head.js | 51 ++++++++++ .../android/actors/tests/mochitests/mochitest.ini | 8 ++ .../mochitests/test_geckoview_actor_telemetry.html | 106 +++++++++++++++++++++ 3 files changed, 165 insertions(+) create mode 100644 mobile/android/actors/tests/mochitests/head.js create mode 100644 mobile/android/actors/tests/mochitests/mochitest.ini create mode 100644 mobile/android/actors/tests/mochitests/test_geckoview_actor_telemetry.html (limited to 'mobile/android/actors/tests') diff --git a/mobile/android/actors/tests/mochitests/head.js b/mobile/android/actors/tests/mochitests/head.js new file mode 100644 index 0000000000..01288ca822 --- /dev/null +++ b/mobile/android/actors/tests/mochitests/head.js @@ -0,0 +1,51 @@ +/* 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"; + +// Bug 1799977: Using workaround to test telemtry in plain mochitests +const GleanTest = new Proxy( + {}, + { + get(target, categoryName, receiver) { + return new Proxy( + {}, + { + // eslint-disable-next-line no-shadow + get(target, metricName, receiver) { + return { + // The only API we actually implement right now. + async testGetValue() { + return SpecialPowers.spawnChrome( + [categoryName, metricName], + // eslint-disable-next-line no-shadow + async (categoryName, metricName) => { + await Services.fog.testFlushAllChildren(); + const window = this.browsingContext.topChromeWindow; + return window.Glean[categoryName][ + metricName + ].testGetValue(); + } + ); + }, + async testGetValueLabel(label) { + return SpecialPowers.spawnChrome( + [categoryName, metricName, label], + // eslint-disable-next-line no-shadow + async (categoryName, metricName, label) => { + await Services.fog.testFlushAllChildren(); + const window = this.browsingContext.topChromeWindow; + return window.Glean[categoryName][metricName][ + label + ].testGetValue(); + } + ); + }, + }; + }, + } + ); + }, + } +); diff --git a/mobile/android/actors/tests/mochitests/mochitest.ini b/mobile/android/actors/tests/mochitests/mochitest.ini new file mode 100644 index 0000000000..31fe69cb03 --- /dev/null +++ b/mobile/android/actors/tests/mochitests/mochitest.ini @@ -0,0 +1,8 @@ +[DEFAULT] +support-files = + head.js +prefs = + dom.enable_window_print=true +skip-if = + os != 'android' +[test_geckoview_actor_telemetry.html] \ No newline at end of file diff --git a/mobile/android/actors/tests/mochitests/test_geckoview_actor_telemetry.html b/mobile/android/actors/tests/mochitests/test_geckoview_actor_telemetry.html new file mode 100644 index 0000000000..fa4e27b37a --- /dev/null +++ b/mobile/android/actors/tests/mochitests/test_geckoview_actor_telemetry.html @@ -0,0 +1,106 @@ + + + + + + Tests for Telemetry in GeckoView Actors + + + + + +Mozilla Bug 1816151 for Window.Print() Telemetry + + + -- cgit v1.2.3