summaryrefslogtreecommitdiffstats
path: root/dom/events/test/window_bug659071.html
blob: 5fb2efed46c5bd382a4bd470d6de7b40149de7aa (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>
  <title>Test for Bug 659071</title>
  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<video id="v" controls></video>
<script type="application/javascript">

SimpleTest.waitForFocus(startTests, window);
SimpleTest.requestFlakyTimeout("untriaged");

function is()
{
  window.opener.is.apply(window.opener, arguments);
}

function isnot()
{
  window.opener.isnot.apply(window.opener, arguments);
}

function hitEventLoop(aFunc, aTimes)
{
  if (--aTimes) {
    setTimeout(hitEventLoop, 0, aFunc, aTimes);
  } else {
    setTimeout(aFunc, 20);
  }
}

function startTests() {
  SpecialPowers.pushPrefEnv({"set": [["mousewheel.with_control.action", 3]]}, runTests);
}

function runTests()
{
  synthesizeKey("0", { accelKey: true });

  var video = document.getElementById("v");
  hitEventLoop(function () {
    is(SpecialPowers.getFullZoom(window), 1.0,
       "failed to reset zoom");
    synthesizeWheel(video, 10, 10,
      { deltaMode: WheelEvent.DOM_DELTA_LINE, ctrlKey: true,
        deltaX: 0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: 1 });
    hitEventLoop(function () {
      isnot(SpecialPowers.getFullZoom(window), 1.0,
             "failed to zoom by ctrl+wheel");

      synthesizeWheel(video, 10, 10,
        { deltaMode: WheelEvent.DOM_DELTA_LINE, ctrlKey: true,
          deltaX: 0, deltaY: 1.0, lineOrPageDeltaX: 0, lineOrPageDeltaY: -1 });
      hitEventLoop(function () {
        is(SpecialPowers.getFullZoom(window), 1.0,
           "failed to reset zoom");

        hitEventLoop(window.opener.finish, 20);
      }, 20);
    }, 20);
  }, 20);
}

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