gfx/layers/apz/test/mochitest/test_group_touchevents-4.html
author Jan Henning <jh+bugzilla@buttercookie.de>
Sat, 12 Jan 2019 18:34:54 +0000
changeset 453639 81378c45a359
parent 453580 80aa2eb75893
child 456165 c194c666f232
permissions -rw-r--r--
Bug 1517976 - Test that resetting WindowUtils.isFirstPaint doesn't clobber APZ scroll position. r=botond We need to setup a case where the visual viewport is smaller than the layout viewport. Faking a pinch zoom through touch events is imprecise, whereas calling windowUtils.setResolutionAndScaleTo(value > 1) to simulate the equivalent effect of a pinch-zoom on the page led to the subsequent scroll attempt failing quite often even after calling waitForApzFlushedRepaints(). So instead, we set up a very wide layout viewport through the meta viewport tag, which on Desktop means additionally enabling the dom.meta-viewport.enabled pref. Differential Revision: https://phabricator.services.mozilla.com/D15791

<!DOCTYPE HTML>
<html>
<head>
  <meta charset="utf-8">
  <title>Various touch tests that spawn in new windows (4)</title>
  <script type="application/javascript" 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 basic_pan_prefs = getPrefs("TOUCH_EVENTS:PAN");

var subtests = [
  // clicking on element with :active::after CSS property
  {"file": "helper_bug1473108.html"},
  // Resetting isFirstPaint shouldn't clobber the visual viewport
  {"file": "helper_bug1509575.html", "prefs": [...basic_pan_prefs, ["dom.meta-viewport.enabled", true]]},
  // Add new subtests here. If this starts timing out because it's taking too
  // long, create a test_group_touchevents-5.html file. Refer to 1423011#c57
  // for more details.
];

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.finish);
  };
}

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