OLD | NEW |
(Empty) | |
| 1 <html> |
| 2 <!-- This page is meant to load inside the host browser like IE/FF --> |
| 3 <head><title>Initialize hidden chrome frame</title> |
| 4 <script type="text/javascript" src="chrome_frame_tester_helpers.js"> |
| 5 </script> |
| 6 <script type="text/javascript"> |
| 7 var g_failure_timeout = null; |
| 8 var g_test_id = 1; |
| 9 var g_test_name = 'InitializeHidden'; |
| 10 var g_cf3_loaded = false; |
| 11 |
| 12 function OnNavigationFailed() { |
| 13 onFailure(g_test_name, g_test_id, 'ChromeFrame Navigation failed'); |
| 14 } |
| 15 |
| 16 function OnObjectFocusFailed() { |
| 17 appendStatus('chrome frame focus failed'); |
| 18 onFailure(g_test_name, g_test_id, 'Visibility test failed'); |
| 19 } |
| 20 |
| 21 function OnCF1Loaded() { |
| 22 appendStatus('Chrome frame 1 loaded, not visible yet.'); |
| 23 try { |
| 24 // Make chrome frame visible |
| 25 var cf1 = document.getElementById('CFDiv1'); |
| 26 cf1.style.visibility = 'visible'; |
| 27 appendStatus('Chrome frame 1 visibility - ' + cf1.style.visibility); |
| 28 // Set focus to chrome frame. This should set focus to the |
| 29 // first element inside the frame, which a script inside the |
| 30 // page will detect and notify us back by sending us a message. |
| 31 document.ChromeFrame1.focus(); |
| 32 g_failure_timeout = window.setTimeout(OnObjectFocusFailed, 10000); |
| 33 } catch(e) { |
| 34 appendStatus('Error setting focus to CF1. Error: ' + e.description); |
| 35 onFailure(g_test_name, g_test_id, 'CF1 focus() error'); |
| 36 } |
| 37 } |
| 38 |
| 39 function OnCF1Message(evt) { |
| 40 if (evt.data == 'btnOnFocus') { |
| 41 window.clearTimeout(g_failure_timeout); |
| 42 g_failure_timeout = null; |
| 43 appendStatus('CF1 visible and focused'); |
| 44 |
| 45 // Now make second chrome frame instance visible |
| 46 document.getElementById('CFDiv2').style.display = 'block'; |
| 47 appendStatus('Chrome frame 2 visible, should start loading now'); |
| 48 g_failure_timeout = window.setTimeout(OnObjectFocusFailed, 10000); |
| 49 } |
| 50 } |
| 51 |
| 52 function OnCF2Loaded() { |
| 53 appendStatus('Chrome frame 2 loaded'); |
| 54 try { |
| 55 // Set focus to chrome frame. This should set focus to the |
| 56 // first element inside the frame, which a script inside the |
| 57 // page will detect and notify us back by sending us a message. |
| 58 // We set focus on a timeout as on IE it takes a while for the window |
| 59 // to become visible. |
| 60 setTimeout(SetFocusToCF2, 100); |
| 61 } catch(e) { |
| 62 appendStatus('Error setting focus to CF2. Error: ' + e.description); |
| 63 onFailure(g_test_name, g_test_id, 'CF2 focus() error'); |
| 64 } |
| 65 } |
| 66 |
| 67 function SetFocusToCF2() { |
| 68 document.ChromeFrame2.focus(); |
| 69 } |
| 70 |
| 71 function OnCF2Message(evt) { |
| 72 if (evt.data == 'btnOnFocus') { |
| 73 window.clearTimeout(g_failure_timeout); |
| 74 g_failure_timeout = null; |
| 75 appendStatus('CF2 visible and focused'); |
| 76 onSuccess(g_test_name, g_test_id); |
| 77 } |
| 78 } |
| 79 </script> |
| 80 </head> |
| 81 <body> |
| 82 <div id="CFDiv1" style="visibility: hidden;"> |
| 83 <object id="ChromeFrame1" width="300" height="80" tabindex="0" |
| 84 codebase="http://www.google.com" |
| 85 classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> |
| 86 <param name="src" value="simple_object_focus_cf.html"> |
| 87 <param name="onload" value="OnCF1Loaded();"> |
| 88 <param name="onloaderror" value="OnNavigationFailed();"> |
| 89 <param name="onmessage" value="OnCF1Message(arguments[0]);"> |
| 90 <embed width="300" height="80" name="ChromeFrame1" |
| 91 type="application/chromeframe" |
| 92 src="simple_object_focus_cf.html" |
| 93 onload="OnCF1Loaded();" |
| 94 onloaderror="OnNavigationFailed();" |
| 95 onmessage="OnCF1Message(arguments[0]);"> |
| 96 </embed> |
| 97 </object> |
| 98 </div> |
| 99 <div id="CFDiv2" style="display: none;"> |
| 100 <object id="ChromeFrame2" width="300" height="80" tabindex="1" |
| 101 codebase="http://www.google.com" |
| 102 classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> |
| 103 <param name="src" value="simple_object_focus_cf.html"> |
| 104 <param name="onload" value="OnCF2Loaded();"> |
| 105 <param name="onloaderror" value="OnNavigationFailed();"> |
| 106 <param name="onmessage" value="OnCF2Message(arguments[0]);"> |
| 107 <embed width="300" height="80" name="ChromeFrame2" |
| 108 type="application/chromeframe" |
| 109 src="simple_object_focus_cf.html" |
| 110 onload="OnCF2Loaded();" |
| 111 onloaderror="OnNavigationFailed();" |
| 112 onmessage="OnCF2Message(arguments[0]);"> |
| 113 </embed> |
| 114 </object> |
| 115 </div> |
| 116 <div id="statusPanel" style="border: 1px solid red; width: 100%"> |
| 117 Test running.... |
| 118 </div> |
| 119 </body> |
| 120 </html> |
OLD | NEW |