Fri, 16 Jan 2015 18:13:44 +0100
Integrate suggestion from review to improve consistency with existing code.
1 <?xml version="1.0"?>
2 <?xml-stylesheet href="chrome://global/skin" type="text/css"?>
4 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
5 type="text/css"?>
7 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9 <script type="application/javascript"
10 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
11 <script type="application/javascript"
12 src="chrome://mochikit/content/chrome-harness.js"/>
14 <script type="application/javascript"
15 src="../common.js" />
16 <script type="application/javascript"
17 src="../role.js" />
18 <script type="application/javascript"
19 src="../states.js" />
20 <script type="application/javascript"
21 src="../events.js" />
22 <script type="application/javascript"
23 src="../browser.js"></script>
25 <script type="application/javascript">
26 <![CDATA[
28 ////////////////////////////////////////////////////////////////////////////
29 // Tests
31 function getAnchorJumpInTabDocument(aTabIdx)
32 {
33 var tabDoc = aTabIdx ? tabDocumentAt(aTabIdx) : currentTabDocument();
34 return tabDoc.querySelector("a[name='link1']");
35 }
37 function loadTab(aURL)
38 {
39 this.eventSeq = [
40 new asyncInvokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, currentTabDocument),
41 new asyncInvokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument)
42 ];
44 this.invoke = function loadTab_invoke()
45 {
46 tabBrowser().loadURI(aURL);
47 }
49 this.getID = function loadTab_getID()
50 {
51 return "load tab: " + aURL;
52 }
53 }
55 function loadTabInBackground(aURL)
56 {
57 this.eventSeq = [
58 new invokerChecker(EVENT_DOCUMENT_LOAD_COMPLETE, tabDocumentAt, 1)
59 ];
61 this.unexpectedEventSeq = [
62 new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument, 1)
63 ];
65 this.invoke = function loadTabInBackground_invoke()
66 {
67 tabBrowser().loadOneTab(aURL, null, "", null, true);
68 }
70 this.getID = function loadTabInBackground_getID()
71 {
72 return "load tab in background: " + aURL;
73 }
74 }
76 function switchToBackgroundTab()
77 {
78 this.eventSeq = [
79 new invokerChecker(EVENT_SCROLLING_START, getAnchorJumpInTabDocument)
80 ];
82 this.invoke = function switchToBackgroundTab_invoke()
83 {
84 tabBrowser().selectTabAtIndex(1);
85 }
87 this.getID = function switchToBackgroundTab_getID()
88 {
89 return "switch to background tab";
90 }
91 }
93 //gA11yEventDumpToConsole = true; // debug stuff
95 var gQueue = null;
96 function doTest()
97 {
98 gQueue = new eventQueue();
100 var url = "http://mochi.test:8888/a11y/accessible/tests/mochitest/events/scroll.html#link1";
101 gQueue.push(new loadTab(url));
102 gQueue.push(new loadTabInBackground(url));
103 gQueue.push(new switchToBackgroundTab());
104 gQueue.onFinish = function() { closeBrowserWindow(); }
106 gQueue.invoke(); // Will call SimpleTest.finish();
107 }
109 SimpleTest.waitForExplicitFinish();
110 openBrowserWindow(doTest);
111 ]]>
112 </script>
114 <vbox flex="1" style="overflow: auto;">
115 <body xmlns="http://www.w3.org/1999/xhtml">
116 <a target="_blank"
117 href="https://bugzilla.mozilla.org/show_bug.cgi?id=691734"
118 title="Make sure scrolling start event is fired when document receive focus">
119 Mozilla Bug 691734
120 </a>
122 <p id="display"></p>
123 <div id="content" style="display: none">
124 </div>
125 <pre id="test">
126 </pre>
127 </body>
129 <vbox id="eventdump"></vbox>
130 </vbox>
131 </window>