|
1 <!DOCTYPE html> |
|
2 <html> |
|
3 <head> |
|
4 <title>Test whether windowless plugins receive correct visible/invisible notifications.</title> |
|
5 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <script type="text/javascript" src="utils.js"></script> |
|
7 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> |
|
8 |
|
9 <style type="text/css"> |
|
10 body { |
|
11 height: 10000px; |
|
12 } |
|
13 </style> |
|
14 |
|
15 <body onload="startTest()"> |
|
16 <p id="display"></p> |
|
17 |
|
18 <script type="application/javascript;version=1.8"> |
|
19 SimpleTest.waitForExplicitFinish(); |
|
20 setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); |
|
21 |
|
22 var p = null; |
|
23 |
|
24 function startTest() { |
|
25 p = document.getElementById('theplugin'); |
|
26 |
|
27 // Wait for the plugin to have painted once |
|
28 var interval = setInterval(function() { |
|
29 if (!p.getPaintCount()) |
|
30 return; |
|
31 |
|
32 clearInterval(interval); |
|
33 doScroll(); |
|
34 }, 100); |
|
35 } |
|
36 |
|
37 const kScrollAmount = 1000; |
|
38 var startY; |
|
39 |
|
40 function doScroll() { |
|
41 let [x, y, w, h] = p.getWindowPosition(); |
|
42 startY = y; |
|
43 |
|
44 scrollBy(0, kScrollAmount); |
|
45 setTimeout(checkScroll, 500); |
|
46 } |
|
47 |
|
48 function checkScroll() { |
|
49 let [x, y, w, h] = p.getWindowPosition(); |
|
50 |
|
51 is(y, startY - kScrollAmount, "Window should be informed of its new position."); |
|
52 SimpleTest.finish(); |
|
53 } |
|
54 </script> |
|
55 |
|
56 <embed id="theplugin" type="application/x-test" width="200" height="200"></embed> |