mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 20:42:49 +00:00
Bug 789617 - Test vorbis comment validation. r=cpearce
Add a new test file with some invalid comments and verify they are filtered out of the mozGetMetadata() output. The new file includes the following valid edge cases: - empty tag name - empty tag value - punctuation in the tag name and the following invalid cases: - non-ascii tag name - invalid characters in tag name - non-utf-8 tag value - no tag=value separator Also updates the mochitest messages to be less confusing.
This commit is contained in:
parent
df3c7deb4f
commit
9526e122c1
@ -168,6 +168,7 @@ MOCHITEST_FILES += \
|
||||
448636.ogv \
|
||||
audio-overhang.ogg \
|
||||
audio-gaps.ogg \
|
||||
badtags.ogg \
|
||||
beta-phrasebook.ogg \
|
||||
bogus.ogv \
|
||||
bug495129.ogv \
|
||||
|
BIN
content/media/test/badtags.ogg
Normal file
BIN
content/media/test/badtags.ogg
Normal file
Binary file not shown.
@ -346,7 +346,22 @@ var gMetadataTests = [
|
||||
COMMENTS:"Audio Description"
|
||||
}
|
||||
},
|
||||
{ name:"sound.ogg", tags: { } }
|
||||
{ name:"sound.ogg", tags: { } },
|
||||
{ name:"badtags.ogg", tags: {
|
||||
// We list only the valid tags here, and verify
|
||||
// the invalid ones are filtered out.
|
||||
title:"Invalid comments test file",
|
||||
empty:"",
|
||||
"":"empty",
|
||||
"{- [(`!@\"#$%^&')] -}":"valid tag name, surprisingly"
|
||||
// The file also includes the following invalid tags.
|
||||
// "A description with no separator is a common problem.",
|
||||
// "雨":"Likely, but an invalid key (non-ascii).",
|
||||
// "not\nval\x1fid":"invalid tag name",
|
||||
// "not~valid":"this isn't a valid name either",
|
||||
// "not-utf-8":"invalid sequences: \xff\xfe\xfa\xfb\0eol"
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
function checkMetadata(msg, e, test) {
|
||||
|
@ -28,7 +28,7 @@ function startTest(test, token) {
|
||||
var m = a.mozGetMetadata();
|
||||
} catch (e) {
|
||||
is(e.name, 'InvalidStateError',
|
||||
"early mozGetMetadata() threw incorrect exception");
|
||||
"early mozGetMetadata() should throw InvalidStateError");
|
||||
exception_fired = true;
|
||||
}
|
||||
ok(exception_fired,
|
||||
@ -38,7 +38,7 @@ function startTest(test, token) {
|
||||
a.addEventListener('loadedmetadata', function() {
|
||||
// read decoded tags
|
||||
tags = a.mozGetMetadata();
|
||||
ok(tags, "mozGetMetadata() failed");
|
||||
ok(tags, "mozGetMetadata() should return a truthy value");
|
||||
// Dump them out.
|
||||
var d = document.getElementById('output');
|
||||
var html = '<table>\n';
|
||||
@ -61,11 +61,11 @@ function startTest(test, token) {
|
||||
d.appendChild(div);
|
||||
// Verify decoded tag values.
|
||||
for (tag in tags) {
|
||||
is(tags[tag], test.tags[tag], "Tag '"+tag+"' doesn't match");
|
||||
is(tags[tag], test.tags[tag], "Tag '"+tag+"' should match");
|
||||
}
|
||||
// Verify expected tag values
|
||||
for (tag in test.tags) {
|
||||
is(tags[tag], test.tags[tag], "Tag '"+tag+"' doesn't match");
|
||||
is(tags[tag], test.tags[tag], "Tag '"+tag+"' should match");
|
||||
}
|
||||
manager.finished(token);
|
||||
}, false);
|
||||
|
Loading…
x
Reference in New Issue
Block a user