layout/generic/test/file_bug514732_window.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/layout/generic/test/file_bug514732_window.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,87 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?>
     1.6 +
     1.7 +<window id="514732Test"
     1.8 +        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
     1.9 +        width="600"
    1.10 +        height="600"
    1.11 +        onload="setTimeout(nextTest,0);"
    1.12 +        title="bug 514732 test">
    1.13 +
    1.14 +  <script type="text/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/specialpowersAPI.js"/>
    1.16 +  <script type="text/javascript"
    1.17 +          src="chrome://mochikit/content/tests/SimpleTest/SpecialPowersObserverAPI.js"/>
    1.18 +  <script type="text/javascript"
    1.19 +          src="chrome://mochikit/content/tests/SimpleTest/ChromePowers.js"/>
    1.20 +  <script type="application/javascript"
    1.21 +          src="chrome://mochikit/content/tests/SimpleTest/docshell_helpers.js">
    1.22 +  </script>
    1.23 +
    1.24 +  <script type="application/javascript"><![CDATA[
    1.25 +  
    1.26 +    // Define the generator-iterator for the tests.
    1.27 +    var tests = testIterator();
    1.28 +
    1.29 +    ////
    1.30 +    // Execute the next test in the generator function.
    1.31 +    //
    1.32 +    function nextTest() {
    1.33 +      tests.next();
    1.34 +    }
    1.35 +
    1.36 +    ////
    1.37 +    // Generator function for test steps for bug 514732.  The MozScrolledAreaChanged
    1.38 +    // should be fired when a page is restored from the bfcache as though it had
    1.39 +    // reloaded.
    1.40 +    //
    1.41 +    function testIterator() {
    1.42 +      // Make sure bfcache is on.
    1.43 +      enableBFCache(true);
    1.44 +
    1.45 +        
    1.46 +      // Load a wide and tall page, and then another.
    1.47 +      for (var i = 0; i < 2; ++i) {
    1.48 +        doPageNavigation( {
    1.49 +          uri: "data:text/html,<!DOCTYPE html><html>" + 
    1.50 +               "<head><title>bug 514732 bfcache test page " + i + "</title></head>" +
    1.51 +               "<body>" + 
    1.52 +               '<div style="position: absolute; left: 10000px; top: 10000px; width: 500px; height: 500px;">' +
    1.53 +               "</body></html>",
    1.54 +          eventsToListenFor: ["MozScrolledAreaChanged"],
    1.55 +          expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
    1.56 +          onNavComplete: nextTest
    1.57 +        } );
    1.58 +        yield;
    1.59 +      }
    1.60 +
    1.61 +      // Navigate back to the first page.  Don't test for width and height
    1.62 +      // yet, just make sure we get an event.
    1.63 +      doPageNavigation( {
    1.64 +        back: true,
    1.65 +        eventsToListenFor: ["MozScrolledAreaChanged"],
    1.66 +        expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
    1.67 +        onNavComplete: nextTest
    1.68 +      } );
    1.69 +      yield;
    1.70 +
    1.71 +      // Navigate forth to our wide and tall page, this time testing for
    1.72 +      // width and height on the event.
    1.73 +      doPageNavigation( {
    1.74 +        forward: true,
    1.75 +        eventsToListenFor: ["MozScrolledAreaChanged"],
    1.76 +        expectedEvents: [ { type: "MozScrolledAreaChanged" } ],
    1.77 +        onNavComplete: nextTest
    1.78 +      } );
    1.79 +      yield;
    1.80 +
    1.81 +      // Tell the framework the test is finished.  Include the final 'yield' 
    1.82 +      // statement to prevent a StopIteration exception from being thrown.
    1.83 +      finish();
    1.84 +      yield;
    1.85 +    }
    1.86 +    
    1.87 +  ]]></script>
    1.88 +
    1.89 +  <browser type="content-primary" flex="1" id="content" src="about:blank"/>
    1.90 +</window>

mercurial