Bug 657191 patch 2: mochitest. r=roc

--HG--
rename : modules/libpr0n/test/mochitest/bug496292-2.sjs => modules/libpr0n/test/mochitest/bug657191.sjs
This commit is contained in:
Daniel Holbert 2011-05-22 19:22:20 -07:00
parent a30612e2aa
commit c92476439a
3 changed files with 64 additions and 0 deletions

View File

@ -74,6 +74,8 @@ _TEST_FILES = imgutils.js \
test_bug553982.html \
test_bug601470.html \
test_bug614392.html \
test_bug657191.html \
bug657191.sjs \
$(NULL)
# Tests disabled due to intermittent orange

View File

@ -0,0 +1,28 @@
function handleRequest(request, response)
{
var file = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("CurWorkD", Components.interfaces.nsIFile);
file.append("tests");
file.append("modules");
file.append("libpr0n");
file.append("test");
file.append("mochitest");
file.append('lime100x100.svg');
response.setStatusLine("1.1", 500, "Internal Server Error");
response.setHeader("Content-Type", "image/svg+xml", false);
var fileStream = Components.classes['@mozilla.org/network/file-input-stream;1']
.createInstance(Components.interfaces.nsIFileInputStream);
fileStream.init(file, 1, 0, false);
var binaryStream = Components.classes['@mozilla.org/binaryinputstream;1']
.createInstance(Components.interfaces.nsIBinaryInputStream);
binaryStream.setInputStream(fileStream);
response.bodyOutputStream.writeFrom(binaryStream, binaryStream.available());
binaryStream.close();
fileStream.close();
}

View File

@ -0,0 +1,34 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=657191
-->
<head>
<title>Test for Bug 657191</title>
<script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=657191">Mozilla Bug 657191</a>
<p id="display"></p>
<div id="content" style="display: none">
<!-- bug657191.sjs returns an SVG image with HTTP error code 500.
As long as this doesn't crash, this test passes. -->
<img src="bug657191.sjs">
</div>
<pre id="test">
<script class="testbody" type="text/javascript">
/** Test for Bug 657191 **/
SimpleTest.waitForExplicitFinish();
window.onload = function() {
ok(true, "test passed");
SimpleTest.finish();
}
</script>
</pre>
</body>
</html>