1<html> 2<head> 3<title>Window Test</title> 4<script> 5function setup() { 6 if (location.hostname == 'tests' || location.hostname == 'localhost') 7 return; 8 9 alert('This page can only be run from tests or localhost.'); 10 11 // Disable all elements. 12 var elements = document.getElementById("form").elements; 13 for (var i = 0, element; element = elements[i++]; ) { 14 element.disabled = true; 15 } 16} 17 18function send_message(test, params) { 19 var message = 'WindowTest.' + test; 20 if (typeof params != 'undefined') 21 message += ':' + params; 22 23 // Results in a call to the OnQuery method in window_test.cpp. 24 window.cefQuery({'request' : message}); 25} 26 27function minimize() { 28 send_message('Minimize'); 29} 30 31function maximize() { 32 send_message('Maximize'); 33} 34 35function restore() { 36 minimize(); 37 setTimeout(function() { send_message('Restore'); }, 1000); 38} 39 40function position() { 41 var x = parseInt(document.getElementById('x').value); 42 var y = parseInt(document.getElementById('y').value); 43 var width = parseInt(document.getElementById('width').value); 44 var height = parseInt(document.getElementById('height').value); 45 if (isNaN(x) || isNaN(y) || isNaN(width) || isNaN(height)) 46 alert('Please specify a valid numeric value.'); 47 else 48 send_message('Position', x + ',' + y + ',' + width + ',' + height); 49} 50</script> 51</head> 52<body bgcolor="white" onload="setup()"> 53<form id="form"> 54Click a button to perform the associated window action. 55<br/><input type="button" onclick="minimize();" value="Minimize"> 56<br/><input type="button" onclick="maximize();" value="Maximize"> 57<br/><input type="button" onclick="restore();" value="Restore"> (minimizes and then restores the window as topmost) 58<br/><input type="button" onclick="position();" value="Set Position"> 59X: <input type="text" size="4" id="x" value="200"> 60Y: <input type="text" size="4" id="y" value="100"> 61Width: <input type="text" size="4" id="width" value="800"> 62Height: <input type="text" size="4" id="height" value="600"> 63</form> 64</body> 65</html> 66