summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/test_group_touchevents-2.html
blob: decd615795eae91e178e55ff357cf21d0886e92e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Various touch tests that spawn in new windows (2)</title>
  <script src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
  <script type="application/javascript" src="apz_test_utils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  <script type="application/javascript">

var isWindows = getPlatform() == "windows";

const shared_prefs = [
  ["apz.test.fails_with_native_injection", isWindows],
  ["dom.w3c_touch_events.legacy_apis.enabled", true],
];

var subtests = [
  // Taps on media elements to make sure the touchend event is delivered
  // properly. We increase the long-tap timeout to ensure it doesn't get trip
  // during the tap.
  // Also this test (on Windows) cannot satisfy the OS requirement of providing
  // an injected touch event every 100ms, because it waits for a paint between
  // the touchstart and the touchend, so we have to use the "fake injection"
  // code instead.
  {"file": "helper_bug1162771.html", "prefs": [...shared_prefs,
                                               ["ui.click_hold_context_menus.delay", 10000]]},

  // As with the previous test, this test cannot inject touch events every 100ms
  // because it waits for a long-tap, so we have to use the "fake injection" code
  // instead.
  // This test also disables synthesized mousemoves from reflow so it can make
  // more precise assertions about the order in which events arrive.
  {"file": "helper_long_tap.html", "prefs": [...shared_prefs,
                                             ["layout.reflow.synthMouseMove", false]]},

  // For the following tests, we want to make sure APZ doesn't wait for a content
  // response that is never going to arrive. To detect this we set the content response
  // timeout to a day, so that the entire test times out and fails if APZ does
  // end up waiting.
  {"file": "helper_tap_passive.html", "prefs": [...shared_prefs,
                                                ["apz.content_response_timeout", 24 * 60 * 60 * 1000]]},

  {"file": "helper_tap_default_passive.html", "prefs": [...shared_prefs,
                                                        ["apz.content_response_timeout", 24 * 60 * 60 * 1000]]},

  // Add new subtests to test_group_touch_events-4.html, not this file.
];

if (isApzEnabled()) {
  ok(window.TouchEvent, "Check if TouchEvent is supported (it should be, the test harness forces it on everywhere)");
  if (getPlatform() == "android") {
    // This has a lot of subtests, and Android emulators are slow.
    SimpleTest.requestLongerTimeout(2);
  }

  SimpleTest.waitForExplicitFinish();
  window.onload = function() {
    runSubtestsSeriallyInFreshWindows(subtests)
    .then(SimpleTest.finish, SimpleTest.finishWithFailure);
  };
}

  </script>
</head>
<body>
</body>
</html>