browser_gestureSupport.js
Go to the documentation of this file.
1 /* ***** BEGIN LICENSE BLOCK *****
2  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
3  *
4  * The contents of this file are subject to the Mozilla Public License Version
5  * 1.1 (the "License"); you may not use this file except in compliance with
6  * the License. You may obtain a copy of the License at
7  * http://www.mozilla.org/MPL/
8  *
9  * Software distributed under the License is distributed on an "AS IS" basis,
10  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
11  * for the specific language governing rights and limitations under the
12  * License.
13  *
14  * The Original Code is Firefox Gesture Support Test Code
15  *
16  * The Initial Developer of the Original Code is
17  * Thomas K. Dyas <tdyas@zecador.org>
18  * Portions created by the Initial Developer are Copyright (C) 2008
19  * the Initial Developer. All Rights Reserved.
20  *
21  * Contributor(s):
22  * Edward Lee <edward.lee@engineering.uiuc.edu>
23  *
24  * Alternatively, the contents of this file may be used under the terms of
25  * either the GNU General Public License Version 2 or later (the "GPL"), or
26  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
27  * in which case the provisions of the GPL or the LGPL are applicable instead
28  * of those above. If you wish to allow use of your version of this file only
29  * under the terms of either the GPL or the LGPL, and not to allow others to
30  * use your version of this file under the terms of the MPL, indicate your
31  * decision by deleting the provisions above and replace them with the notice
32  * and other provisions required by the GPL or the LGPL. If you do not delete
33  * the provisions above, a recipient may use your version of this file under
34  * the terms of any one of the MPL, the GPL or the LGPL.
35  *
36  * ***** END LICENSE BLOCK ***** */
37 
38 // Simple gestures tests
39 //
40 // These tests require the ability to disable the fact that the
41 // Firefox chrome intentionally prevents "simple gesture" events from
42 // reaching web content.
43 
46 let test_prefBranch = "browser.gesture.";
47 
48 function test()
49 {
50  // Disable the default gestures support during the test
51  gGestureSupport.init(false);
52 
53  // Enable privileges so we can use nsIDOMWindowUtils interface
54  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
55  test_utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
56  getInterface(Components.interfaces.nsIDOMWindowUtils);
57 
58  // Run the tests of "simple gesture" events generally
62 
63  // Reenable the default gestures support. The remaining tests target
64  // the Firefox gesture functionality.
65  gGestureSupport.init(true);
66 
67  // Test Firefox's gestures support.
68  test_commandset = document.getElementById("mainCommandSet");
70  test_latchedGesture("pinch", "out", "in", "MozMagnifyGesture");
71  test_latchedGesture("twist", "right", "left", "MozRotateGesture");
72  test_thresholdGesture("pinch", "out", "in", "MozMagnifyGesture");
73  test_thresholdGesture("twist", "right", "left", "MozRotateGesture");
74 }
75 
81 
82 function test_gestureListener(evt)
83 {
84  is(evt.type, test_expectedType,
85  "evt.type (" + evt.type + ") does not match expected value");
86  is(evt.target, test_utils.elementFromPoint(20, 20, false, false),
87  "evt.target (" + evt.target + ") does not match expected value");
88  is(evt.clientX, 20,
89  "evt.clientX (" + evt.clientX + ") does not match expected value");
90  is(evt.clientY, 20,
91  "evt.clientY (" + evt.clientY + ") does not match expected value");
92  isnot(evt.screenX, 0,
93  "evt.screenX (" + evt.screenX + ") does not match expected value");
94  isnot(evt.screenY, 0,
95  "evt.screenY (" + evt.screenY + ") does not match expected value");
96 
97  is(evt.direction, test_expectedDirection,
98  "evt.direction (" + evt.direction + ") does not match expected value");
99  is(evt.delta, test_expectedDelta,
100  "evt.delta (" + evt.delta + ") does not match expected value");
101 
102  is(evt.shiftKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.SHIFT_MASK) != 0,
103  "evt.shiftKey did not match expected value");
104  is(evt.ctrlKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.CONTROL_MASK) != 0,
105  "evt.ctrlKey did not match expected value");
106  is(evt.altKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.ALT_MASK) != 0,
107  "evt.altKey did not match expected value");
108  is(evt.metaKey, (test_expectedModifiers & Components.interfaces.nsIDOMNSEvent.META_MASK) != 0,
109  "evt.metaKey did not match expected value");
110 
111  test_eventCount++;
112 }
113 
114 function test_helper1(type, direction, delta, modifiers)
115 {
116  // Setup the expected values
117  test_expectedType = type;
118  test_expectedDirection = direction;
119  test_expectedDelta = delta;
120  test_expectedModifiers = modifiers;
121 
122  let expectedEventCount = test_eventCount + 1;
123 
124  document.addEventListener(type, test_gestureListener, true);
125  test_utils.sendSimpleGestureEvent(type, 20, 20, direction, delta, modifiers);
126  document.removeEventListener(type, test_gestureListener, true);
127 
128  is(expectedEventCount, test_eventCount, "Event (" + type + ") was never received by event listener");
129 }
130 
132 {
133  let e = test_helper1; // easier to type this name
134 
135  // Swipe gesture event
136  e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_LEFT, 0.0, 0);
137  e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0.0, 0);
138  e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_UP, 0.0, 0);
139  e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_DOWN, 0.0, 0);
140  e("MozSwipeGesture",
141  SimpleGestureEvent.DIRECTION_UP | SimpleGestureEvent.DIRECTION_LEFT, 0.0, 0);
142  e("MozSwipeGesture",
143  SimpleGestureEvent.DIRECTION_DOWN | SimpleGestureEvent.DIRECTION_RIGHT, 0.0, 0);
144  e("MozSwipeGesture",
145  SimpleGestureEvent.DIRECTION_UP | SimpleGestureEvent.DIRECTION_RIGHT, 0.0, 0);
146  e("MozSwipeGesture",
147  SimpleGestureEvent.DIRECTION_DOWN | SimpleGestureEvent.DIRECTION_LEFT, 0.0, 0);
148 
149  // magnify gesture events
150  e("MozMagnifyGestureStart", 0, 50.0, 0);
151  e("MozMagnifyGestureUpdate", 0, -25.0, 0);
152  e("MozMagnifyGestureUpdate", 0, 5.0, 0);
153  e("MozMagnifyGesture", 0, 30.0, 0);
154 
155  // rotate gesture events
156  e("MozRotateGestureStart", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
157  e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE, -13.0, 0);
158  e("MozRotateGestureUpdate", SimpleGestureEvent.ROTATION_CLOCKWISE, 13.0, 0);
159  e("MozRotateGesture", SimpleGestureEvent.ROTATION_CLOCKWISE, 33.0, 0);
160 
161  // Tap and presstap gesture events
162  e("MozTapGesture", 0, 0.0, 0);
163  e("MozPressTapGesture", 0, 0.0, 0);
164 
165  // event.shiftKey
166  let modifier = Components.interfaces.nsIDOMNSEvent.SHIFT_MASK;
167  e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
168 
169  // event.metaKey
170  modifier = Components.interfaces.nsIDOMNSEvent.META_MASK;
171  e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
172 
173  // event.altKey
174  modifier = Components.interfaces.nsIDOMNSEvent.ALT_MASK;
175  e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
176 
177  // event.ctrlKey
178  modifier = Components.interfaces.nsIDOMNSEvent.CONTROL_MASK;
179  e("MozSwipeGesture", SimpleGestureEvent.DIRECTION_RIGHT, 0, modifier);
180 }
181 
183 {
184  test_eventCount++;
185  evt.stopPropagation();
186 }
187 
188 function test_helper2(type, direction, delta, altKey, ctrlKey, shiftKey, metaKey)
189 {
190  let event = null;
191  let successful;
192 
193  try {
194  event = document.createEvent("SimpleGestureEvent");
195  successful = true;
196  }
197  catch (ex) {
198  successful = false;
199  }
200  ok(successful, "Unable to create SimpleGestureEvent");
201 
202  try {
203  event.initSimpleGestureEvent(type, true, true, window, 1,
204  10, 10, 10, 10,
205  ctrlKey, altKey, shiftKey, metaKey,
206  1, window,
207  direction, delta);
208  successful = true;
209  }
210  catch (ex) {
211  successful = false;
212  }
213  ok(successful, "event.initSimpleGestureEvent should not fail");
214 
215  // Make sure the event fields match the expected values
216  is(event.type, type, "Mismatch on evt.type");
217  is(event.direction, direction, "Mismatch on evt.direction");
218  is(event.delta, delta, "Mismatch on evt.delta");
219  is(event.altKey, altKey, "Mismatch on evt.altKey");
220  is(event.ctrlKey, ctrlKey, "Mismatch on evt.ctrlKey");
221  is(event.shiftKey, shiftKey, "Mismatch on evt.shiftKey");
222  is(event.metaKey, metaKey, "Mismatch on evt.metaKey");
223  is(event.view, window, "Mismatch on evt.view");
224  is(event.detail, 1, "Mismatch on evt.detail");
225  is(event.clientX, 10, "Mismatch on evt.clientX");
226  is(event.clientY, 10, "Mismatch on evt.clientY");
227  is(event.screenX, 10, "Mismatch on evt.screenX");
228  is(event.screenY, 10, "Mismatch on evt.screenY");
229  is(event.button, 1, "Mismatch on evt.button");
230  is(event.relatedTarget, window, "Mismatch on evt.relatedTarget");
231 
232  // Test event dispatch
233  let expectedEventCount = test_eventCount + 1;
234  document.addEventListener(type, test_eventDispatchListener, true);
235  document.dispatchEvent(event);
236  document.removeEventListener(type, test_eventDispatchListener, true);
237  is(expectedEventCount, test_eventCount, "Dispatched event was never received by listener");
238 }
239 
241 {
242  // Event creation
243  test_helper2("MozMagnifyGesture", SimpleGestureEvent.DIRECTION_RIGHT, 20.0,
244  true, false, true, false);
245  test_helper2("MozMagnifyGesture", SimpleGestureEvent.DIRECTION_LEFT, -20.0,
246  false, true, false, true);
247 }
248 
250 {
251  let up = SimpleGestureEvent.DIRECTION_UP;
252  let down = SimpleGestureEvent.DIRECTION_DOWN;
253  let left = SimpleGestureEvent.DIRECTION_LEFT;
254  let right = SimpleGestureEvent.DIRECTION_RIGHT;
255 
256  let clockwise = SimpleGestureEvent.ROTATION_CLOCKWISE;
257  let cclockwise = SimpleGestureEvent.ROTATION_COUNTERCLOCKWISE;
258 
259  ok(up ^ down, "DIRECTION_UP and DIRECTION_DOWN are not bitwise disjoint");
260  ok(up ^ left, "DIRECTION_UP and DIRECTION_LEFT are not bitwise disjoint");
261  ok(up ^ right, "DIRECTION_UP and DIRECTION_RIGHT are not bitwise disjoint");
262  ok(down ^ left, "DIRECTION_DOWN and DIRECTION_LEFT are not bitwise disjoint");
263  ok(down ^ right, "DIRECTION_DOWN and DIRECTION_RIGHT are not bitwise disjoint");
264  ok(left ^ right, "DIRECTION_LEFT and DIRECTION_RIGHT are not bitwise disjoint");
265  ok(clockwise ^ cclockwise, "ROTATION_CLOCKWISE and ROTATION_COUNTERCLOCKWISE are not bitwise disjoint");
266 }
267 
268 // Helper for test of latched event processing. Emits the actual
269 // gesture events to test whether the commands associated with the
270 // gesture will only trigger once for each direction of movement.
271 function test_emitLatchedEvents(eventPrefix, initialDelta, cmd)
272 {
273  let cumulativeDelta = 0;
274  let isIncreasing = initialDelta > 0;
275 
276  let expect = {};
277  // Reset the call counters and initialize expected values
278  for (let dir in cmd)
279  cmd[dir].callCount = expect[dir] = 0;
280 
281  let check = function(aDir, aMsg) ok(cmd[aDir].callCount == expect[aDir], aMsg);
282  let checkBoth = function(aNum, aInc, aDec) {
283  let prefix = "Step " + aNum + ": ";
284  check("inc", prefix + aInc);
285  check("dec", prefix + aDec);
286  };
287 
288  // Send the "Start" event.
289  test_utils.sendSimpleGestureEvent(eventPrefix + "Start", 0, 0, 0, initialDelta, 0);
290  cumulativeDelta += initialDelta;
291  if (isIncreasing) {
292  expect.inc++;
293  checkBoth(1, "Increasing command was not triggered", "Decreasing command was triggered");
294  } else {
295  expect.dec++;
296  checkBoth(1, "Increasing command was triggered", "Decreasing command was not triggered");
297  }
298 
299  // Send random values in the same direction and ensure neither
300  // command triggers.
301  for (let i = 0; i < 5; i++) {
302  let delta = Math.random() * (isIncreasing ? 100 : -100);
303  test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, delta, 0);
304  cumulativeDelta += delta;
305  checkBoth(2, "Increasing command was triggered", "Decreasing command was triggered");
306  }
307 
308  // Now go back in the opposite direction.
309  test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0,
310  - initialDelta, 0);
311  cumulativeDelta += - initialDelta;
312  if (isIncreasing) {
313  expect.dec++;
314  checkBoth(3, "Increasing command was triggered", "Decreasing command was not triggered");
315  } else {
316  expect.inc++;
317  checkBoth(3, "Increasing command was not triggered", "Decreasing command was triggered");
318  }
319 
320  // Send random values in the opposite direction and ensure neither
321  // command triggers.
322  for (let i = 0; i < 5; i++) {
323  let delta = Math.random() * (isIncreasing ? -100 : 100);
324  test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, delta, 0);
325  cumulativeDelta += delta;
326  checkBoth(4, "Increasing command was triggered", "Decreasing command was triggered");
327  }
328 
329  // Go back to the original direction. The original command should trigger.
330  test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0,
331  initialDelta, 0);
332  cumulativeDelta += initialDelta;
333  if (isIncreasing) {
334  expect.inc++;
335  checkBoth(5, "Increasing command was not triggered", "Decreasing command was triggered");
336  } else {
337  expect.dec++;
338  checkBoth(5, "Increasing command was triggered", "Decreasing command was not triggered");
339  }
340 
341  // Send the wrap-up event. No commands should be triggered.
342  test_utils.sendSimpleGestureEvent(eventPrefix, 0, 0, 0, cumulativeDelta, 0);
343  checkBoth(6, "Increasing command was triggered", "Decreasing command was triggered");
344 }
345 
346 function test_addCommand(prefName, id)
347 {
348  let cmd = test_commandset.appendChild(document.createElement("command"));
349  cmd.setAttribute("id", id);
350  cmd.setAttribute("oncommand", "this.callCount++;");
351 
352  cmd.origPrefName = prefName;
353  cmd.origPrefValue = gPrefService.getCharPref(prefName);
354  gPrefService.setCharPref(prefName, id);
355 
356  return cmd;
357 }
358 
359 function test_removeCommand(cmd)
360 {
361  gPrefService.setCharPref(cmd.origPrefName, cmd.origPrefValue);
362  test_commandset.removeChild(cmd);
363 }
364 
365 // Test whether latched events are only called once per direction of motion.
366 function test_latchedGesture(gesture, inc, dec, eventPrefix)
367 {
368  let branch = test_prefBranch + gesture + ".";
369 
370  // Put the gesture into latched mode.
371  let oldLatchedValue = gPrefService.getBoolPref(branch + "latched");
372  gPrefService.setBoolPref(branch + "latched", true);
373 
374  // Install the test commands for increasing and decreasing motion.
375  let cmd = {
376  inc: test_addCommand(branch + inc, "test:incMotion"),
377  dec: test_addCommand(branch + dec, "test:decMotion"),
378  };
379 
380  // Test the gestures in each direction.
381  test_emitLatchedEvents(eventPrefix, 500, cmd);
382  test_emitLatchedEvents(eventPrefix, -500, cmd);
383 
384  // Restore the gesture to its original configuration.
385  gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
386  for (dir in cmd)
387  test_removeCommand(cmd[dir]);
388 }
389 
390 // Test whether non-latched events are triggered upon sufficient motion.
391 function test_thresholdGesture(gesture, inc, dec, eventPrefix)
392 {
393  let branch = test_prefBranch + gesture + ".";
394 
395  // Disable latched mode for this gesture.
396  let oldLatchedValue = gPrefService.getBoolPref(branch + "latched");
397  gPrefService.setBoolPref(branch + "latched", false);
398 
399  // Set the triggering threshold value to 50.
400  let oldThresholdValue = gPrefService.getIntPref(branch + "threshold");
401  gPrefService.setIntPref(branch + "threshold", 50);
402 
403  // Install the test commands for increasing and decreasing motion.
404  let cmdInc = test_addCommand(branch + inc, "test:incMotion");
405  let cmdDec = test_addCommand(branch + dec, "test:decMotion");
406 
407  // Send the start event but stop short of triggering threshold.
408  cmdInc.callCount = cmdDec.callCount = 0;
409  test_utils.sendSimpleGestureEvent(eventPrefix + "Start", 0, 0, 0, 49.5, 0);
410  ok(cmdInc.callCount == 0, "Increasing command was triggered");
411  ok(cmdDec.callCount == 0, "Decreasing command was triggered");
412 
413  // Now trigger the threshold.
414  cmdInc.callCount = cmdDec.callCount = 0;
415  test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, 1, 0);
416  ok(cmdInc.callCount == 1, "Increasing command was not triggered");
417  ok(cmdDec.callCount == 0, "Decreasing command was triggered");
418 
419  // The tracking counter should go to zero. Go back the other way and
420  // stop short of triggering the threshold.
421  cmdInc.callCount = cmdDec.callCount = 0;
422  test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, -49.5, 0);
423  ok(cmdInc.callCount == 0, "Increasing command was triggered");
424  ok(cmdDec.callCount == 0, "Decreasing command was triggered");
425 
426  // Now cross the threshold and trigger the decreasing command.
427  cmdInc.callCount = cmdDec.callCount = 0;
428  test_utils.sendSimpleGestureEvent(eventPrefix + "Update", 0, 0, 0, -1.5, 0);
429  ok(cmdInc.callCount == 0, "Increasing command was triggered");
430  ok(cmdDec.callCount == 1, "Decreasing command was not triggered");
431 
432  // Send the wrap-up event. No commands should trigger.
433  cmdInc.callCount = cmdDec.callCount = 0;
434  test_utils.sendSimpleGestureEvent(eventPrefix, 0, 0, 0, -0.5, 0);
435  ok(cmdInc.callCount == 0, "Increasing command was triggered");
436  ok(cmdDec.callCount == 0, "Decreasing command was triggered");
437 
438  // Restore the gesture to its original configuration.
439  gPrefService.setBoolPref(branch + "latched", oldLatchedValue);
440  gPrefService.setIntPref(branch + "threshold", oldThresholdValue);
441  test_removeCommand(cmdInc);
442  test_removeCommand(cmdDec);
443 }
444 
446 {
447  // easier to type names for the direction constants
448  let up = SimpleGestureEvent.DIRECTION_UP;
449  let down = SimpleGestureEvent.DIRECTION_DOWN;
450  let left = SimpleGestureEvent.DIRECTION_LEFT;
451  let right = SimpleGestureEvent.DIRECTION_RIGHT;
452 
453  let branch = test_prefBranch + "swipe.";
454 
455  // Install the test commands for the swipe gestures.
456  let cmdUp = test_addCommand(branch + "up", "test:swipeUp");
457  let cmdDown = test_addCommand(branch + "down", "test:swipeDown");
458  let cmdLeft = test_addCommand(branch + "left", "test:swipeLeft");
459  let cmdRight = test_addCommand(branch + "right", "test:swipeRight");
460 
461  function resetCounts() {
462  cmdUp.callCount = 0;
463  cmdDown.callCount = 0;
464  cmdLeft.callCount = 0;
465  cmdRight.callCount = 0;
466  }
467 
468  // UP
469  resetCounts();
470  test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, up, 0, 0);
471  ok(cmdUp.callCount == 1, "Step 1: Up command was not triggered");
472  ok(cmdDown.callCount == 0, "Step 1: Down command was triggered");
473  ok(cmdLeft.callCount == 0, "Step 1: Left command was triggered");
474  ok(cmdRight.callCount == 0, "Step 1: Right command was triggered");
475 
476  // DOWN
477  resetCounts();
478  test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, down, 0, 0);
479  ok(cmdUp.callCount == 0, "Step 2: Up command was triggered");
480  ok(cmdDown.callCount == 1, "Step 2: Down command was not triggered");
481  ok(cmdLeft.callCount == 0, "Step 2: Left command was triggered");
482  ok(cmdRight.callCount == 0, "Step 2: Right command was triggered");
483 
484  // LEFT
485  resetCounts();
486  test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, left, 0, 0);
487  ok(cmdUp.callCount == 0, "Step 3: Up command was triggered");
488  ok(cmdDown.callCount == 0, "Step 3: Down command was triggered");
489  ok(cmdLeft.callCount == 1, "Step 3: Left command was not triggered");
490  ok(cmdRight.callCount == 0, "Step 3: Right command was triggered");
491 
492  // RIGHT
493  resetCounts();
494  test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, right, 0, 0);
495  ok(cmdUp.callCount == 0, "Step 4: Up command was triggered");
496  ok(cmdDown.callCount == 0, "Step 4: Down command was triggered");
497  ok(cmdLeft.callCount == 0, "Step 4: Left command was triggered");
498  ok(cmdRight.callCount == 1, "Step 4: Right command was not triggered");
499 
500  // Make sure combinations do not trigger events.
501  let combos = [ up | left, up | right, down | left, down | right];
502  for (let i = 0; i < combos.length; i++) {
503  resetCounts();
504  test_utils.sendSimpleGestureEvent("MozSwipeGesture", 0, 0, combos[i], 0, 0);
505  ok(cmdUp.callCount == 0, "Step 5-"+i+": Up command was triggered");
506  ok(cmdDown.callCount == 0, "Step 5-"+i+": Down command was triggered");
507  ok(cmdLeft.callCount == 0, "Step 5-"+i+": Left command was triggered");
508  ok(cmdRight.callCount == 0, "Step 5-"+i+": Right command was triggered");
509  }
510 
511  // Remove the test commands.
512  test_removeCommand(cmdUp);
513  test_removeCommand(cmdDown);
514  test_removeCommand(cmdLeft);
515  test_removeCommand(cmdRight);
516 }
let test_prefBranch
function test_EnsureConstantsAreDisjoint()
let test_utils
function test_removeCommand(cmd)
function test()
let test_eventCount
function test_gestureListener(evt)
var event
let test_expectedDirection
function right(ele) rect(ele).right
let test_expectedType
function test_swipeGestures()
function test_thresholdGesture(gesture, inc, dec, eventPrefix)
function test_helper2(type, direction, delta, altKey, ctrlKey, shiftKey, metaKey)
let test_expectedDelta
let window
function test_eventDispatchListener(evt)
function test_TestEventListeners()
function test_TestEventCreation()
return e ctrlKey(chr<' '||!chars||chars.indexOf(chr)>-1)
let test_expectedModifiers
function test_latchedGesture(gesture, inc, dec, eventPrefix)
return null
Definition: FeedWriter.js:1143
function check(ch, cx)
function test_helper1(type, direction, delta, modifiers)
var gPrefService
Definition: overlay.js:34
let gGestureSupport
Definition: browser.js:675
let test_commandset
_getSelectedPageStyle s i
function test_addCommand(prefName, id)
function test_emitLatchedEvents(eventPrefix, initialDelta, cmd)