1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/accessible/tests/mochitest/events/test_scroll.xul Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,131 @@ 1.4 +<?xml version="1.0"?> 1.5 +<?xml-stylesheet href="chrome://global/skin" type="text/css"?> 1.6 + 1.7 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" 1.8 + type="text/css"?> 1.9 + 1.10 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"> 1.11 + 1.12 + <script type="application/javascript" 1.13 + src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" /> 1.14 + <script type="application/javascript" 1.15 + src="chrome://mochikit/content/chrome-harness.js"/> 1.16 + 1.17 + <script type="application/javascript" 1.18 + src="../common.js" /> 1.19 + <script type="application/javascript" 1.20 + src="../role.js" /> 1.21 + <script type="application/javascript" 1.22 + src="../states.js" /> 1.23 + <script type="application/javascript" 1.24 + src="../events.js" /> 1.25 + <script type="application/javascript" 1.26 + src="../browser.js"></script> 1.27 + 1.28 + <script type="application/javascript"> 1.29 + <![CDATA[ 1.30 + 1.31 + //////////////////////////////////////////////////////////////////////////// 1.32 + // Tests 1.33 + 1.34 + function getAnchorJumpInTabDocument(aTabIdx) 1.35 + { 1.36 + var tabDoc = aTabIdx ? tabDocumentAt(aTabIdx) : currentTabDocument(); 1.37 + return tabDoc.querySelector("a[name='link1']"); 1.38 + } 1.39 + 1.40 + function loadTab(aURL) 1.41 + { 1.42 + this.eventSeq = [ 1.43 + new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument), 1.44 + new asyncInvokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument) 1.45 + ]; 1.46 + 1.47 + this.invoke = function loadTab_invoke() 1.48 + { 1.49 + tabBrowser().loadURI(aURL); 1.50 + } 1.51 + 1.52 + this.getID = function loadTab_getID() 1.53 + { 1.54 + return "load tab: " + aURL; 1.55 + } 1.56 + } 1.57 + 1.58 + function loadTabInBackground(aURL) 1.59 + { 1.60 + this.eventSeq = [ 1.61 + new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1) 1.62 + ]; 1.63 + 1.64 + this.unexpectedEventSeq = [ 1.65 + new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument, 1) 1.66 + ]; 1.67 + 1.68 + this.invoke = function loadTabInBackground_invoke() 1.69 + { 1.70 + tabBrowser().loadOneTab(aURL, null, "", null, true); 1.71 + } 1.72 + 1.73 + this.getID = function loadTabInBackground_getID() 1.74 + { 1.75 + return "load tab in background: " + aURL; 1.76 + } 1.77 + } 1.78 + 1.79 + function switchToBackgroundTab() 1.80 + { 1.81 + this.eventSeq = [ 1.82 + new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument) 1.83 + ]; 1.84 + 1.85 + this.invoke = function switchToBackgroundTab_invoke() 1.86 + { 1.87 + tabBrowser().selectTabAtIndex(1); 1.88 + } 1.89 + 1.90 + this.getID = function switchToBackgroundTab_getID() 1.91 + { 1.92 + return "switch to background tab"; 1.93 + } 1.94 + } 1.95 + 1.96 + //gA11yEventDumpToConsole = true; // debug stuff 1.97 + 1.98 + var gQueue = null; 1.99 + function doTest() 1.100 + { 1.101 + gQueue = new eventQueue(); 1.102 + 1.103 + var url = "http://mochi.test:8888/a11y/accessible/tests/mochitest/events/scroll.html#link1"; 1.104 + gQueue.push(new loadTab(url)); 1.105 + gQueue.push(new loadTabInBackground(url)); 1.106 + gQueue.push(new switchToBackgroundTab()); 1.107 + gQueue.onFinish = function() { closeBrowserWindow(); } 1.108 + 1.109 + gQueue.invoke(); // Will call SimpleTest.finish(); 1.110 + } 1.111 + 1.112 + SimpleTest.waitForExplicitFinish(); 1.113 + openBrowserWindow(doTest); 1.114 + ]]> 1.115 + </script> 1.116 + 1.117 + <vbox flex="1" style="overflow: auto;"> 1.118 + <body xmlns="http://www.w3.org/1999/xhtml"> 1.119 + <a target="_blank" 1.120 + href="https://bugzilla.mozilla.org/show_bug.cgi?id=691734" 1.121 + title="Make sure scrolling start event is fired when document receive focus"> 1.122 + Mozilla Bug 691734 1.123 + </a> 1.124 + 1.125 + <p id="display"></p> 1.126 + <div id="content" style="display: none"> 1.127 + </div> 1.128 + <pre id="test"> 1.129 + </pre> 1.130 + </body> 1.131 + 1.132 + <vbox id="eventdump"></vbox> 1.133 + </vbox> 1.134 +</window>