1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/dom/browser-element/mochitest/priority/test_Background.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,55 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +Test that calling setVisible('false') on an iframe causes its visibility to 1.8 +change. 1.9 +--> 1.10 +<head> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="application/javascript" src="../browserElementTestHelpers.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 +</head> 1.15 +<body> 1.16 + 1.17 +<script type="application/javascript;version=1.7"> 1.18 +"use strict"; 1.19 + 1.20 +SimpleTest.waitForExplicitFinish(); 1.21 +browserElementTestHelpers.setEnabledPref(true); 1.22 +browserElementTestHelpers.addPermission(); 1.23 +browserElementTestHelpers.enableProcessPriorityManager(); 1.24 + 1.25 +function runTest() { 1.26 + var iframe = document.createElement('iframe'); 1.27 + iframe.setAttribute('mozbrowser', true); 1.28 + 1.29 + iframe.src = browserElementTestHelpers.emptyPage1; 1.30 + 1.31 + var childID = null; 1.32 + expectOnlyOneProcessCreated().then(function(chid) { 1.33 + childID = chid; 1.34 + }).then(function() { 1.35 + return expectPriorityChange(childID, 'FOREGROUND'); 1.36 + }).then(function() { 1.37 + return expectMozbrowserEvent(iframe, 'loadend'); 1.38 + }).then(function() { 1.39 + var p = expectPriorityChange(childID, 'BACKGROUND'); 1.40 + 1.41 + // We wait until mozbrowserloadend before calling setVisible, because 1.42 + // setVisible isn't available until mozbrowser has loaded. In practice, that 1.43 + // means we can call setVisible once we've gotten /any/ mozbrowser event. 1.44 + iframe.setVisible(false); 1.45 + return p; 1.46 + }).then(function() { 1.47 + var p = expectPriorityChange(childID, 'FOREGROUND'); 1.48 + iframe.setVisible(true); 1.49 + }).then(SimpleTest.finish); 1.50 + 1.51 + document.body.appendChild(iframe); 1.52 +} 1.53 + 1.54 +addEventListener('testready', runTest); 1.55 + 1.56 +</script> 1.57 +</body> 1.58 +</html>