зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1783261 - Measure the result text length in the text recognition modal; r=nordzilla
Differential Revision: https://phabricator.services.mozilla.com/D154895
This commit is contained in:
Родитель
0b264edb08
Коммит
6809cfbb58
|
@ -97,10 +97,15 @@ add_task(async function() {
|
|||
const close = contentDocument.querySelector("#text-recognition-close");
|
||||
close.click();
|
||||
|
||||
const expectedResultText = "Mozilla\nFirefox\n";
|
||||
is(getTextFromClipboard(), expectedResultText, "The copied text matches.");
|
||||
|
||||
is(
|
||||
getTextFromClipboard(),
|
||||
"Mozilla\nFirefox\n",
|
||||
"The copied text matches."
|
||||
Services.telemetry
|
||||
.getHistogramById("TEXT_RECOGNITION_TEXT_LENGTH")
|
||||
.snapshot().sum,
|
||||
expectedResultText.length,
|
||||
"The length of the text was recorded."
|
||||
);
|
||||
|
||||
info("Waiting for the dialog frame to close.");
|
||||
|
|
|
@ -51,4 +51,5 @@ function clearTelemetry() {
|
|||
Services.telemetry
|
||||
.getHistogramById("TEXT_RECOGNITION_INTERACTION_TIMING")
|
||||
.clear();
|
||||
Services.telemetry.getHistogramById("TEXT_RECOGNITION_TEXT_LENGTH").clear();
|
||||
}
|
||||
|
|
|
@ -112,6 +112,17 @@ class TextRecognitionModal {
|
|||
window.addEventListener("unload", finish);
|
||||
}
|
||||
|
||||
/**
|
||||
* After the results are shown, measure how long a user interacts with the modal.
|
||||
* @param {number} length
|
||||
*/
|
||||
static recordTextLengthTelemetry(length) {
|
||||
const histogram = Services.telemetry.getHistogramById(
|
||||
"TEXT_RECOGNITION_TEXT_LENGTH"
|
||||
);
|
||||
histogram.add(length);
|
||||
}
|
||||
|
||||
setupCloseHandler() {
|
||||
document
|
||||
.querySelector("#text-recognition-close")
|
||||
|
@ -215,6 +226,7 @@ class TextRecognitionModal {
|
|||
this.textEl.style.display = "block";
|
||||
|
||||
TextRecognitionModal.copy(text);
|
||||
TextRecognitionModal.recordTextLengthTelemetry(text.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17101,6 +17101,18 @@
|
|||
"bug_numbers": [1783261],
|
||||
"description": "The milliseconds of time that a user viewed the text results."
|
||||
},
|
||||
"TEXT_RECOGNITION_TEXT_LENGTH": {
|
||||
"record_in_processes": ["main"],
|
||||
"products": ["firefox"],
|
||||
"releaseChannelCollection": "opt-out",
|
||||
"alert_emails": ["gtatum@mozilla.com", "nordzilla@mozilla.com"],
|
||||
"expires_in_version": "109",
|
||||
"kind": "exponential",
|
||||
"high": 50000,
|
||||
"n_buckets": 20,
|
||||
"bug_numbers": [1783261],
|
||||
"description": "Measures the length of the text that was recognized, in code units."
|
||||
},
|
||||
"DOWNLOADS_USER_ACTION_ON_BLOCKED_DOWNLOAD": {
|
||||
"record_in_processes": ["main"],
|
||||
"products": ["firefox"],
|
||||
|
|
Загрузка…
Ссылка в новой задаче