Bug 720636 - Permanent orange: TEST-UNEXPECTED-FAIL | test_TelemetryPing.js | false == true. Update the test to not rely on the graphics hardware installed as it is really just testing that the hardware information gets reported. r=jdaggett

This commit is contained in:
Mark Banner 2012-02-13 10:05:53 +00:00
Родитель e078514a3c
Коммит c7670cd9c8
1 изменённых файлов: 26 добавлений и 11 удалений

Просмотреть файл

@ -15,8 +15,8 @@ Cu.import("resource://gre/modules/LightweightThemeManager.jsm");
const PATH = "/submit/telemetry/test-ping";
const SERVER = "http://localhost:4444";
const IGNORE_HISTOGRAM = "test::ignore_me";
const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED"
const IGNORE_CLONED_HISTOGRAM = "test::ignore_me_also"
const IGNORE_HISTOGRAM_TO_CLONE = "MEMORY_HEAP_ALLOCATED";
const IGNORE_CLONED_HISTOGRAM = "test::ignore_me_also";
const BinaryInputStream = Components.Constructor(
"@mozilla.org/binaryinputstream;1",
@ -61,7 +61,7 @@ function checkHistograms(request, response) {
.decodeFromStream(s, s.available());
do_check_eq(request.getHeader("content-type"), "application/json; charset=UTF-8");
do_check_true(payload.simpleMeasurements.uptime >= 0)
do_check_true(payload.simpleMeasurements.uptime >= 0);
do_check_true(payload.simpleMeasurements.startupInterrupted === 1);
// get rid of the non-deterministic field
const expected_info = {
@ -78,12 +78,19 @@ function checkHistograms(request, response) {
do_check_eq(payload.info[f], expected_info[f]);
}
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
var isOSX = ("nsILocalFileMac" in Components.interfaces);
try {
// If we've not got nsIGfxInfoDebug, then this will throw and stop us doing
// this test.
var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfoDebug);
var isWindows = ("@mozilla.org/windows-registry-key;1" in Components.classes);
var isOSX = ("nsILocalFileMac" in Components.interfaces);
if (isWindows || isOSX) {
do_check_true("adapterVendorID" in payload.info);
do_check_true("adapterDeviceID" in payload.info);
if (isWindows || isOSX) {
do_check_true("adapterVendorID" in payload.info);
do_check_true("adapterDeviceID" in payload.info);
}
}
catch (x) {
}
const TELEMETRY_PING = "TELEMETRY_PING";
@ -105,8 +112,8 @@ function checkHistograms(request, response) {
histogram_type: 2,
values: {0:1, 1:1, 2:0},
sum: 1
}
let tc = payload.histograms[TELEMETRY_SUCCESS]
};
let tc = payload.histograms[TELEMETRY_SUCCESS];
do_check_eq(uneval(tc),
uneval(expected_tc));
@ -176,6 +183,14 @@ function dummyTheme(id) {
}
function run_test() {
try {
var gfxInfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfoDebug);
gfxInfo.spoofVendorID("0xabcd");
gfxInfo.spoofDeviceID("0x1234");
} catch (x) {
// If we can't test gfxInfo, that's fine, we'll note it later.
}
// Addon manager needs a profile directory
do_get_profile();
createAppInfo("xpcshell@tests.mozilla.org", "XPCShell", "1", "1.9.2");
@ -192,5 +207,5 @@ function run_test() {
// spin the event loop
do_test_pending();
// ensure that test runs to completion
do_register_cleanup(function () do_check_true(gFinished))
do_register_cleanup(function () do_check_true(gFinished));
}