| Index: chrome_frame/test/data/chrome_frame_resize.html
|
| ===================================================================
|
| --- chrome_frame/test/data/chrome_frame_resize.html (revision 0)
|
| +++ chrome_frame/test/data/chrome_frame_resize.html (revision 0)
|
| @@ -0,0 +1,138 @@
|
| +<!-- saved from url=(0014)about:internet -->
|
| +<!-- Please preserve the CR/LF at the end of the previous line. -->
|
| +<html>
|
| +<!-- This page is meant to load inside the host browser like IE/FF -->
|
| +<head>
|
| +<script type="text/javascript" src="chrome_frame_tester_helpers.js"></script>
|
| +<script type="text/javascript">
|
| +function onLoad() {
|
| + var chromeFrame = GetChromeFrame();
|
| + chromeFrame.onmessage = OnChromeFrameResize;
|
| + setTimeout(NavigateToURL, 100);
|
| +}
|
| +
|
| +function NavigateToURL() {
|
| + var chromeFrame = GetChromeFrame();
|
| + chromeFrame.src = "chrome_frame_resize_hosted.html";
|
| + setTimeout(CheckIfNavigationFailed, 15000);
|
| +}
|
| +
|
| +var navigation_success = false;
|
| +
|
| +function CheckIfNavigationFailed() {
|
| + if (!navigation_success) {
|
| + onFailure("Resize", 1, "ChromeFrame Navigation failed");
|
| + }
|
| +}
|
| +
|
| +function OnNavigationSucceeded() {
|
| + navigation_success = true;
|
| + appendStatus("ChromeFrame hosted page loaded, beginning test...");
|
| + setTimeout(ResizeChromeFrame, 100);
|
| +}
|
| +
|
| +var resize_step = 0;
|
| +
|
| +function ResizeChromeFrame() {
|
| + var chromeFrame = GetChromeFrame();
|
| +
|
| + if (resize_step == 0) {
|
| + appendStatus("Setting chromeFrame to 100x100");
|
| + resize_step = 1;
|
| + chromeFrame.width = 100;
|
| + setTimeout("OnResizeFailure(0)", 2000);
|
| + } else if (resize_step == 1) {
|
| + resize_step = 2;
|
| + chromeFrame.height = 100;
|
| + setTimeout("OnResizeFailure(1)", 2000);
|
| + } else if (resize_step == 2) {
|
| + appendStatus("Setting chromeFrame to 10x10");
|
| + resize_step = 3;
|
| + chromeFrame.width = 10;
|
| + setTimeout("OnResizeFailure(0)", 2000);
|
| + } else if (resize_step == 3) {
|
| + resize_step = 4;
|
| + chromeFrame.height = 10;
|
| + setTimeout("OnResizeFailure(1)", 2000);
|
| + }
|
| +
|
| + // Note that setting the ChromeFrame window to 0x0 (or < 2x2 if we have the
|
| + // WS_BORDER style defined on our window) currently results
|
| + // in a check failure from the child chrome.exe process.
|
| + // TODO(robertshield): Figure out why and fix it.
|
| +}
|
| +
|
| +var resize_step_received = 0;
|
| +
|
| +function OnChromeFrameResize(evt) {
|
| + resize_step_received++;
|
| + appendStatus("ChromeFrame resized: " + evt.data + "step=" +
|
| + resize_step_received);
|
| +
|
| + if (resize_step == 4) {
|
| + onSuccess("Resize", 1);
|
| + } else {
|
| + setTimeout(ResizeChromeFrame, 100);
|
| + }
|
| +}
|
| +
|
| +function OnResizeFailure(step) {
|
| + // It turns out that the hosted page gets two calls to onresize()
|
| + // every time a single size parameter (i.e. width OR height) is changed.
|
| + // As such this check doesn't quite guarantee success, but if it fails,
|
| + // then we should fail the unit test.
|
| + if (step >= resize_step_received) {
|
| + onFailure("Resize", 1, "Did not receive resize reply back from frame.");
|
| + }
|
| +}
|
| +
|
| +function GetChromeFrame() {
|
| + return window.document.ChromeFrame;
|
| +}
|
| +
|
| +var debug_counter = 0;
|
| +
|
| +function DebugResizeChromeFrame(delta) {
|
| + var chromeFrame = GetChromeFrame();
|
| + var newWidth = chromeFrame.clientWidth + delta;
|
| + var newHeight = chromeFrame.clientHeight + delta;
|
| +
|
| + appendStatus(debug_counter + ". DEBUG resizing CF to (" + newWidth + "," +
|
| + newHeight + ")");
|
| +
|
| + debug_counter++;
|
| +
|
| + chromeFrame.width = newWidth;
|
| + chromeFrame.height = newHeight;
|
| +}
|
| +
|
| +</script>
|
| +</head>
|
| +
|
| +<body onload="onLoad();">
|
| +<div id="description" style="border: 2px solid black; width: 100%">
|
| + Test for resizing the chrome frame control.
|
| +</div>
|
| +<div id="statusPanel" style="border: 1px solid red; width: 100%">
|
| +Test running....
|
| +</div>
|
| +
|
| +<object id="ChromeFrame" codebase="http://www.google.com"
|
| + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"
|
| + style="border: 1px solid blue">
|
| + <param name="onload" value="return OnNavigationSucceeded();" />
|
| + <embed id="ChromeFramePlugin" name="ChromeFrame"
|
| + onload="return OnNavigationSucceeded();"
|
| + type="application/chromeframe"
|
| + style="border: 1px solid green">
|
| + </embed>
|
| +</object>
|
| +<br />
|
| +<br />
|
| +
|
| +<button onclick="javascript:DebugResizeChromeFrame(20);">Bigger</button>
|
| +<button onclick="javascript:DebugResizeChromeFrame(-20);">Smaller</button>
|
| +
|
| +</body>
|
| +</html>
|
| +
|
|
|