зеркало из https://github.com/mozilla/gecko-dev.git
Bug 368994. move more tests. r=bzbarsky
This commit is contained in:
Родитель
dbbfb28407
Коммит
5d42df0c63
|
@ -46,6 +46,9 @@ include $(topsrcdir)/config/rules.mk
|
|||
|
||||
_TEST_FILES = test_bug5141.html \
|
||||
test_bug51034.html \
|
||||
test_bug218236.html \
|
||||
test_bug218277.html \
|
||||
test_bug238409.html \
|
||||
test_bug276037-1.html \
|
||||
test_bug276037-2.xhtml \
|
||||
test_bug357450.js \
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=218236
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 218236</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=218236">Mozilla Bug 218236</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 218236 **/
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
/* Test data */
|
||||
|
||||
var url_200 = window.location.href;
|
||||
var url_404 = url_200.replace(/[^/]+$/, "this_file_is_not_going_to_be_there.dummy");
|
||||
var url_connection_error = url_200.replace(/^(\w+:\/\/[^/]+?)(:\d+)?\//, "$1:9546/");
|
||||
|
||||
// List of tests: name of the test, URL to be requested, expected sequence
|
||||
// of events and optionally a function to be called from readystatechange handler.
|
||||
// Numbers in the list of events are values of XMLHttpRequest.readyState
|
||||
// when readystatechange event is triggered.
|
||||
var tests = [
|
||||
["200 OK", url_200, [1, 2, 3, 4, "load"], null],
|
||||
["404 Not Found", url_404, [1, 2, 3, 4, "load"], null],
|
||||
["connection error", url_connection_error, [1, 2, 4, "error"], null],
|
||||
["abort() call on readyState = 1", url_200, [1, 4], doAbort1],
|
||||
["abort() call on readyState = 2", url_200, [1, 2, 4], doAbort2],
|
||||
];
|
||||
|
||||
var testName = null;
|
||||
var currentState = 0;
|
||||
var currentSequence = null;
|
||||
var expectedSequence = null;
|
||||
var currentCallback = null;
|
||||
|
||||
var request = null;
|
||||
|
||||
runNextTest();
|
||||
|
||||
function doAbort1() {
|
||||
if (request.readyState == 1)
|
||||
request.abort();
|
||||
}
|
||||
function doAbort2() {
|
||||
if (request.readyState == 2)
|
||||
request.abort();
|
||||
}
|
||||
|
||||
/* Utility functions */
|
||||
|
||||
function runNextTest() {
|
||||
if (tests.length > 0) {
|
||||
var test = tests.shift();
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
// Prepare request object
|
||||
request = new XMLHttpRequest();
|
||||
request.open("GET", test[1]);
|
||||
request.onreadystatechange = onReadyStateChange;
|
||||
request.onload = onLoad;
|
||||
request.onerror = onError;
|
||||
|
||||
// Initialize state variables
|
||||
testName = test[0]
|
||||
currentState = 0;
|
||||
currentSequence = [];
|
||||
expectedSequence = test[2];
|
||||
currentCallback = test[3];
|
||||
|
||||
// Start request
|
||||
request.send(null);
|
||||
}
|
||||
else
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
function finalizeTest() {
|
||||
ok(compareArrays(expectedSequence, currentSequence), "event sequence for '" + testName + "' should be " + expectedSequence.join(", "));
|
||||
|
||||
runNextTest();
|
||||
}
|
||||
|
||||
function onReadyStateChange() {
|
||||
// Ignore duplicated calls for the same ready state
|
||||
if (request.readyState != currentState) {
|
||||
currentState = request.readyState;
|
||||
currentSequence.push(currentState);
|
||||
}
|
||||
|
||||
if (currentState == 4) {
|
||||
// Allow remaining event to fire but then we are finished with this test
|
||||
setTimeout(finalizeTest, 0);
|
||||
}
|
||||
|
||||
if (currentCallback)
|
||||
currentCallback();
|
||||
}
|
||||
|
||||
function onLoad() {
|
||||
currentSequence.push("load");
|
||||
}
|
||||
|
||||
function onError() {
|
||||
currentSequence.push("error");
|
||||
}
|
||||
|
||||
function compareArrays(array1, array2) {
|
||||
if (array1.length != array2.length)
|
||||
return false;
|
||||
|
||||
for (var i = 0; i < array1.length; i++)
|
||||
if (array1[i] != array2[i])
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=218277
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 218277</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=218277">Mozilla Bug 218277</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: block">
|
||||
<input id="ctrl" name="ctrl" size="20" value="keep together" readonly />
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 218277 **/
|
||||
|
||||
is(escape($('ctrl').value), "keep%A0together", "nbsp preserved in form submissions");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=238409
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 238409</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=238409">Mozilla Bug 238409</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<table id="table_spacing0" cellspacing="0">
|
||||
<tr><td>cellspacing="0"</td></tr>
|
||||
</table>
|
||||
|
||||
<table id="table_spacing2" cellspacing="2">
|
||||
<tr><td>cellspacing="2"</td></tr>
|
||||
</table>
|
||||
|
||||
<table id="table_spacingNone">
|
||||
<tr><td>no cellspacing</td></tr>
|
||||
</table>
|
||||
|
||||
<table id="table_spacingMalformed" cellspacing>
|
||||
<tr><td>malformed cellspacing</td></tr>
|
||||
</table>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 238409 **/
|
||||
|
||||
ok(document.getElementById("table_spacing0").cellSpacing == "0", "parsing table with cellspacing='0'");
|
||||
ok(document.getElementById("table_spacing2").cellSpacing == "2", "parsing table with cellspacing='2'");
|
||||
ok(document.getElementById("table_spacingNone").cellSpacing == "", "parsing table without cellspacing");
|
||||
ok(document.getElementById("table_spacingMalformed").cellSpacing == "", "parsing table with malformed cellspacing");
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -59,6 +59,10 @@ _TEST_FILES = test_bug589.html \
|
|||
bug100533_load.html \
|
||||
bug100533_iframe.html \
|
||||
test_bug100533.html \
|
||||
test_bug237071.html \
|
||||
bug277724_iframe1.html \
|
||||
bug277724_iframe2.xhtml \
|
||||
test_bug277724.html \
|
||||
test_bug300691-1.html \
|
||||
test_bug300691-2.html \
|
||||
test_bug300691-3.xhtml \
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!-- Use an unload handler to prevent bfcache from messing with us -->
|
||||
<body onunload="parent.childUnloaded = true;">
|
||||
<select id="select">
|
||||
<option>aaa</option>
|
||||
<option>bbbb</option>
|
||||
</select>
|
||||
|
||||
<textarea id="textarea">
|
||||
</textarea>
|
||||
|
||||
<input type="text" id="text">
|
||||
<input type="password" id="password">
|
||||
<input type="checkbox" id="checkbox">
|
||||
<input type="radio" id="radio">
|
||||
<input type="image" id="image">
|
||||
<input type="submit" id="submit">
|
||||
<input type="reset" id="reset">
|
||||
<input type="button" id="button input">
|
||||
<input type="hidden" id="hidden">
|
||||
<input type="file" id="file">
|
||||
|
||||
<button type="submit" id="submit button"></button>
|
||||
<button type="reset" id="reset button"></button>
|
||||
<button type="button" id="button"></button>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,27 @@
|
|||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
<!-- Use an unload handler to prevent bfcache from messing with us -->
|
||||
<body onunload="parent.childUnloaded = true;">
|
||||
<select id="select">
|
||||
<option>aaa</option>
|
||||
<option>bbbb</option>
|
||||
</select>
|
||||
|
||||
<textarea id="textarea">
|
||||
</textarea>
|
||||
|
||||
<input type="text" id="text" />
|
||||
<input type="password" id="password" />
|
||||
<input type="checkbox" id="checkbox" />
|
||||
<input type="radio" id="radio" />
|
||||
<input type="image" id="image" />
|
||||
<input type="submit" id="submit" />
|
||||
<input type="reset" id="reset" />
|
||||
<input type="button" id="button input" />
|
||||
<input type="hidden" id="hidden" />
|
||||
<input type="file" id="file" />
|
||||
|
||||
<button type="submit" id="submit button"></button>
|
||||
<button type="reset" id="reset button"></button>
|
||||
<button type="button" id="button"></button>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=237071
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 237071</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=237071">Mozilla Bug 237071</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" >
|
||||
<ol id="theOL" start="22">
|
||||
<li id="foo" >should be 22</li>
|
||||
<li id="foo23">should be 23</li>
|
||||
</ol>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
/** Test for Bug 237071 **/
|
||||
is($('theOL').start, 22, "OL start attribute mapped to .start, not just text attribute");
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -0,0 +1,138 @@
|
|||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=277724
|
||||
-->
|
||||
<head>
|
||||
<title>Test for Bug 277724</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=277724">Mozilla Bug 277724</a>
|
||||
<p id="display"></p>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 277724 **/
|
||||
|
||||
var childUnloaded = false;
|
||||
|
||||
var nodes = [
|
||||
[ "select", HTMLSelectElement ],
|
||||
[ "textarea", HTMLTextAreaElement ],
|
||||
[ "text", HTMLInputElement ],
|
||||
[ "password", HTMLInputElement ],
|
||||
[ "checkbox", HTMLInputElement ],
|
||||
[ "radio", HTMLInputElement ],
|
||||
[ "image", HTMLInputElement ],
|
||||
[ "submit", HTMLInputElement ],
|
||||
[ "reset", HTMLInputElement ],
|
||||
[ "button input", HTMLInputElement ],
|
||||
[ "hidden", HTMLInputElement ],
|
||||
[ "file", HTMLInputElement ],
|
||||
[ "submit button", HTMLButtonElement ],
|
||||
[ "reset button", HTMLButtonElement ],
|
||||
[ "button", HTMLButtonElement ]
|
||||
];
|
||||
|
||||
function startTest(frameid) {
|
||||
is(childUnloaded, false, "Child not unloaded yet");
|
||||
|
||||
var doc = $(frameid).contentDocument;
|
||||
ok(doc instanceof Document, "Check for doc", "doc should be a document");
|
||||
|
||||
for (var i = 0; i < nodes.length; ++i) {
|
||||
var id = nodes[i][0];
|
||||
var node = doc.getElementById(id);
|
||||
ok(node instanceof nodes[i][1],
|
||||
"Check for " + id, id + " should be a " + nodes[i][1]);
|
||||
is(node.disabled, false, "check for " + id + " state");
|
||||
node.disabled = true;
|
||||
is(node.disabled, true, "check for " + id + " state change");
|
||||
}
|
||||
|
||||
$(frameid).onload = function () { continueTest(frameid) };
|
||||
|
||||
// Do this off a timeout so it's not treated like a replace load.
|
||||
function loadBlank() {
|
||||
$(frameid).contentWindow.location = "about:blank";
|
||||
}
|
||||
setTimeout(loadBlank, 0);
|
||||
}
|
||||
|
||||
function continueTest(frameid) {
|
||||
is(childUnloaded, true, "Unload handler should have fired");
|
||||
var doc = $(frameid).contentDocument;
|
||||
ok(doc instanceof Document, "Check for doc", "doc should be a document");
|
||||
|
||||
for (var i = 0; i < nodes.length; ++i) {
|
||||
var id = nodes[i][0];
|
||||
var node = doc.getElementById(id);
|
||||
ok(node === null,
|
||||
"Check for " + id, id + " should be null");
|
||||
}
|
||||
|
||||
$(frameid).onload = function() { finishTest(frameid) };
|
||||
|
||||
// Do this off a timeout too. Why, I'm not sure. Something in session
|
||||
// history creates another history state if we don't. :(
|
||||
function goBack() {
|
||||
$(frameid).contentWindow.history.back();
|
||||
}
|
||||
setTimeout(goBack, 0);
|
||||
}
|
||||
|
||||
// XXXbz this is a nasty hack to work around the XML content sink not being
|
||||
// incremental, so that the _first_ control we test is ok but others are not.
|
||||
var testIs = is;
|
||||
var once = false;
|
||||
function flipper(a, b, c) {
|
||||
if (once) {
|
||||
todo(a == b, c);
|
||||
} else {
|
||||
once = true;
|
||||
is(a, b, c);
|
||||
}
|
||||
}
|
||||
|
||||
function finishTest(frameid) {
|
||||
var doc = $(frameid).contentDocument;
|
||||
ok(doc instanceof Document, "Check for doc", "doc should be a document");
|
||||
|
||||
for (var i = 0; i < nodes.length; ++i) {
|
||||
var id = nodes[i][0];
|
||||
var node = doc.getElementById(id);
|
||||
ok(node instanceof nodes[i][1],
|
||||
"Check for " + id, id + " should be a " + nodes[i][1]);
|
||||
//testIs(node.disabled, true, "check for " + id + " state restore");
|
||||
}
|
||||
|
||||
if (frameid == "frame2") {
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
childUnloaded = false;
|
||||
|
||||
// XXXbz this is a nasty hack to deal with the content sink. See above.
|
||||
testIs = flipper;
|
||||
|
||||
$("frame2").onload = function () { startTest("frame2") };
|
||||
$("frame2").src = "bug277724_iframe2.xhtml";
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
</script>
|
||||
</pre>
|
||||
|
||||
<!-- Don't use display:none, since we don't support framestate restoration
|
||||
without a frame tree -->
|
||||
<div id="content" style="visibility: hidden">
|
||||
<iframe src="bug277724_iframe1.html" id="frame1"
|
||||
onload="startTest('frame1')"></iframe>
|
||||
<iframe src="" id="frame2"></iframe>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
|
@ -44,12 +44,6 @@ if (!params.quiet) {
|
|||
var RunSet = {}
|
||||
RunSet.runall = function() {
|
||||
TestRunner.runTests(
|
||||
'test_bug172261.html', // Test for content/html/document/src stuff
|
||||
'test_bug218236.html',
|
||||
'test_bug218277.html',
|
||||
'test_bug237071.html',
|
||||
'test_bug238409.html',
|
||||
'test_bug277724.html',
|
||||
'test_bug302186.html',
|
||||
'test_bug308484.html',
|
||||
'test_bug308856.html',
|
||||
|
|
Загрузка…
Ссылка в новой задаче