1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/plugins/test/mochitest/test_positioning.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,56 @@ 1.4 +<!DOCTYPE html> 1.5 +<html> 1.6 +<head> 1.7 + <title>Test whether windowless plugins receive correct visible/invisible notifications.</title> 1.8 + <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="utils.js"></script> 1.10 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> 1.11 + 1.12 + <style type="text/css"> 1.13 + body { 1.14 + height: 10000px; 1.15 + } 1.16 + </style> 1.17 + 1.18 +<body onload="startTest()"> 1.19 + <p id="display"></p> 1.20 + 1.21 + <script type="application/javascript;version=1.8"> 1.22 + SimpleTest.waitForExplicitFinish(); 1.23 + setTestPluginEnabledState(SpecialPowers.Ci.nsIPluginTag.STATE_ENABLED); 1.24 + 1.25 + var p = null; 1.26 + 1.27 + function startTest() { 1.28 + p = document.getElementById('theplugin'); 1.29 + 1.30 + // Wait for the plugin to have painted once 1.31 + var interval = setInterval(function() { 1.32 + if (!p.getPaintCount()) 1.33 + return; 1.34 + 1.35 + clearInterval(interval); 1.36 + doScroll(); 1.37 + }, 100); 1.38 + } 1.39 + 1.40 + const kScrollAmount = 1000; 1.41 + var startY; 1.42 + 1.43 + function doScroll() { 1.44 + let [x, y, w, h] = p.getWindowPosition(); 1.45 + startY = y; 1.46 + 1.47 + scrollBy(0, kScrollAmount); 1.48 + setTimeout(checkScroll, 500); 1.49 + } 1.50 + 1.51 + function checkScroll() { 1.52 + let [x, y, w, h] = p.getWindowPosition(); 1.53 + 1.54 + is(y, startY - kScrollAmount, "Window should be informed of its new position."); 1.55 + SimpleTest.finish(); 1.56 + } 1.57 + </script> 1.58 + 1.59 + <embed id="theplugin" type="application/x-test" width="200" height="200"></embed>