Backed out changeset 9b2114c04762 (bug 885349) for timeouts in the new test.

This commit is contained in:
Ryan VanderMeulen 2013-07-09 10:06:54 -04:00
Родитель f0f30baa1f
Коммит e95fd51183
3 изменённых файлов: 6 добавлений и 79 удалений

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

@ -583,18 +583,14 @@ BrowserElementChild.prototype = {
_getSystemCtxMenuData: function(elem) {
if ((elem instanceof Ci.nsIDOMHTMLAnchorElement && elem.href) ||
(elem instanceof Ci.nsIDOMHTMLAreaElement && elem.href)) {
return {uri: elem.href};
return elem.href;
}
if (elem instanceof Ci.nsIImageLoadingContent && elem.currentURI) {
return {uri: elem.currentURI.spec};
return elem.currentURI.spec;
}
if (elem instanceof Ci.nsIDOMHTMLImageElement) {
return {uri: elem.src};
}
if (elem instanceof Ci.nsIDOMHTMLMediaElement) {
let hasVideo = !(elem.readyState >= elem.HAVE_METADATA &&
(elem.videoWidth == 0 || elem.videoHeight == 0));
return {uri: elem.currentSrc || elem.src, hasVideo: hasVideo};
if ((elem instanceof Ci.nsIDOMHTMLMediaElement) ||
(elem instanceof Ci.nsIDOMHTMLImageElement)) {
return elem.currentSrc || elem.src;
}
return false;
},

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

@ -16,8 +16,6 @@ include $(DEPTH)/config/autoconf.mk
# process. Default is OOP.
MOCHITEST_FILES = \
$(topsrcdir)/browser/base/content/test/audio.ogg \
$(topsrcdir)/content/media/test/short-video.ogv \
file_empty_script.js \
file_empty.html \
file_focus.html \

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

@ -4,9 +4,6 @@ SimpleTest.waitForExplicitFinish();
browserElementTestHelpers.setEnabledPref(true);
browserElementTestHelpers.addPermission();
let audioUrl = '/tests/dom/browser-element/mochitest/audio.ogg';
let videoUrl = '/tests/dom/browser-element/mochitest/short-video.ogv';
function runTests() {
createIframe(function onIframeLoaded() {
checkEmptyContextMenu();
@ -117,68 +114,17 @@ function checkCallbackWithoutPreventDefault() {
checkContextMenuCallbackForId(detail, id, function onCallbackFired(label) {
is(label, null, 'Callback label should be null');
checkImageContextMenu();
});
}, /* ignorePreventDefault */ true);
}
function checkImageContextMenu() {
sendContextMenuTo('#menu3-trigger', function onContextMenu(detail) {
var target = detail.systemTargets[0];
is(target.nodeName, 'IMG', 'Reports correct nodeName');
is(target.data.uri, 'example.png', 'Reports correct uri');
checkVideoContextMenu();
}, /* ignorePreventDefault */ true);
}
function checkVideoContextMenu() {
sendContextMenuTo('#menu4-trigger', function onContextMenu(detail) {
var target = detail.systemTargets[0];
is(target.nodeName, 'VIDEO', 'Reports correct nodeName');
is(target.data.uri, videoUrl, 'Reports uri correctly in data');
is(target.data.hasVideo, true, 'Video data in video tag does "hasVideo"');
checkAudioContextMenu();
}, /* ignorePreventDefault */ true);
}
function checkAudioContextMenu() {
sendContextMenuTo('#menu6-trigger', function onContextMenu(detail) {
var target = detail.systemTargets[0];
is(target.nodeName, 'AUDIO', 'Reports correct nodeName');
is(target.data.uri, audioUrl, 'Reports uri correctly in data');
checkAudioinVideoContextMenu();
}, /* ignorePreventDefault */ true);
}
function checkAudioinVideoContextMenu() {
sendSrcTo('#menu5-trigger', audioUrl, function onSrcSet() {
sendContextMenuTo('#menu5-trigger', function onContextMenu(detail) {
var target = detail.systemTargets[0];
is(target.nodeName, 'VIDEO', 'Reports correct nodeName');
is(target.data.uri, audioUrl, 'Reports uri correctly in data');
is(target.data.hasVideo, false, 'Audio data in video tag reports no "hasVideo"');
SimpleTest.finish();
}, /* ignorePreventDefault */ true);
});
}, /* ignorePreventDefault */ true);
}
/* Helpers */
var mm = null;
var previousContextMenuDetail = null;
var currentContextMenuDetail = null;
function sendSrcTo(selector, src, callback) {
mm.sendAsyncMessage('setsrc', { 'selector': selector, 'src': src });
mm.addMessageListener('test:srcset', function onSrcSet(msg) {
mm.removeMessageListener('test:srcset', onSrcSet);
callback();
});
}
function sendContextMenuTo(selector, callback, ignorePreventDefault) {
iframe.addEventListener('mozbrowsercontextmenu', function oncontextmenu(e) {
iframe.removeEventListener(e.type, oncontextmenu);
@ -232,10 +178,6 @@ function createIframe(callback) {
'</menu>' +
'<div id="menu1-trigger" contextmenu="menu1"><a id="inner-link" href="foo.html">Menu 1</a></div>' +
'<a href="bar.html" contextmenu="menu2"><img id="menu2-trigger" src="example.png" /></a>' +
'<img id="menu3-trigger" src="example.png" />' +
'<video id="menu4-trigger" src="' + videoUrl + '"></video>' +
'<video id="menu5-trigger" preload="metadata"></video>' +
'<audio id="menu6-trigger" src="' + audioUrl + '"></audio>' +
'</body></html>';
document.body.appendChild(iframe);
@ -249,15 +191,6 @@ function createIframe(callback) {
document.querySelector(msg.data.selector).dispatchEvent(evt);
});
addMessageListener('setsrc', function onContextMenu(msg) {
var wrappedTarget = content.document.querySelector(msg.data.selector);
var target = XPCNativeWrapper.unwrap(wrappedTarget);
target.addEventListener('loadedmetadata', function() {
sendAsyncMessage('test:srcset');
});
target.src = msg.data.src;
});
addMessageListener('browser-element-api:call', function onCallback(msg) {
if (msg.data.msg_name != 'fire-ctx-callback')
return;