[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [tor-browser] 09/179: Bug 1771130 - Sync check that telemetry has been cleared to avoid intermittent waitForCondition timeouts. r=timhuang, a=test-only



This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-102.2.0esr-12.0-1
in repository tor-browser.

commit a57851d90431fd38d0dfb1339007061a4d4b87f2
Author: Paul Zuehlcke <pbz@xxxxxxxxxxx>
AuthorDate: Mon Jun 13 19:03:30 2022 +0000

    Bug 1771130 - Sync check that telemetry has been cleared to avoid intermittent waitForCondition timeouts. r=timhuang, a=test-only
    
    Differential Revision: https://phabricator.services.mozilla.com/D148663
---
 toolkit/components/antitracking/test/browser/browser.ini   |  4 ----
 .../browser/browser_urlQueryStringStripping_telemetry.js   | 14 +++++++++++---
 .../browser/browser_urlQueryStringStripping_telemetry_2.js | 14 +++++++++++---
 3 files changed, 22 insertions(+), 10 deletions(-)

diff --git a/toolkit/components/antitracking/test/browser/browser.ini b/toolkit/components/antitracking/test/browser/browser.ini
index 38679167eca61..1159b8408b4a7 100644
--- a/toolkit/components/antitracking/test/browser/browser.ini
+++ b/toolkit/components/antitracking/test/browser/browser.ini
@@ -141,12 +141,8 @@ tags = remote-settings
 support-files = file_stripping.html
 [browser_urlQueryStringStripping_telemetry.js]
 support-files = file_stripping.html
-skip-if =
-  os == 'mac' && fission # Bug 1716438
 [browser_urlQueryStringStripping_telemetry_2.js]
 support-files = file_stripping.html
-skip-if =
-  os == 'mac' && fission # Bug 1716438
 [browser_urlQueryStringStripping.js]
 skip-if =
   fission && os == "linux" && asan  # Bug 1713909 - new Fission platform triage
diff --git a/toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_telemetry.js b/toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_telemetry.js
index ee32ba267a2ce..9e2f678020004 100644
--- a/toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_telemetry.js
+++ b/toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_telemetry.js
@@ -33,8 +33,7 @@ async function clearTelemetry() {
   Services.telemetry.getHistogramById(QUERY_STRIPPING_COUNT).clear();
   Services.telemetry.getHistogramById(QUERY_STRIPPING_PARAM_COUNT).clear();
 
-  // Ensure the data is cleared in content.
-  await TestUtils.waitForCondition(() => {
+  let isCleared = () => {
     let histograms = Services.telemetry.getSnapshotForHistograms(
       "main",
       false /* clear */
@@ -45,7 +44,16 @@ async function clearTelemetry() {
       (!histograms[QUERY_STRIPPING_COUNT] &&
         !histograms[QUERY_STRIPPING_PARAM_COUNT])
     );
-  });
+  };
+
+  // Check that the telemetry probes have been cleared properly. Do this check
+  // sync first to avoid any race conditions where telemetry arrives after
+  // clearing.
+  if (!isCleared()) {
+    await TestUtils.waitForCondition(isCleared);
+  }
+
+  ok(true, "Telemetry has been cleared.");
 }
 
 async function verifyQueryString(browser, expected) {
diff --git a/toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_telemetry_2.js b/toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_telemetry_2.js
index 5a7a0889bbbbb..dcd3643f91e5f 100644
--- a/toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_telemetry_2.js
+++ b/toolkit/components/antitracking/test/browser/browser_urlQueryStringStripping_telemetry_2.js
@@ -23,8 +23,7 @@ async function clearTelemetry() {
   Services.telemetry.getHistogramById(QUERY_STRIPPING_PARAM_COUNT).clear();
   Services.telemetry.getHistogramById(QUERY_STRIPPING_COUNT_BY_PARAM).clear();
 
-  // Ensure the data is cleared in content.
-  await TestUtils.waitForCondition(() => {
+  let isCleared = () => {
     let histograms = Services.telemetry.getSnapshotForHistograms(
       "main",
       false /* clear */
@@ -36,7 +35,16 @@ async function clearTelemetry() {
         !histograms[QUERY_STRIPPING_PARAM_COUNT] &&
         !histograms.QUERY_STRIPPING_COUNT_BY_PARAM)
     );
-  });
+  };
+
+  // Check that the telemetry probes have been cleared properly. Do this check
+  // sync first to avoid any race conditions where telemetry arrives after
+  // clearing.
+  if (!isCleared()) {
+    await TestUtils.waitForCondition(isCleared);
+  }
+
+  ok(true, "Telemetry has been cleared.");
 }
 
 async function verifyQueryString(browser, expected) {

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits