mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-22 18:32:00 +00:00
Bug 512435 - Tests. r=dolske
This commit is contained in:
parent
698539c8df
commit
f9b8d27445
@ -62,6 +62,9 @@ _TEST_FILES = imgutils.js \
|
||||
bug496292-iframe-2.html \
|
||||
bug496292-1.sjs \
|
||||
bug496292-2.sjs \
|
||||
test_bug512435.html \
|
||||
damon.jpg \
|
||||
shaver.png \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_TEST_FILES)
|
||||
|
BIN
modules/libpr0n/test/mochitest/damon.jpg
Normal file
BIN
modules/libpr0n/test/mochitest/damon.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.6 KiB |
@ -3,6 +3,15 @@
|
||||
// Note that this is use by tests elsewhere in the source tree. When in doubt,
|
||||
// check mxr before removing or changing functionality.
|
||||
|
||||
// Helper function to clear the image cache of content images
|
||||
function clearImageCache()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var imageCache = Components.classes["@mozilla.org/image/cache;1"]
|
||||
.getService(Components.interfaces.imgICache);
|
||||
imageCache.clearCache(false); // true=chrome, false=content
|
||||
}
|
||||
|
||||
// Helper function to determine if the frame is decoded for a given image id
|
||||
function isFrameDecoded(id)
|
||||
{
|
||||
|
BIN
modules/libpr0n/test/mochitest/shaver.png
Normal file
BIN
modules/libpr0n/test/mochitest/shaver.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 51 KiB |
50
modules/libpr0n/test/mochitest/test_bug512435.html
Normal file
50
modules/libpr0n/test/mochitest/test_bug512435.html
Normal file
@ -0,0 +1,50 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=512435
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 512435</title>
|
||||
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/tests/modules/libpr0n/test/mochitest/imgutils.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=512435">Mozilla Bug 512435</a>
|
||||
<img id="img_a">
|
||||
<img id="img_b">
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script type="application/javascript">
|
||||
|
||||
// Boilerplate
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
// We're relying on very particular behavior for certain images - clear the
|
||||
// image cache, _then_ set src
|
||||
clearImageCache();
|
||||
document.getElementById("img_a").src = "damon.jpg";
|
||||
document.getElementById("img_b").src = "shaver.png";
|
||||
|
||||
// Our handler
|
||||
function loadHandler() {
|
||||
|
||||
// The two images should be decoded
|
||||
ok(isFrameDecoded("img_a"), "img_a should be decoded before onload fires");
|
||||
ok(isFrameDecoded("img_b"), "img_b should be decoded before onload fires");
|
||||
|
||||
// All done
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
// Set our onload handler
|
||||
window.onload = loadHandler;
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user