Bug 526323. Make test_access_controls more precise about attributing failures to the right test, and re-enable it. r=cpearce

This commit is contained in:
Robert O'Callahan 2009-12-16 09:08:59 +13:00
parent 53276000eb
commit 81abfbc319
2 changed files with 20 additions and 20 deletions

View File

@ -179,6 +179,7 @@ ifdef MOZ_OGG
_TEST_FILES += \
dynamic_redirect.sjs \
file_access_controls.html \
test_access_control.html \
test_bug448534.html \
test_bug468190.html \
test_bug486646.html \
@ -227,7 +228,6 @@ ifneq ($(OS_ARCH),WINNT)
# figure out the random failures. See bug 475369 and bug 526323
_TEST_FILES += \
test_timeupdate3.html \
test_access_control.html \
$(NULL)
endif
endif

View File

@ -15,7 +15,7 @@ var gTests = [
},{
// Test 1
url: "redirect.sjs?http://example.com/tests/content/media/test/320x240.allow-origin.ogv",
result: "loaded",
result: "loadeddata",
description: "Can load when redirected to different domain with allow-origin",
},{
// Test 2
@ -25,17 +25,17 @@ var gTests = [
},{
// Test 3
url: "redirect.sjs?http://test1.example.org/tests/content/media/test/320x240.allow-origin.ogv",
result: "loaded",
result: "loadeddata",
description: "Can load when redirected to subdomain with allow-origin",
},{
// Test 4
url: "redirect.sjs?http://example.org/tests/content/media/test/320x240.ogv",
result: "loaded",
result: "loadeddata",
description: "Can load when redirected to same domain",
},{
// Test 5
url: "http://example.org/tests/content/media/test/320x240.ogv",
result: "loaded",
result: "loadeddata",
description: "Can load from same domain"
},{
// Test 6
@ -45,7 +45,7 @@ var gTests = [
},{
// Test 7
url: "http://example.org:8000/tests/content/media/test/320x240.allow-origin.ogv",
result: "loaded",
result: "loadeddata",
description: "Can load from different port on same domain with allow-origin",
},{
// Test 8
@ -55,12 +55,12 @@ var gTests = [
},{
// Test 9
url: "http://example.com/tests/content/media/test/320x240.allow-origin.ogv",
result: "loaded",
result: "loadeddata",
description: "Can load cross domain with allow-origin",
},{
// Test 10
url: "http://test1.example.org/tests/content/media/test/320x240.allow-origin.ogv",
result: "loaded",
result: "loadeddata",
description: "Can load from subdomain with allow-origin",
},{
// Test 11
@ -71,24 +71,25 @@ var gTests = [
];
var gTestNum = 0;
var gExpectedResult = null;
var gTestDescription = null;
var gVideo = null;
var gTestedRemoved = false;
var gOldPref;
function result(code) {
//dump((gTestNum - 1) + ": " + code + "\n");
function eventHandler(event) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
opener.is(code, gExpectedResult, gTestDescription);
//dump((gTestNum - 1) + ": " + event.type + "\n");
var video = event.target;
opener.is(event.type, video.expectedResult, video.testDescription +
(gTestedRemoved ? " (element not in document)" : " (element in document)"));
// Make sure any extra events cause an error
video.expectedResult = "<none>";
nextTest();
}
function createVideo() {
var v = document.createElement('video');
v.addEventListener('loadeddata', function(){result('loaded');}, false);
v.addEventListener('error', function(){result('error');}, false);
v.id = 'video';
v.addEventListener('loadeddata', eventHandler, false);
v.addEventListener('error', eventHandler, false);
return v;
}
@ -112,7 +113,6 @@ function load() {
function nextTest() {
//dump("nextTest() called, gTestNum="+gTestNum+" gTestedRemoved="+gTestedRemoved+"\n");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
if (gTestNum == gTests.length) {
//dump("gTestNum == gTests.length\n");
if (!gTestedRemoved) {
@ -126,15 +126,15 @@ function nextTest() {
return;
}
}
gExpectedResult = gTests[gTestNum].result;
gTestDescription = gTests[gTestNum].description;
//dump("Starting test " + gTestNum + " at " + gTests[gTestNum].url + " expecting:" + gExpectedResult + "\n");
if (gVideo && gVideo.parentNode)
gVideo.parentNode.removeChild(gVideo);
gVideo = createVideo();
gVideo.expectedResult = gTests[gTestNum].result;
gVideo.testDescription = gTests[gTestNum].description;
gVideo.src = gTests[gTestNum].url;
//dump("Starting test " + gTestNum + " at " + gVideo.src + " expecting:" + gVideo.expectedResult + "\n");
if (!gTestedRemoved) {
document.body.appendChild(gVideo);
// Will cause load() to be invoked.