2010-02-09 16:09:59 +00:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Reftests with caret drawing</title>
|
|
|
|
<script type="text/javascript" src="/MochiKit/packed.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
|
|
|
|
<script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
|
|
|
|
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
2011-01-27 05:26:33 +00:00
|
|
|
<style>
|
|
|
|
iframe {
|
|
|
|
width: 600px;
|
|
|
|
height: 600px;
|
|
|
|
}
|
|
|
|
</style>
|
2010-02-09 16:09:59 +00:00
|
|
|
<script type="text/javascript">
|
|
|
|
|
|
|
|
var canvases = [];
|
|
|
|
function callbackTestCanvas(canvas)
|
|
|
|
{
|
|
|
|
canvases.push(canvas);
|
|
|
|
|
|
|
|
if (canvases.length != 2)
|
|
|
|
return;
|
|
|
|
|
|
|
|
var result = canvases[0];
|
|
|
|
var reference = canvases[1];
|
|
|
|
|
|
|
|
var ret = compareSnapshots(result.snapshot, reference.snapshot, true);
|
|
|
|
ok(ret[0], "Reftest " + result.src +
|
|
|
|
(ret[0] ? "" : (" FAILED\n" +
|
|
|
|
"RESULT=" + ret[1] + "\n" +
|
|
|
|
"REFERENCE=" + ret[2] + "\n")));
|
|
|
|
|
|
|
|
// Remove the iframes if the test was successful
|
|
|
|
if (ret[0]) {
|
|
|
|
result.parentNode.removeChild(result);
|
|
|
|
reference.parentNode.removeChild(reference);
|
|
|
|
}
|
|
|
|
canvases = [];
|
|
|
|
nextTest();
|
|
|
|
}
|
|
|
|
|
|
|
|
function doSnapShot(iframe) {
|
|
|
|
iframe.snapshot = snapshotWindow(iframe.contentWindow, true);
|
|
|
|
callbackTestCanvas(iframe);
|
|
|
|
};
|
|
|
|
|
|
|
|
function remotePageLoaded() {
|
|
|
|
var iframe = this;
|
|
|
|
setTimeout(function(){doSnapShot(iframe);}, 0)
|
|
|
|
};
|
|
|
|
|
2010-08-24 03:49:15 +00:00
|
|
|
const MAX_ITERATIONS = 10;
|
|
|
|
|
2010-02-09 16:09:59 +00:00
|
|
|
function createIframe(url,next) {
|
|
|
|
var iframe = document.createElement("iframe");
|
|
|
|
iframe.src = url;
|
|
|
|
iframe.remotePageLoaded = remotePageLoaded;
|
|
|
|
var me = this;
|
2010-08-24 03:49:15 +00:00
|
|
|
var currentIteration = 0;
|
|
|
|
function iframeLoadCompleted() {
|
|
|
|
var docEl = iframe.contentDocument.documentElement;
|
|
|
|
if (docEl.className.indexOf("reftest-wait") >= 0) {
|
|
|
|
if (currentIteration++ > MAX_ITERATIONS) {
|
|
|
|
ok(false, "iframe load for " + url + " timed out");
|
|
|
|
SimpleTest.finish();
|
|
|
|
} else {
|
|
|
|
setTimeout(iframeLoadCompleted, 10);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
iframe.remotePageLoaded();
|
|
|
|
if (next) setTimeout(function(){createIframe(next,null);}, 0)
|
|
|
|
}
|
|
|
|
iframe.addEventListener("load", iframeLoadCompleted, false);
|
2010-02-09 16:09:59 +00:00
|
|
|
window.document.body.appendChild(iframe);
|
|
|
|
};
|
|
|
|
|
|
|
|
function refTest(test,ref) {
|
|
|
|
createIframe(test,ref);
|
|
|
|
};
|
|
|
|
|
2011-01-26 21:18:15 +00:00
|
|
|
var caretBlinkTime = null;
|
2010-02-09 16:09:59 +00:00
|
|
|
function endTest() {
|
|
|
|
SimpleTest.finish();
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege(
|
|
|
|
'UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
|
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
2011-01-26 21:18:15 +00:00
|
|
|
if (caretBlinkTime !== null) {
|
|
|
|
prefs.setIntPref("ui.caretBlinkTime", caretBlinkTime);
|
|
|
|
} else {
|
|
|
|
prefs.clearUserPref("ui.caretBlinkTime");
|
|
|
|
}
|
2010-02-09 16:09:59 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
var tests = [
|
|
|
|
[ 'bug106855-1.html' , 'bug106855-1-ref.html' ] ,
|
|
|
|
[ 'bug106855-2.html' , 'bug106855-1-ref.html' ] ,
|
2010-09-01 22:06:52 +00:00
|
|
|
[ 'bug240933-1.html' , 'bug240933-1-ref.html' ] ,
|
|
|
|
[ 'bug240933-2.html' , 'bug240933-1-ref.html' ] ,
|
2010-08-17 23:31:02 +00:00
|
|
|
[ 'bug389321-1.html' , 'bug389321-1-ref.html' ] ,
|
2010-10-27 21:56:50 +00:00
|
|
|
[ 'bug389321-2.html' , 'bug389321-2-ref.html' ] ,
|
|
|
|
[ 'bug389321-3.html' , 'bug389321-3-ref.html' ] ,
|
2010-02-09 16:09:59 +00:00
|
|
|
[ 'bug482484.html' , 'bug482484-ref.html' ] ,
|
|
|
|
[ 'bug512295-1.html' , 'bug512295-1-ref.html' ] ,
|
2010-08-24 03:49:15 +00:00
|
|
|
[ 'bug512295-2.html' , 'bug512295-2-ref.html' ] ,
|
2010-09-24 19:10:53 +00:00
|
|
|
[ 'bug585922.html' , 'bug585922-ref.html' ] ,
|
2010-10-08 19:49:47 +00:00
|
|
|
[ 'bug597519-1.html' , 'bug597519-1-ref.html' ] ,
|
|
|
|
[ 'bug602141-1.html' , 'bug602141-1-ref.html' ] ,
|
|
|
|
[ 'bug602141-2.html' , 'bug602141-2-ref.html' ] ,
|
|
|
|
[ 'bug602141-3.html' , 'bug602141-3-ref.html' ] ,
|
2010-11-22 08:13:37 +00:00
|
|
|
[ 'bug602141-4.html' , 'bug602141-4-ref.html' ] ,
|
2010-12-07 06:30:05 +00:00
|
|
|
[ 'bug612271-1.html' , 'bug612271-ref.html' ] ,
|
|
|
|
[ 'bug612271-2.html' , 'bug612271-ref.html' ] ,
|
|
|
|
[ 'bug612271-3.html' , 'bug612271-ref.html' ] ,
|
2010-11-22 08:13:37 +00:00
|
|
|
[ 'bug613433-1.html' , 'bug613433-ref.html' ] ,
|
|
|
|
[ 'bug613433-2.html' , 'bug613433-ref.html' ] ,
|
2010-11-24 22:57:58 +00:00
|
|
|
[ 'bug613433-3.html' , 'bug613433-ref.html' ] ,
|
|
|
|
[ 'bug613807-1.html' , 'bug613807-1-ref.html' ]
|
2010-02-09 16:09:59 +00:00
|
|
|
];
|
|
|
|
var testIndex = 0;
|
|
|
|
|
|
|
|
function nextTest() {
|
|
|
|
if (testIndex < tests.length) {
|
|
|
|
refTest(tests[testIndex][0],tests[testIndex][1]);
|
|
|
|
++testIndex;
|
|
|
|
} else {
|
|
|
|
endTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function runTests() {
|
|
|
|
try {
|
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
|
|
|
netscape.security.PrivilegeManager.enablePrivilege(
|
|
|
|
'UniversalPreferencesRead UniversalPreferencesWrite UniversalXPConnect');
|
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
2011-01-26 21:18:15 +00:00
|
|
|
try {
|
|
|
|
caretBlinkTime = prefs.getIntPref("ui.caretBlinkTime");
|
|
|
|
} catch (e) {}
|
2010-02-09 16:09:59 +00:00
|
|
|
prefs.setIntPref("ui.caretBlinkTime", -1);
|
|
|
|
|
|
|
|
nextTest();
|
|
|
|
} catch(e) {
|
|
|
|
endTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body onload="runTests()">
|
|
|
|
</body>
|
|
|
|
</html>
|