4 <meta charset=
"utf-8" />
5 <title>Mouse Button Back/Forward
</title>
6 <link rel=
"author" title=
"Google" href=
"http://www.google.com/" />
7 <script src=
"/resources/testharness.js"></script>
8 <script src=
"/resources/testharnessreport.js"></script>
9 <script src=
"/resources/testdriver.js"></script>
10 <script src=
"/resources/testdriver-actions.js"></script>
11 <script src=
"/resources/testdriver-vendor.js"></script>
13 var testMouseUp
= async_test('Tests that when pointer is locked, the mouseup is preventable.');
14 var received_back
= false;
15 var received_forward
= false;
16 const left_button
= 0;
17 const back_button
= 3;
18 const forward_button
= 4;
19 window
.addEventListener('mouseup', function(e
) {
20 if (e
.button
== left_button
) {
21 document
.body
.requestPointerLock();
22 } else if (e
.button
== back_button
) {
25 } else if (e
.button
== forward_button
) {
26 received_forward
= true;
29 if (document
.pointerLockElement
&& received_back
&& received_forward
) {
31 document
.exitPointerLock();
35 document
.addEventListener("pointerlockchange", function() {
36 assert_equals(document
.pointerLockElement
, document
.body
);
39 var actions
= new test_driver
.Actions();
40 actions
.pointerMove(1, 1)
41 .pointerDown({button
: actions
.ButtonType
.BACK
})
42 .pointerUp({button
: actions
.ButtonType
.BACK
})
43 .pointerDown({button
: actions
.ButtonType
.FORWARD
})
44 .pointerUp({button
: actions
.ButtonType
.FORWARD
})
48 document
.addEventListener("pointerlockerror", function() {
49 assert_unreached("Pointer lock error");
53 var actions
= new test_driver
.Actions();
54 actions
.pointerMove(1, 1)
55 .pointerDown({button
: actions
.ButtonType
.LEFT
})
56 .pointerUp({button
: actions
.ButtonType
.LEFT
})
62 <h4>Test Description: Tests that the mouseup event is prevented.
64 <li>Click the left mouse button to lock pointer
</li>
65 <li>Click the back mouse button
</li>
66 <li>Click the forward mouse button
</li>