bug 514732. Additional tests for bug 514732 followup that fires MozScrolledAreaChanged on restore from bfcache. r=smaug

This commit is contained in:
Roy Frostig 2009-12-17 09:38:00 -08:00
Родитель 7f6a89746e
Коммит 1185d3e9f7
3 изменённых файлов: 134 добавлений и 0 удалений

Просмотреть файл

@ -114,5 +114,13 @@ _TEST_FILES = \
# disabled temporarily
# test_bug488417.html \
_CHROME_FILES = \
test_bug514732-2.xul \
file_bug514732_window.xul \
$(NULL)
libs:: $(_TEST_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
libs:: $(_CHROME_FILES)
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir)

Просмотреть файл

@ -0,0 +1,81 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<window id="514732Test"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
width="600"
height="600"
onload="setTimeout(nextTest,0);"
title="bug 514732 test">
<script type="application/javascript"
src="chrome://mochikit/content/chrome/docshell/test/chrome/docshell_helpers.js">
</script>
<script type="application/javascript"><![CDATA[
// Define the generator-iterator for the tests.
var tests = testIterator();
////
// Execute the next test in the generator function.
//
function nextTest() {
tests.next();
}
////
// Generator function for test steps for bug 514732. The MozScrolledAreaChanged
// should be fired when a page is restored from the bfcache as though it had
// reloaded.
//
function testIterator() {
// Make sure bfcache is on.
enableBFCache(true);
// Load a wide and tall page, and then another.
for (var i = 0; i < 2; ++i) {
doPageNavigation( {
uri: "data:text/html,<!DOCTYPE html><html>" +
"<head><title>bug 514732 bfcache test page " + i + "</title></head>" +
"<body>" +
'<div style="position: absolute; left: 10000px; top: 10000px; width: 500px; height: 500px;">' +
"</body></html>",
eventsToListenFor: ["MozScrolledAreaChanged"],
expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
onNavComplete: nextTest
} );
yield;
}
// Navigate back to the first page. Don't test for width and height
// yet, just make sure we get an event.
doPageNavigation( {
back: true,
eventsToListenFor: ["MozScrolledAreaChanged"],
expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
onNavComplete: nextTest
} );
yield;
// Navigate forth to our wide and tall page, this time testing for
// width and height on the event.
doPageNavigation( {
forward: true,
eventsToListenFor: ["MozScrolledAreaChanged"],
expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
onNavComplete: nextTest
} );
yield;
// Tell the framework the test is finished. Include the final 'yield'
// statement to prevent a StopIteration exception from being thrown.
finish();
yield;
}
]]></script>
<browser type="content-primary" flex="1" id="content" src="about:blank"/>
</window>

Просмотреть файл

@ -0,0 +1,45 @@
<?xml version="1.0"?>
<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
<?xml-stylesheet
href="chrome://mochikit/content/tests/SimpleTest/test.css"
type="text/css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=514732
-->
<window title="Mozilla Bug 514732"
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<title>Test for Bug 514732</title>
<script type="application/javascript"
src="chrome://mochikit/content/MochiKit/packed.js"></script>
<script type="application/javascript"
src=
"chrome://mochikit/content/tests/SimpleTest/SimpleTest.js">
</script>
<body xmlns="http://www.w3.org/1999/xhtml">
<a target="_blank"
href="https://bugzilla.mozilla.org/show_bug.cgi?id=514732">
Mozilla Bug 514732</a>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
</pre>
</body>
<script class="testbody" type="application/javascript">
<![CDATA[
/** Test for Bug 514732 **/
SimpleTest.waitForExplicitFinish();
window.open("file_bug514732_window.xul", "bug514732",
"chrome,width=600,height=600,scrollbars");
]]>
</script>
</window>