зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 895eeb7bddb8 (bug 973294) for bc1 test failures
This commit is contained in:
Родитель
6e373479dd
Коммит
57655b7b7e
|
@ -184,7 +184,6 @@ TranslationUI.prototype = {
|
|||
this.originalShown = true;
|
||||
this.showURLBarIcon();
|
||||
this.browser.messageManager.sendAsyncMessage("Translation:ShowOriginal");
|
||||
TranslationHealthReport.recordShowOriginalContent();
|
||||
},
|
||||
|
||||
showTranslatedContent: function() {
|
||||
|
@ -324,13 +323,6 @@ let TranslationHealthReport = {
|
|||
this._withProvider(provider => provider.recordDeniedTranslationOffer());
|
||||
},
|
||||
|
||||
/**
|
||||
* Record a "Show Original" command use.
|
||||
*/
|
||||
recordShowOriginalContent: function () {
|
||||
this._withProvider(provider => provider.recordShowOriginalContent());
|
||||
},
|
||||
|
||||
/**
|
||||
* Retrieve the translation provider and pass it to the given function.
|
||||
*
|
||||
|
@ -390,7 +382,6 @@ TranslationMeasurement1.prototype = Object.freeze({
|
|||
detectedLanguageChangedBefore: DAILY_COUNTER_FIELD,
|
||||
detectedLanguageChangedAfter: DAILY_COUNTER_FIELD,
|
||||
deniedTranslationOffer: DAILY_COUNTER_FIELD,
|
||||
showOriginalContent: DAILY_COUNTER_FIELD,
|
||||
detectLanguageEnabled: DAILY_LAST_NUMERIC_FIELD,
|
||||
showTranslationUI: DAILY_LAST_NUMERIC_FIELD,
|
||||
},
|
||||
|
@ -536,15 +527,6 @@ TranslationProvider.prototype = Object.freeze({
|
|||
}.bind(this));
|
||||
},
|
||||
|
||||
recordShowOriginalContent: function () {
|
||||
let m = this.getMeasurement(TranslationMeasurement1.prototype.name,
|
||||
TranslationMeasurement1.prototype.version);
|
||||
|
||||
return this._enqueueTelemetryStorageTask(function* recordTask() {
|
||||
yield m.incrementDailyCounter("showOriginalContent");
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
collectDailyData: function () {
|
||||
let m = this.getMeasurement(TranslationMeasurement1.prototype.name,
|
||||
TranslationMeasurement1.prototype.version);
|
||||
|
|
|
@ -32,8 +32,7 @@ let MetricsChecker = {
|
|||
this._metrics = {
|
||||
pageCount: day.get("pageTranslatedCount") || 0,
|
||||
charCount: day.get("charactersTranslatedCount") || 0,
|
||||
deniedOffers: day.get("deniedTranslationOffer") || 0,
|
||||
showOriginal: day.get("showOriginalContent") || 0
|
||||
deniedOffers: day.get("deniedTranslationOffer") || 0
|
||||
};
|
||||
this._metricsTime = metricsTime;
|
||||
}),
|
||||
|
@ -104,15 +103,6 @@ add_task(function* test_deny_translation_metric() {
|
|||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
||||
add_task(function* test_show_original() {
|
||||
let tab =
|
||||
yield translate("<h1>Hallo Welt!</h1><h1>Bratwurst!</h1>", "de", "en", false);
|
||||
yield MetricsChecker.checkAdditions({ pageCount: 1, showOriginal: 0 });
|
||||
getInfobarElement(tab.linkedBrowser, "showOriginal").doCommand();
|
||||
yield MetricsChecker.checkAdditions({ pageCount: 0, showOriginal: 1 });
|
||||
gBrowser.removeTab(tab);
|
||||
});
|
||||
|
||||
function getInfobarElement(browser, anonid) {
|
||||
let notif = browser.translationUI
|
||||
.notificationBox.getNotificationWithValue("translation");
|
||||
|
|
|
@ -196,14 +196,14 @@ add_task(function* test_record_translation() {
|
|||
yield storage.close();
|
||||
});
|
||||
|
||||
function* test_simple_counter(aProviderFuncName, aCounterName) {
|
||||
add_task(function* test_denied_translation_offer() {
|
||||
let storage = yield Metrics.Storage("translation");
|
||||
let provider = new TranslationProvider();
|
||||
yield provider.init(storage);
|
||||
let now = new Date();
|
||||
|
||||
yield provider[aProviderFuncName]();
|
||||
yield provider[aProviderFuncName]();
|
||||
yield provider.recordDeniedTranslationOffer();
|
||||
yield provider.recordDeniedTranslationOffer();
|
||||
|
||||
let m = provider.getMeasurement("translation", 1);
|
||||
let values = yield m.getValues();
|
||||
|
@ -211,19 +211,11 @@ function* test_simple_counter(aProviderFuncName, aCounterName) {
|
|||
Assert.ok(values.days.hasDay(now));
|
||||
let day = values.days.getDay(now);
|
||||
|
||||
Assert.ok(day.has(aCounterName));
|
||||
Assert.equal(day.get(aCounterName), 2);
|
||||
Assert.ok(day.has("deniedTranslationOffer"));
|
||||
Assert.equal(day.get("deniedTranslationOffer"), 2);
|
||||
|
||||
yield provider.shutdown();
|
||||
yield storage.close();
|
||||
}
|
||||
|
||||
add_task(function* test_denied_translation_offer() {
|
||||
yield test_simple_counter("recordDeniedTranslationOffer", "deniedTranslationOffer");
|
||||
});
|
||||
|
||||
add_task(function* test_show_original() {
|
||||
yield test_simple_counter("recordShowOriginalContent", "showOriginalContent");
|
||||
});
|
||||
|
||||
add_task(function* test_collect_daily() {
|
||||
|
@ -285,8 +277,6 @@ add_task(function* test_healthreporter_json() {
|
|||
|
||||
yield provider.recordDeniedTranslationOffer();
|
||||
|
||||
yield provider.recordShowOriginalContent();
|
||||
|
||||
yield reporter.collectMeasurements();
|
||||
let payload = yield reporter.getJSONPayload(true);
|
||||
let today = reporter._formatDate(now);
|
||||
|
@ -322,9 +312,6 @@ add_task(function* test_healthreporter_json() {
|
|||
|
||||
Assert.ok("deniedTranslationOffer" in translations);
|
||||
Assert.equal(translations["deniedTranslationOffer"], 1);
|
||||
|
||||
Assert.ok("showOriginalContent" in translations);
|
||||
Assert.equal(translations["showOriginalContent"], 1);
|
||||
} finally {
|
||||
reporter._shutdown();
|
||||
}
|
||||
|
@ -351,8 +338,6 @@ add_task(function* test_healthreporter_json2() {
|
|||
|
||||
yield provider.recordDeniedTranslationOffer();
|
||||
|
||||
yield provider.recordShowOriginalContent();
|
||||
|
||||
yield reporter.collectMeasurements();
|
||||
let payload = yield reporter.getJSONPayload(true);
|
||||
let today = reporter._formatDate(now);
|
||||
|
@ -372,7 +357,6 @@ add_task(function* test_healthreporter_json2() {
|
|||
Assert.ok(!("detectedLanguageChangedBefore" in translations));
|
||||
Assert.ok(!("detectedLanguageChangedAfter" in translations));
|
||||
Assert.ok(!("deniedTranslationOffer" in translations));
|
||||
Assert.ok(!("showOriginalContent" in translations));
|
||||
} finally {
|
||||
reporter._shutdown();
|
||||
}
|
||||
|
|
|
@ -1557,12 +1557,9 @@ detectedLanguageChangedAfter
|
|||
Integer count of the number of times the user manually adjusted the detected
|
||||
language after having first translated the page.
|
||||
deniedTranslationOffer
|
||||
Integer count of the number of times the user opted-out offered
|
||||
Integer count of the numbers of times the user opted-out offered
|
||||
page translation, either by the Not Now button or by the notification's
|
||||
close button in the "offer" state.
|
||||
showOriginalContent
|
||||
Integer count of the number of times the user activated the Show Original
|
||||
command.
|
||||
|
||||
Additional daily counts broken down by language are reported in the following
|
||||
properties:
|
||||
|
@ -1600,8 +1597,7 @@ Example
|
|||
"charactersTranslatedCount": "1126",
|
||||
"detectedLanguageChangedBefore": 1,
|
||||
"detectedLanguageChangedAfter": 2,
|
||||
"deniedTranslationOffer": 3,
|
||||
showOriginalContent: 2,
|
||||
"deniedTranslationOffer": 3
|
||||
"translationOpportunityCountsByLanguage": {
|
||||
"fr": 100,
|
||||
"es": 34
|
||||
|
|
Загрузка…
Ссылка в новой задаче