summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_displayport_expiry.html
blob: 023786a2708b16462c82d14f01bb3bdf6a9a06a1 (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
70
71
72
73
74
75
76
77
<!DOCTYPE html>
<html>
<head>
  <title>Test for DisplayPort Expiry</title>
  <meta charset="utf-8">
  <script src="apz_test_utils.js"></script>
  <script src="/tests/SimpleTest/EventUtils.js"></script>
  <script src="/tests/SimpleTest/paint_listener.js"></script>
<style>
#first {
  height: 40vh;
  width: 100%;
  background: green;
  overflow: scroll;
}

#second {
  height: 40vh;
  width: 100%;
  background: yellow;
  overflow: scroll;
}

#inner {
  height: 20vh;
  width: 50%;
  background: red;
}

.big {
  height: 100vh;
  width: 100vw;
}
</style>
</head>
<body>
  <div id="first">
    <div class="big">
    </div>
  </div>
  <br>
  <div id="second">
    <div id="inner">
      <div class="big">
      </div>
    </div>
    <div class="big">
    </div>
  </div>
</body>
  <script>
async function test() {
  await promiseFrame();

  let paintCount = 0;
  function countPaints(e) {
    paintCount += 1;
  }

  window.addEventListener("MozAfterPaint", countPaints);

  await SpecialPowers.promiseTimeout(200);

  window.removeEventListener("MozAfterPaint", countPaints);

  info("paint count: " + paintCount);

  ok(paintCount < 5, "Paint count is within the expect range");
}

SimpleTest.waitForExplicitFinish();

waitUntilApzStable()
.then(test)
.then(subtestDone, subtestFailed);
  </script>
</html>