2010-02-09 08:09:59 -08:00
|
|
|
<!DOCTYPE HTML>
|
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<title>Reftests with caret drawing</title>
|
2011-06-29 11:22:39 -07:00
|
|
|
<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-26 21:26:33 -08:00
|
|
|
<style>
|
|
|
|
iframe {
|
|
|
|
width: 600px;
|
|
|
|
height: 600px;
|
|
|
|
}
|
|
|
|
</style>
|
2010-02-09 08:09:59 -08:00
|
|
|
<script type="text/javascript">
|
|
|
|
|
2012-01-13 16:09:39 -08:00
|
|
|
SimpleTest.waitForExplicitFinish();
|
|
|
|
|
2010-02-09 08:09:59 -08:00
|
|
|
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)
|
|
|
|
};
|
|
|
|
|
2011-02-10 13:23:09 -08:00
|
|
|
const MAX_ITERATIONS = 1000;
|
2010-08-23 20:49:15 -07:00
|
|
|
|
2010-02-09 08:09:59 -08:00
|
|
|
function createIframe(url,next) {
|
|
|
|
var iframe = document.createElement("iframe");
|
|
|
|
iframe.src = url;
|
|
|
|
iframe.remotePageLoaded = remotePageLoaded;
|
|
|
|
var me = this;
|
2010-08-23 20:49:15 -07: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");
|
2012-01-13 16:09:39 -08:00
|
|
|
endTest();
|
2010-08-23 20:49:15 -07:00
|
|
|
} else {
|
|
|
|
setTimeout(iframeLoadCompleted, 10);
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
iframe.remotePageLoaded();
|
|
|
|
if (next) setTimeout(function(){createIframe(next,null);}, 0)
|
|
|
|
}
|
|
|
|
iframe.addEventListener("load", iframeLoadCompleted, false);
|
2010-02-09 08:09:59 -08:00
|
|
|
window.document.body.appendChild(iframe);
|
|
|
|
};
|
|
|
|
|
|
|
|
function refTest(test,ref) {
|
|
|
|
createIframe(test,ref);
|
|
|
|
};
|
|
|
|
|
2011-01-26 13:18:15 -08:00
|
|
|
var caretBlinkTime = null;
|
2010-02-09 08:09:59 -08:00
|
|
|
function endTest() {
|
2011-12-30 09:35:38 -08:00
|
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
2010-02-09 08:09:59 -08:00
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
2011-01-26 13:18:15 -08:00
|
|
|
if (caretBlinkTime !== null) {
|
|
|
|
prefs.setIntPref("ui.caretBlinkTime", caretBlinkTime);
|
|
|
|
} else {
|
|
|
|
prefs.clearUserPref("ui.caretBlinkTime");
|
|
|
|
}
|
2012-01-13 16:09:39 -08:00
|
|
|
|
|
|
|
// finish(), yet let the test actually end first, to be safe.
|
|
|
|
SimpleTest.executeSoon(SimpleTest.finish);
|
2010-02-09 08:09:59 -08:00
|
|
|
}
|
|
|
|
|
2011-08-24 08:04:16 -07:00
|
|
|
var isWindows = /WINNT/.test(SpecialPowers.OS);
|
|
|
|
|
2010-02-09 08:09:59 -08:00
|
|
|
var tests = [
|
2010-10-27 14:56:50 -07:00
|
|
|
[ 'bug389321-2.html' , 'bug389321-2-ref.html' ] ,
|
|
|
|
[ 'bug389321-3.html' , 'bug389321-3-ref.html' ] ,
|
2010-02-09 08:09:59 -08:00
|
|
|
[ 'bug482484.html' , 'bug482484-ref.html' ] ,
|
2010-09-24 12:10:53 -07:00
|
|
|
[ 'bug585922.html' , 'bug585922-ref.html' ] ,
|
2011-02-10 13:23:09 -08:00
|
|
|
[ 'bug632215-1.html' , 'bug632215-ref.html' ] ,
|
2011-02-14 22:11:18 -08:00
|
|
|
[ 'bug632215-2.html' , 'bug632215-ref.html' ] ,
|
2011-03-28 17:17:16 -07:00
|
|
|
[ 'bug633044-1.html' , 'bug633044-1-ref.html' ] ,
|
2011-04-08 00:35:49 -07:00
|
|
|
[ 'bug644428-1.html' , 'bug644428-1-ref.html' ] ,
|
2010-02-09 08:09:59 -08:00
|
|
|
];
|
2011-08-24 08:04:16 -07:00
|
|
|
|
|
|
|
if (!isWindows) {
|
2011-09-07 21:55:37 -07:00
|
|
|
tests.push([ 'bug106855-1.html' , 'bug106855-1-ref.html' ]); // bug 682837
|
2011-08-24 08:04:16 -07:00
|
|
|
tests.push([ 'bug106855-2.html' , 'bug106855-1-ref.html' ]); // bug 681138
|
|
|
|
tests.push([ 'bug240933-1.html' , 'bug240933-1-ref.html' ]); // bug 681144
|
|
|
|
tests.push([ 'bug240933-2.html' , 'bug240933-1-ref.html' ]); // bug 681162
|
2011-09-30 21:46:46 -07:00
|
|
|
tests.push([ 'bug389321-1.html' , 'bug389321-1-ref.html' ]); // bug 683163
|
2011-08-24 08:04:16 -07:00
|
|
|
tests.push([ 'bug512295-1.html' , 'bug512295-1-ref.html' ]); // bug 681152
|
|
|
|
tests.push([ 'bug512295-2.html' , 'bug512295-2-ref.html' ]); // bug 681331
|
|
|
|
tests.push([ 'bug597519-1.html' , 'bug597519-1-ref.html' ]); // bug 680579
|
|
|
|
tests.push([ 'bug602141-1.html' , 'bug602141-1-ref.html' ]); // bug 681334
|
2011-09-07 21:55:37 -07:00
|
|
|
tests.push([ 'bug602141-2.html' , 'bug602141-2-ref.html' ]); // bug 682836
|
2011-11-30 00:24:59 -08:00
|
|
|
tests.push([ 'bug602141-3.html' , 'bug602141-3-ref.html' ]); // bug 683048
|
2011-08-24 08:04:16 -07:00
|
|
|
tests.push([ 'bug602141-4.html' , 'bug602141-4-ref.html' ]); // bug 681167
|
|
|
|
tests.push([ 'bug612271-1.html' , 'bug612271-ref.html' ]); // bug 681032
|
|
|
|
tests.push([ 'bug612271-2.html' , 'bug612271-ref.html' ]); // bug 680581
|
|
|
|
tests.push([ 'bug612271-3.html' , 'bug612271-ref.html' ]); // bug 681035
|
|
|
|
tests.push([ 'bug613433-1.html' , 'bug613433-ref.html' ]); // bug 681332
|
2011-09-07 21:55:37 -07:00
|
|
|
tests.push([ 'bug613433-2.html' , 'bug613433-ref.html' ]); // bug 681332
|
|
|
|
tests.push([ 'bug613433-3.html' , 'bug613433-ref.html' ]); // bug 681332
|
2011-08-24 08:04:16 -07:00
|
|
|
tests.push([ 'bug613807-1.html' , 'bug613807-1-ref.html' ]); // bug 680574
|
|
|
|
tests.push([ 'bug634406-1.html' , 'bug634406-1-ref.html' ]); // bug 681146
|
2012-04-20 09:57:17 -07:00
|
|
|
tests.push([ 'bug746993-1.html' , 'bug746993-1-ref.html' ]); // bug 746993
|
2011-08-24 08:04:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
tests.push(function() {SpecialPowers.setBoolPref("bidi.browser.ui", true);});
|
|
|
|
|
|
|
|
if (!isWindows) {
|
|
|
|
tests.push([ 'bug646382-1.html' , 'bug646382-1-ref.html' ]); // bug 681076
|
|
|
|
tests.push([ 'bug646382-2.html' , 'bug646382-2-ref.html' ]); // bug 680577
|
|
|
|
tests.push([ 'bug664087-1.html' , 'bug664087-1-ref.html' ]); // bug 681038
|
|
|
|
tests.push([ 'bug664087-2.html' , 'bug664087-2-ref.html' ]); // bug 680578
|
2011-11-18 13:47:40 -08:00
|
|
|
tests.push([ 'bug682712-1.html' , 'bug682712-1-ref.html' ]); // disabled on Windows
|
2011-08-24 08:04:16 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
tests.push(function() {SpecialPowers.clearUserPref("bidi.browser.ui");});
|
|
|
|
|
2010-02-09 08:09:59 -08:00
|
|
|
var testIndex = 0;
|
|
|
|
|
|
|
|
function nextTest() {
|
|
|
|
if (testIndex < tests.length) {
|
2011-04-08 00:35:49 -07:00
|
|
|
if (typeof(tests[testIndex]) == 'function') {
|
|
|
|
tests[testIndex]();
|
|
|
|
SimpleTest.executeSoon(nextTest);
|
|
|
|
} else {
|
|
|
|
refTest(tests[testIndex][0],tests[testIndex][1]);
|
|
|
|
}
|
2010-02-09 08:09:59 -08:00
|
|
|
++testIndex;
|
|
|
|
} else {
|
|
|
|
endTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
function runTests() {
|
|
|
|
try {
|
2011-12-30 09:35:38 -08:00
|
|
|
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
2010-02-09 08:09:59 -08:00
|
|
|
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
|
|
|
.getService(Components.interfaces.nsIPrefBranch);
|
2011-01-26 13:18:15 -08:00
|
|
|
try {
|
|
|
|
caretBlinkTime = prefs.getIntPref("ui.caretBlinkTime");
|
|
|
|
} catch (e) {}
|
2010-02-09 08:09:59 -08:00
|
|
|
prefs.setIntPref("ui.caretBlinkTime", -1);
|
|
|
|
|
|
|
|
nextTest();
|
|
|
|
} catch(e) {
|
|
|
|
endTest();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
</script>
|
|
|
|
</head>
|
|
|
|
<body onload="runTests()">
|
|
|
|
</body>
|
|
|
|
</html>
|