Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <!DOCTYPE HTML>
2 <html>
3 <head>
4 <title>Test delivering mouse events to plugins</title>
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
6 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
7 <script type="text/javascript" src="enableTestPlugin.js"></script>
8 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
9 <style>
10 embed { width:200px; height:200px; display:block; }
11 iframe { border:none; }
12 </style>
13 </head>
14 <body>
15 <p id="display"></p>
16 <div id="content" style="display: block">
17 <embed id="p1" type="application/x-test"
18 style="position:absolute; left:300px; top:10px;"></embed>
19 <iframe id="f1" style="position:absolute; left:0; top:250px;"
20 src="data:text/html,<embed id='p2' type='application/x-test' style='position:absolute; left:10px; top:10px'>"></iframe>
21 <embed id="p3" type="application/x-test"
22 style="position:absolute; left:320px; top:250px;
23 outline:5px solid blue;
24 border:solid black; border-width:4px 8px 4px 8px;
25 padding:3px 1px;"></embed>
26 </div>
27 <pre id="test">
28 <script class="testbody" type="text/javascript">
30 function doTest() {
31 var p1 = document.getElementById("p1");
32 synthesizeMouse(p1, 15, 18, { type:"mousedown" });
33 is(p1.getLastMouseX(), 15, "p1 mouse down X");
34 is(p1.getLastMouseY(), 18, "p1 mouse down Y");
35 synthesizeMouse(p1, 15, 38, { type:"mousemove" });
36 is(p1.getLastMouseX(), 15, "p1 mouse move X");
37 is(p1.getLastMouseY(), 38, "p1 mouse move Y");
38 synthesizeMouse(p1, 15, 28, { type:"mouseup" });
39 is(p1.getLastMouseX(), 15, "p1 mouse up X");
40 is(p1.getLastMouseY(), 28, "p1 mouse up Y");
42 var f1 = document.getElementById("f1");
43 var p2 = f1.contentDocument.getElementById("p2");
44 synthesizeMouse(p2, 15, 18, { type:"mousedown" }, f1.contentWindow);
45 is(p2.getLastMouseX(), 15, "p2 mouse down X");
46 is(p2.getLastMouseY(), 18, "p2 mouse down Y");
47 synthesizeMouse(p2, 15, 38, { type:"mousemove" }, f1.contentWindow);
48 is(p2.getLastMouseX(), 15, "p2 mouse move X");
49 is(p2.getLastMouseY(), 38, "p2 mouse move Y");
50 synthesizeMouse(p2, 15, 28, { type:"mouseup" }, f1.contentWindow);
51 is(p2.getLastMouseX(), 15, "p2 mouse up X");
52 is(p2.getLastMouseY(), 28, "p2 mouse up Y");
54 var p3 = document.getElementById("p3");
55 // The synthesized coordinates are relative to the border-box, but the plugin
56 // is at offset (9,7) relative to the border-box
57 synthesizeMouse(p3, 15, 18, { type:"mousedown" });
58 is(p3.getLastMouseX(), 6, "p3 mouse down X");
59 is(p3.getLastMouseY(), 11, "p3 mouse down Y");
60 synthesizeMouse(p3, 15, 38, { type:"mousemove" });
61 is(p3.getLastMouseX(), 6, "p3 mouse move X");
62 is(p3.getLastMouseY(), 31, "p3 mouse move Y");
63 synthesizeMouse(p3, 15, 28, { type:"mouseup" });
64 is(p3.getLastMouseX(), 6, "p3 mouse up X");
65 is(p3.getLastMouseY(), 21, "p3 mouse up Y");
67 SimpleTest.finish();
68 }
69 // Need to run 'doTest' after painting is unsuppressed, or we'll set clip
70 // regions to empty.
71 addLoadEvent(function() { setTimeout(doTest, 1000); } );
72 SimpleTest.waitForExplicitFinish();
74 </script>
75 </pre>
76 </body>
77 </html>