Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: chrome_frame/test/data/simple_object_focus.html

Issue 218019: Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 <!-- saved from url=(0014)about:internet -->
2 <html>
3 <!-- This page is meant to load inside the host browser like IE/FF -->
4 <head>
5 <script type="text/javascript" src="chrome_frame_tester_helpers.js"></script>
6 <script type="text/javascript">
7 var g_failure_timeout = null;
8 var g_test_id = 1;
9 var g_test_name = "ObjectFocus";
10
11 function onLoad() {
12 status("onload");
13
14 try {
15 var cf = getCf();
16 cf.onmessage = OnChromeFrameMessage;
17 window.setTimeout(NavigateToURL, 100);
18 } catch(e) {
19 status("error: onload");
20 onFailure(g_test_name, g_test_id, "error in onload");
21 }
22
23 sendOnLoadEvent();
24 }
25
26 function NavigateToURL() {
27 try {
28 status("Navigate to URL");
29 var cf = getCf();
30 cf.src = "simple_object_focus_cf.html";
31 g_failure_timeout = window.setTimeout(OnObjectFocusFailed, 10000);
32 } catch(e) {
33 status("error: NavigateToURL");
34 onFailure(g_test_name, g_test_id, "NavigateToURL error");
35 }
36 }
37
38 function OnObjectFocusFailed() {
39 status("OnNavigationFailed");
40 onFailure(g_test_name, g_test_id, "focus test failed");
41 }
42
43 function OnChromeFrameLoaded() {
44 status("OnChromeFrameLoaded");
45 try {
46 // Set focus to chrome frame. This should set focus to the first element
47 // inside the frame, which a script inside the page will detect and notify
48 // us back by sending us a message.
49 getCf().focus();
50 } catch(e) {
51 status("error: can't set focus");
52 onFailure(g_test_name, g_test_id, "focus() error");
53 }
54 }
55
56 function OnChromeFrameMessage(evt) {
57 if (evt.data != "btnOnFocus") {
58 status("unexpected message: " + evt.data + " from " + evt.origin);
59 } else {
60 window.clearTimeout(g_failure_timeout);
61 g_failure_timeout = null;
62 status("success");
63 }
64 onSuccess(g_test_name, g_test_id);
65 }
66
67 function getCf() {
68 // Fetching chrome frame with getElementById doesn't work in Firefox.
69 // Most likely due to object vs embed.
70 return document.ChromeFrame;
71 }
72
73 // Useful while writing and debugging the unit test.
74 function status(s) {
75 var panel = document.getElementById("status_panel");
76 panel.innerHTML = s;
77 }
78
79 </script>
80 </head>
81 <body onload="onLoad();">
82 <div id="status_panel" style="border: 1px solid red; width: 100%">
83 Test running....
84 </div>
85 <object id="ChromeFrame" width="300" height="60" tabindex="0"
86 codebase="http://www.google.com"
87 classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A">
88 <param name="onload" value="return OnChromeFrameLoaded();">
89 <embed width="300" height="60" name="ChromeFrame"
90 onload="return OnChromeFrameLoaded();"
91 type="application/chromeframe">
92 </embed>
93 </object>
94 </body>
95 </html>
OLDNEW
« no previous file with comments | « chrome_frame/test/data/privileged_apis_host.html ('k') | chrome_frame/test/data/simple_object_focus_cf.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698