Roll src/third_party/WebKit bf18a82:a9cee16 (svn 185297:185304)
[chromium-blink-merge.git] / chrome / test / chromedriver / js / dispatch_context_menu_event_test.html
blob94c95974a0dc959bf737ea65f618a6db5c36e031
1 <!DOCTYPE HTML>
2 <html>
3 <script src='test.js'></script>
4 <script src='dispatch_context_menu_event.js'></script>
5 <script>
7 function testContextMenuEvent() {
8 var elem = document.querySelector('div');
9 var capturedEvent = null;
10 elem.addEventListener('contextmenu', function(e) { capturedEvent = e});
11 var x = elem.offsetLeft + 1;
12 var y = elem.offsetTop + 1;
13 dispatchContextMenuEvent(x, y, ModifierMask.CTRL | ModifierMask.SHIFT);
14 assert(capturedEvent != null);
15 assertEquals(x, capturedEvent.x);
16 assertEquals(y, capturedEvent.y);
17 assertEquals('contextmenu', capturedEvent.type);
18 assertEquals(2, capturedEvent.button);
19 assertEquals(true, capturedEvent.ctrlKey);
20 assertEquals(true, capturedEvent.shiftKey);
21 assertEquals(false, capturedEvent.altKey);
22 assertEquals(false, capturedEvent.metaKey);
25 function testCannotDispatchEventAtBadLocation() {
26 try {
27 dispatchContextMenuEvent(-1, -1, 0);
28 assert(false);
29 } catch (e) {
33 </script>
34 <body>
35 <div>DIV</div>
36 </body>
37 </html>