Backed out changeset ceb7d7bffe8c (bug 913070) for xpcshell failures.

This commit is contained in:
Ryan VanderMeulen 2014-01-10 09:48:35 -05:00
parent 4e2c784fee
commit 197c3bb674
13 changed files with 1067 additions and 1173 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,2 +1,3 @@
component {55d6a5fa-130e-4ee6-a158-0133af3b86ba} TelemetryPing.js
contract @mozilla.org/base/telemetry-ping;1 {55d6a5fa-130e-4ee6-a158-0133af3b86ba}
category profile-after-change TelemetryPing @mozilla.org/base/telemetry-ping;1

View File

@ -1,28 +0,0 @@
/* -*- js-indent-level: 2; indent-tabs-mode: nil -*- */
/* 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";
const Cu = Components.utils;
Cu.import("resource://gre/modules/TelemetryPing.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
/**
* TelemetryStartup is needed to forward the "profile-after-change" notification
* to TelemetryPing.jsm.
*/
function TelemetryStartup() {
}
TelemetryStartup.prototype.classID = Components.ID("{117b219f-92fe-4bd2-a21b-95a342a9d474}");
TelemetryStartup.prototype.QueryInterface = XPCOMUtils.generateQI([Components.interfaces.nsIObserver])
TelemetryStartup.prototype.observe = function(aSubject, aTopic, aData){
if (aTopic == "profile-after-change") {
TelemetryPing.observe(null, "profile-after-change", null);
}
}
this.NSGetFactory = XPCOMUtils.generateNSGetFactory([TelemetryStartup]);

View File

@ -1,3 +0,0 @@
component {117b219f-92fe-4bd2-a21b-95a342a9d474} TelemetryStartup.js
contract @mozilla.org/base/telemetry-startup;1 {117b219f-92fe-4bd2-a21b-95a342a9d474}
category profile-after-change TelemetryStartup @mozilla.org/base/telemetry-startup;1

View File

@ -24,10 +24,11 @@ SOURCES += [
]
EXTRA_COMPONENTS += [
'TelemetryPing.js',
'TelemetryPing.manifest',
'TelemetryStartup.js',
'TelemetryStartup.manifest'
]
EXTRA_PP_COMPONENTS += [
'TelemetryPing.js',
]
EXTRA_JS_MODULES += [
@ -37,7 +38,6 @@ EXTRA_JS_MODULES += [
]
EXTRA_PP_JS_MODULES += [
'TelemetryPing.jsm',
'UITelemetry.jsm',
]

View File

@ -17,7 +17,6 @@ Cu.import("resource://testing-common/httpd.js");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/TelemetryPing.jsm");
const IGNORE_HISTOGRAM = "test::ignore_me";
const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED";
@ -39,6 +38,7 @@ const NUMBER_OF_THREADS_TO_LAUNCH = 30;
var gNumberOfThreadsLaunched = 0;
const Telemetry = Cc["@mozilla.org/base/telemetry;1"].getService(Ci.nsITelemetry);
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
var httpserver = new HttpServer();
var serverStarted = false;

View File

@ -13,13 +13,13 @@
* -> previousBuildID in telemetry, new value set in prefs.
*/
const Cu = Components.utils;
Components.utils.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/TelemetryPing.jsm");
// Get the TelemetryPing definitions directly so we can test it without going through xpcom.
Services.scriptloader.loadSubScript("resource://gre/components/TelemetryPing.js");
// Force the Telemetry enabled preference so that TelemetryPing.reset() doesn't exit early.
Services.prefs.setBoolPref(TelemetryPing.Constants.PREF_ENABLED, true);
// Force the Telemetry enabled preference so that TelemetryPing.setup() doesn't exit early.
Services.prefs.setBoolPref(PREF_ENABLED, true);
// Set up our dummy AppInfo object so we can control the appBuildID.
Cu.import("resource://testing-common/AppInfo.jsm");
@ -28,22 +28,25 @@ updateAppInfo();
// Check that when run with no previous build ID stored, we update the pref but do not
// put anything into the metadata.
function testFirstRun() {
TelemetryPing.reset();
let metadata = TelemetryPing.getMetadata();
let ping = new TelemetryPing();
ping.setup();
let metadata = ping.getMetadata();
do_check_false("previousBuildID" in metadata);
let appBuildID = getAppInfo().appBuildID;
let buildIDPref = Services.prefs.getCharPref(TelemetryPing.Constants.PREF_PREVIOUS_BUILDID);
let buildIDPref = Services.prefs.getCharPref(PREF_PREVIOUS_BUILDID);
do_check_eq(appBuildID, buildIDPref);
}
// Check that a subsequent run with the same build ID does not put prev build ID in
// metadata. Assumes testFirstRun() has already been called to set the previousBuildID pref.
function testSecondRun() {
TelemetryPing.reset();
let metadata = TelemetryPing.getMetadata();
let ping = new TelemetryPing();
ping.setup();
let metadata = ping.getMetadata();
do_check_false("previousBuildID" in metadata);
}
// Set up telemetry with a different app build ID and check that the old build ID
// is returned in the metadata and the pref is updated to the new build ID.
// Assumes testFirstRun() has been called to set the previousBuildID pref.
@ -52,10 +55,11 @@ function testNewBuild() {
let info = getAppInfo();
let oldBuildID = info.appBuildID;
info.appBuildID = NEW_BUILD_ID;
TelemetryPing.reset();
let metadata = TelemetryPing.getMetadata();
let ping = new TelemetryPing();
ping.setup();
let metadata = ping.getMetadata();
do_check_eq(metadata.previousBuildID, oldBuildID);
let buildIDPref = Services.prefs.getCharPref(TelemetryPing.Constants.PREF_PREVIOUS_BUILDID);
let buildIDPref = Services.prefs.getCharPref(PREF_PREVIOUS_BUILDID);
do_check_eq(NEW_BUILD_ID, buildIDPref);
}

View File

@ -1,12 +1,9 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
// Check that TelemetryPing notifies correctly on idle-daily.
// Check that TelemetryPing notifies correctly on idle.
const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/TelemetryPing.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
function run_test() {
do_test_pending();
@ -16,5 +13,7 @@ function run_test() {
do_test_finished();
}, "gather-telemetry", false);
TelemetryPing.observe(null, "idle-daily", null);
Components.classes["@mozilla.org/base/telemetry-ping;1"]
.getService(Components.interfaces.nsITelemetryPing)
.observe(null, "idle-daily", null);
}

View File

@ -9,7 +9,6 @@ Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
Cu.import("resource://gre/modules/ThirdPartyCookieProbe.jsm");
Cu.import("resource://gre/modules/commonjs/sdk/core/promise.js");
Cu.import("resource://gre/modules/TelemetryPing.jsm");
let TOPIC_ACCEPTED = "third-party-cookie-accepted";
let TOPIC_REJECTED = "third-party-cookie-rejected";
@ -20,6 +19,8 @@ const NUMBER_OF_REJECTS = 30;
const NUMBER_OF_ACCEPTS = 17;
const NUMBER_OF_REPEATS = 5;
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
let gCookieService;
let gThirdPartyCookieProbe;

View File

@ -10,13 +10,14 @@ const Cu = Components.utils;
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/TelemetryTimestamps.jsm");
Cu.import("resource://gre/modules/TelemetryPing.jsm");
const Telemetry = Services.telemetry;
const bundle = Services.strings.createBundle(
"chrome://global/locale/aboutTelemetry.properties");
const brandBundle = Services.strings.createBundle(
"chrome://branding/locale/brand.properties");
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].
getService(Ci.nsITelemetryPing);
// Maximum height of a histogram bar (in em for html, in chars for text)
const MAX_BAR_HEIGHT = 18;

View File

@ -13,8 +13,10 @@ Cu.import("resource://testing-common/AppInfo.jsm");
updateAppInfo();
function getSimpleMeasurementsFromTelemetryPing() {
return Cu.import("resource://gre/modules/TelemetryPing.jsm", {}).
TelemetryPing.getPayload().simpleMeasurements;
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
let ping = TelemetryPing.getPayload();
return ping.simpleMeasurements;
}
function run_test() {

View File

@ -2266,7 +2266,8 @@ var XPIProvider = {
}
catch (e) { }
Cu.import("resource://gre/modules/TelemetryPing.jsm", {}).TelemetryPing.setAddOns(data);
const TelemetryPing = Cc["@mozilla.org/base/telemetry-ping;1"].getService(Ci.nsITelemetryPing);
TelemetryPing.setAddOns(data);
},
/**