image/test/mochitest/test_bug89419-1.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/image/test/mochitest/test_bug89419-1.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,68 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=89419
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 89419</title>
    1.11 +  <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <script type="application/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
    1.14 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.15 +</head>
    1.16 +<body>
    1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=89419">Mozilla Bug 89419</a>
    1.18 +<p id="display"></p>
    1.19 +<pre id="test">
    1.20 +<script type="application/javascript">
    1.21 +
    1.22 +var first, second, third;
    1.23 +var correct, val1, val2;
    1.24 +
    1.25 +SimpleTest.waitForExplicitFinish();
    1.26 +
    1.27 +function checkFirst()
    1.28 +{
    1.29 +  var iframeelem = document.getElementById('test-iframe');
    1.30 +  first = snapshotWindow(iframeelem.contentWindow, false);
    1.31 +
    1.32 +  iframeelem.onload = checkSecond;
    1.33 +  iframeelem.contentWindow.location.reload(false);
    1.34 +}
    1.35 +
    1.36 +function checkSecond()
    1.37 +{
    1.38 +  var iframeelem = document.getElementById('test-iframe');
    1.39 +  second = snapshotWindow(iframeelem.contentWindow, false);
    1.40 +
    1.41 +  // Check that we actually reloaded.
    1.42 +  [correct, val1, val2] = compareSnapshots(first, second, false);
    1.43 +  ok(correct, "Image should have changed after the first reload.");
    1.44 +
    1.45 +  iframeelem.onload = checkThird;
    1.46 +  iframeelem.contentWindow.location.reload(false);
    1.47 +}
    1.48 +
    1.49 +function checkThird()
    1.50 +{
    1.51 +  var iframeelem = document.getElementById('test-iframe');
    1.52 +  third = snapshotWindow(iframeelem.contentWindow, false);
    1.53 +
    1.54 +  // Check that we actually reloaded.
    1.55 +  [correct, val1, val2] = compareSnapshots(second, third, false);
    1.56 +  ok(correct, "Image should have changed after the second reload.");
    1.57 +
    1.58 +  // Make sure we looped back to the first image.
    1.59 +  [correct, val1, val2] = compareSnapshots(first, third, true);
    1.60 +  ok(correct, "Third image should match first image.");
    1.61 +
    1.62 +  SimpleTest.finish();
    1.63 +}
    1.64 +
    1.65 +</script>
    1.66 +</pre>
    1.67 +<div id="content"> <!-- style="display: none" -->
    1.68 +<iframe id="test-iframe" src="bug89419-iframe.html" onload="checkFirst()"></iframe>
    1.69 +</div>
    1.70 +</body>
    1.71 +</html>

mercurial