diff options
author | slightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 05:11:58 +0000 |
---|---|---|
committer | slightlyoff@chromium.org <slightlyoff@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-24 05:11:58 +0000 |
commit | f781782dd67077478e117c61dca4ea5eefce3544 (patch) | |
tree | 4801f724123cfdcbb69c4e7fe40a565b331723ae /chrome_frame/test/data | |
parent | 63cf4759efa2373e33436fb5df6849f930081226 (diff) | |
download | chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.zip chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.gz chromium_src-f781782dd67077478e117c61dca4ea5eefce3544.tar.bz2 |
Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming in a separate CL.
BUG=None
TEST=None
Review URL: http://codereview.chromium.org/218019
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27042 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test/data')
43 files changed, 1947 insertions, 0 deletions
diff --git a/chrome_frame/test/data/CFInstance_basic_frame.html b/chrome_frame/test/data/CFInstance_basic_frame.html new file mode 100644 index 0000000..11938ee --- /dev/null +++ b/chrome_frame/test/data/CFInstance_basic_frame.html @@ -0,0 +1,8 @@ +<html> + <head> + <title></title> + </head> + <body> + <h1>do nothing</h1> + </body> +</html> diff --git a/chrome_frame/test/data/CFInstance_basic_host.html b/chrome_frame/test/data/CFInstance_basic_host.html new file mode 100644 index 0000000..6bad61c --- /dev/null +++ b/chrome_frame/test/data/CFInstance_basic_host.html @@ -0,0 +1,55 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceBasic"; + (function(){ + try{ + var cf = new CFInstance({ + src: "CFInstance_basic_frame.html", + node: "toBeReplaced" + }); + + if (document.getElementById("parent") != cf.parentNode ) { + onFailure(testName, 1, "parent node mismatch"); + return; + } + + if (document.getElementById("prev").nextSibling != cf) { + onFailure(testName, 1, "sibling node mismatch"); + return; + } + + if (document.getElementById("after").previousSibling != cf) { + onFailure(testName, 1, "sibling node mismatch"); + return; + } + + onSuccess(testName, 1); + + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: "+e); + } + })(); + </script> + <p>Tests ChromeFrame Navigation</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_default_ctor_host.html b/chrome_frame/test/data/CFInstance_default_ctor_host.html new file mode 100644 index 0000000..744c6de --- /dev/null +++ b/chrome_frame/test/data/CFInstance_default_ctor_host.html @@ -0,0 +1,45 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceDefaultCtor"; + (function(){ + try{ + var cf = new CFInstance(); + cf.src = "CFInstance_basic_frame.html"; + var node = document.getElementById("toBeReplaced"); + node.parentNode.replaceChild(cf, node); + var timer = setTimeout(function() { + onFailure(testName, 1, "CFInstance navigation timeout"); + }, 15000); + cf.listen("load", function() { + clearTimeout(timer); + onSuccess(testName, 1); + }); + cf.src = "CFInstance_basic_frame.html"; + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: "+e); + } + })(); + </script> + <p>Tests Chrome Frame constructor without arguments</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_delay_host.html b/chrome_frame/test/data/CFInstance_delay_host.html new file mode 100644 index 0000000..f6d9e02 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_delay_host.html @@ -0,0 +1,47 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceDelay"; + (function(){ + try{ + var cf = new CFInstance({ + onload: function() { + onSuccess(testName, 1); + }, + src: "CFInstance_basic_frame.html" + }); + + setTimeout(function() { + var replNode = document.getElementById("toBeReplaced"); + // impedence matching between new and old CFInstance.js + var node = cf["plugin"] ? cf.plugin : cf; + replNode.parentNode.replaceChild(node, replNode); + }, 100); + + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: "+e); + } + })(); + </script> + <p>Tests ChromeFrame Navigation when placed in the document on a delay</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_fallback_host.html b/chrome_frame/test/data/CFInstance_fallback_host.html new file mode 100644 index 0000000..5939180 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_fallback_host.html @@ -0,0 +1,44 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceFallback"; + (function() { + try { + var cf = new CFInstance({ + node: "toBeReplaced", + src: "CFInstance_basic_frame.html", + requirements: [] + }); + + if (cf.tagName.toLowerCase() == "iframe") { + onSuccess(testName, 1); + } else { + onFailure(testName, 1, "expected tagName mismatch"); + } + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: "+e); + } + })(); + </script> + <p>Tests ChromeFrame fallback</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_iframe_onload_host.html b/chrome_frame/test/data/CFInstance_iframe_onload_host.html new file mode 100644 index 0000000..913c462 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_iframe_onload_host.html @@ -0,0 +1,41 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceIfrOnload"; + (function() { + try { + var cf = new CFInstance({ + node: "toBeReplaced", + src: "CFInstance_basic_frame.html", + onload: function() { + onSuccess(testName, 1); + }, + requirements: [] // always use an iframe + }); + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: "+e); + } + })(); + </script> + <p>Tests CFInstance event handling on iframes</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_iframe_post_host.html b/chrome_frame/test/data/CFInstance_iframe_post_host.html new file mode 100644 index 0000000..f503522 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_iframe_post_host.html @@ -0,0 +1,50 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceIfrPost"; + (function() { + if (!CFInstance.contentTests.postMessage()) { + onSuccess(testName, 1); + } else { + try { + var cf = new CFInstance({ + node: "toBeReplaced", + src: "CFInstance_post_frame.html", + onload: function() { + cf.postMessage("howdy!"); + }, + onmessage: function(evt) { + if (evt.data == 'hola!') { + onSuccess(testName, 1); + } + }, + requirements: [] // always use an iframe + }); + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: "+e); + } + } + })(); + </script> + <p>Tests CFInstance event handling on iframes</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_no_src_host.html b/chrome_frame/test/data/CFInstance_no_src_host.html new file mode 100644 index 0000000..379e26d --- /dev/null +++ b/chrome_frame/test/data/CFInstance_no_src_host.html @@ -0,0 +1,43 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceNoSrc"; + (function() { + try { + var cf = new CFInstance({ + src: "", + node: "toBeReplaced" + }); + + // check that we got "src" set to "about:blank" by CFInstance + if (cf.src == "about:blank") { + onSuccess(testName, 1); + } else { + onFailure(testName, 1, "blank URL mismatch"); + } + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: "+e); + } + })(); + </script> + <p>Tests ChromeFrame with blank src</p> + </body> +</html> diff --git a/chrome_frame/test/data/CFInstance_post_frame.html b/chrome_frame/test/data/CFInstance_post_frame.html new file mode 100644 index 0000000..8055cb2 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_post_frame.html @@ -0,0 +1,26 @@ +<!-- saved from url=(0014)about:internet --> +<html> +<!-- This page is meant to load inside ChromeFrame --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + <script> + var cf = CFInstance; + + cf.listen("load", function() { + cf.postMessage("hola!"); + }) + </script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <p>ChromeFrame + CFInstance PostMessage Test + <br>Test for PostMessage from the host browser to iframe and back</p> + </body> +</html> diff --git a/chrome_frame/test/data/CFInstance_post_host.html b/chrome_frame/test/data/CFInstance_post_host.html new file mode 100644 index 0000000..09402ac --- /dev/null +++ b/chrome_frame/test/data/CFInstance_post_host.html @@ -0,0 +1,47 @@ +<!DOCTYPE html> + +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstancePost"; + (function() { + try { + var cf = new CFInstance({ + node: "toBeReplaced", + src: "CFInstance_post_frame.html", + onload: function() { + cf.postMessage("howdy!"); + }, + onmessage: function(evt) { + if (evt.data == "hola!") { + onSuccess(testName, 1); + } + } + }); + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: " + e); + } + })(); + </script> + <p>Tests CFInstance event handling on iframes</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_rpc_frame.html b/chrome_frame/test/data/CFInstance_rpc_frame.html new file mode 100644 index 0000000..a7dbfd7 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_rpc_frame.html @@ -0,0 +1,27 @@ +<!DOCTYPE html> + +<html> +<!-- This page is meant to load inside ChromeFrame --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + <script> + var cf = CFInstance; + cf.rpc.expose("rpcHandler", function(arg) { + cf.rpc.callRemote("handleCallback", ["hola!"]); + }); + cf.rpc.init(); + </script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <p>ChromeFrame + CFInstance PostMessage Test + <br>Test for PostMessage from the host browser to iframe and back</p> + </body> +</html> diff --git a/chrome_frame/test/data/CFInstance_rpc_host.html b/chrome_frame/test/data/CFInstance_rpc_host.html new file mode 100644 index 0000000..60680cf --- /dev/null +++ b/chrome_frame/test/data/CFInstance_rpc_host.html @@ -0,0 +1,51 @@ +<!DOCTYPE html> + +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceRPC"; + (function() { + try { + var cf = new CFInstance({ + node: "toBeReplaced", + src: "CFInstance_rpc_frame.html" + }); + + var handleCallback = function(arg) { + // alert(arg); + if (arg == "hola!") { + onSuccess(testName, 1); + } + }; + + cf.rpc.expose("handleCallback", handleCallback); + cf.rpc.init(); + + cf.rpc.callRemote("rpcHandler", ["whatcho talkin 'bout, willis!?"]); + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: " + e); + } + })(); + </script> + <p>Tests CFInstance event handling on iframes</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_rpc_internal_frame.html b/chrome_frame/test/data/CFInstance_rpc_internal_frame.html new file mode 100644 index 0000000..8208269 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_rpc_internal_frame.html @@ -0,0 +1,28 @@ +<!DOCTYPE html> + +<html> +<!-- This page is meant to load inside ChromeFrame --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + <script> + setTimeout(rpcCall, 10000); + function rpcCall() { + var cf = CFInstance; + cf.rpc.callRemote("callback"); + cf.rpc.init(); + } + </script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <p>ChromeFrame + CFInstance PostMessage Test + <br>Test for PostMessage from the host browser to iframe and back</p> + </body> +</html> diff --git a/chrome_frame/test/data/CFInstance_rpc_internal_host.html b/chrome_frame/test/data/CFInstance_rpc_internal_host.html new file mode 100644 index 0000000..f350871 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_rpc_internal_host.html @@ -0,0 +1,45 @@ +<!DOCTYPE html> + +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceRPCInternal"; + (function() { + try { + var cf = new CFInstance({ + node: "toBeReplaced", + src: "CFInstance_rpc_internal_frame.html" + }); + + + cf.rpc.expose("callback", function(arg) { + onSuccess(testName, 1); + }); + cf.rpc.init(); + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: " + e); + } + })(); + </script> + <p>Tests CFInstance event handling on iframes</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_singleton_frame.html b/chrome_frame/test/data/CFInstance_singleton_frame.html new file mode 100644 index 0000000..1ab0302 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_singleton_frame.html @@ -0,0 +1,20 @@ +<html> + <head> + <title>talk to me...</title> + <script type="text/javascript" src="CFInstance.js"></script> + <script type="text/javascript"> + CFInstance.listen("load", function() { + document.body.innerHTML = "sending 'foo'"; + CFInstance.postMessage("foo"); + document.body.innerHTML = "...waiting..."; + }); + CFInstance.listen("message", function(evt) { + document.body.innerHTML = "sending 'baz'"; + CFInstance.postMessage("baz"); + }); + </script> + </head> + <body> + <h1>sends a message to the parent</h1> + </body> +</html> diff --git a/chrome_frame/test/data/CFInstance_singleton_host.html b/chrome_frame/test/data/CFInstance_singleton_host.html new file mode 100644 index 0000000..3eda108 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_singleton_host.html @@ -0,0 +1,44 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" src="chrome_frame_tester_helpers.js"> + </script> + <script type="text/javascript" src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="toBeReplaced"> + fallback content goes here + </div> + <script type="text/javascript"> + var testName = "CFInstanceSingleton"; + (function() { + try{ + var cf = new CFInstance({ + src: "CFInstance_singleton_frame.html", + node: "toBeReplaced" + }); + + // test a call/response set of actions driven by the CF content + cf.listen("message", function(evt) { + if (evt.data == "foo") { + cf.postMessage("bar"); + } else if(evt.data == "baz") { + onSuccess(testName, 1); + } + }); + + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: " + e); + } + })(); + </script> + <p>Tests ChromeFrame Navigation</p> + </body> +</html> + diff --git a/chrome_frame/test/data/CFInstance_zero_size_host.html b/chrome_frame/test/data/CFInstance_zero_size_host.html new file mode 100644 index 0000000..94b35c0 --- /dev/null +++ b/chrome_frame/test/data/CFInstance_zero_size_host.html @@ -0,0 +1,41 @@ +<html> + <!-- This page is meant to loaded inside the host browser (IE, FF, etc.) --> + <head> + <script type="text/javascript" + src="chrome_frame_tester_helpers.js"></script> + <script type="text/javascript" + src="CFInstance.js"></script> + </head> + + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <div id="parent"> + <div id="prev">before</div><div id="toBeReplaced"> + fallback content goes here + </div><div id="after">after</div> + </div> + <script type="text/javascript"> + var testName = "CFInstanceZeroSize"; + (function() { + try { + var cf = new CFInstance({ + node: "toBeReplaced", + src: "CFInstance_basic_frame.html", + cssText: "width: 0px; height: 0px;", + onload: function() { + onSuccess(testName, 1); + } + }); + } catch (e) { + onFailure(testName, 1, + "CFInstance constructor failed with error: "+e); + } + })(); + </script> + <p>Tests CFInstance event handling on iframes</p> + </body> +</html> + diff --git a/chrome_frame/test/data/back_to_ie.html b/chrome_frame/test/data/back_to_ie.html new file mode 100644 index 0000000..ad4b61d --- /dev/null +++ b/chrome_frame/test/data/back_to_ie.html @@ -0,0 +1,21 @@ +<html>
+ <head><title>Back to IE</title>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+
+ <script type="text/javascript">
+ function test() {
+ var test_name = 'navigate_out';
+ if (isRunningInMSIE()) {
+ onSuccess(test_name, 1);
+ } else {
+ onFailure(test_name, 1, 'Failed');
+ }
+ }
+ </script>
+ </head>
+ <body onLoad="test();">
+ <h2>Redirected!</h2>
+ <p>This page should have loaded in IE</p>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/cf_protocol.html b/chrome_frame/test/data/cf_protocol.html new file mode 100644 index 0000000..0036555 --- /dev/null +++ b/chrome_frame/test/data/cf_protocol.html @@ -0,0 +1,20 @@ +<html>
+ <head><title>cf: protocol test</title>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+
+ <script type="text/javascript">
+ function test() {
+ if (isRunningInMSIE()) {
+ reloadUsingCFProtocol();
+ } else {
+ onSuccess("chrome_frame_protocol", 1);
+ }
+ }
+ </script>
+ </head>
+ <body onLoad="setTimeout(test, 100);">
+ <h2>Prepare to be redirected!</h2>
+ <p>Redirects the same page to its 'cf:' version</p>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/chrome_frame_mime_filter_test.html b/chrome_frame/test/data/chrome_frame_mime_filter_test.html new file mode 100644 index 0000000..7520758 --- /dev/null +++ b/chrome_frame/test/data/chrome_frame_mime_filter_test.html @@ -0,0 +1,32 @@ +<!-- saved from url=(0014)about:internet -->
+<!-- Note that for the above Mark of the Web to work, the comment must
+ be followed by a CR/LF ending, so please do not change the line endings. -->
+<html>
+<!-- This page is meant to load inside a host browser like IE/FF -->
+<head>
+<meta http-equiv="X-UA-Compatible" content="chrome=1"/>
+<script type="text/javascript" src="chrome_frame_tester_helpers.js"></script>
+<script type="text/javascript">
+
+function TestIfRunningInChrome() {
+ var is_chrome = /chrome/.test(navigator.userAgent.toLowerCase());
+ if (is_chrome) {
+ onSuccess("MIMEFilter", "MIME filter worked!");
+ } else {
+ onFailure("MIMEFilter", "MIME filter failed :-(",
+ "User agent = " + navigator.userAgent.toLowerCase());
+ }
+}
+
+</script>
+</head>
+
+<body onload="TestIfRunningInChrome();">
+<div id="statusPanel" style="border: 1px solid red; width: 100%">
+Test running....
+</div>
+
+<p>
+
+</body>
+</html>
\ No newline at end of file diff --git a/chrome_frame/test/data/chrome_frame_resize.html b/chrome_frame/test/data/chrome_frame_resize.html new file mode 100644 index 0000000..afba53b --- /dev/null +++ b/chrome_frame/test/data/chrome_frame_resize.html @@ -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>
+
diff --git a/chrome_frame/test/data/chrome_frame_resize_hosted.html b/chrome_frame/test/data/chrome_frame_resize_hosted.html new file mode 100644 index 0000000..95528ec --- /dev/null +++ b/chrome_frame/test/data/chrome_frame_resize_hosted.html @@ -0,0 +1,48 @@ +<html>
+<!-- This page is meant to load inside ChromeFrame -->
+<head>
+
+<script type="text/javascript" src="chrome_frame_tester_helpers.js"></script>
+<script type="text/javascript">
+
+function onLoad() {
+ var host = window.externalHost;
+ if (host) {
+ host.postMessage(
+ "ChromeFrame navigated to: " + window.location);
+ } else {
+ appendStatus("Running in non-hosted mode");
+ }
+}
+
+var resize_event_counter = 0;
+
+function OnResizeEvent() {
+ width = window.innerWidth;
+ height = window.innerHeight;
+
+ appendStatus(resize_event_counter + ". Resized to (" + width +
+ "," + height + ")");
+
+ var host = window.externalHost;
+ if (host) {
+ host.postMessage(
+ resize_event_counter + ":(" + width + "," + height + ")");
+ } else {
+ appendStatus("window.externalHost is null!");
+ }
+}
+</script>
+</head>
+
+<body onload="onLoad();" bgcolor="#999999" onresize="OnResizeEvent();">
+<div id="description" style="border: 2px solid black; width: 100%">
+ Hosted resize test component.
+</div>
+
+<div id="statusPanel" style="border: 1px solid red; width: 100%">
+Test running....
+</div>
+
+</body>
+</html>
diff --git a/chrome_frame/test/data/chrome_frame_tester_helpers.js b/chrome_frame/test/data/chrome_frame_tester_helpers.js new file mode 100644 index 0000000..1c914ee --- /dev/null +++ b/chrome_frame/test/data/chrome_frame_tester_helpers.js @@ -0,0 +1,142 @@ +// +// This script provides some mechanics for testing ChromeFrame +// +function onSuccess(name, id) { + onFinished(name, id, "OK"); +} + +function onFailure(name, id, status) { + onFinished(name, id, status); +} + +function getXHRObject(){ + var XMLHTTP_PROGIDS = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', + 'Msxml2.XMLHTTP.4.0']; + var http = null; + try { + http = new XMLHttpRequest(); + } catch(e) { + } + + if (http) + return http; + + for (var i = 0; i < 3; ++i) { + var progid = XMLHTTP_PROGIDS[i]; + try { + http = new ActiveXObject(progid); + } catch(e) { + } + + if (http) + break; + } + return http; +} + +var reportURL = "/writefile/"; + +function shutdownServer() { + var xhr = getXHRObject(); + if(!xhr) + return; + + xhr.open("POST", "/kill", false); + try { + xhr.send(null); + } catch(e) { + appendStatus("XHR send failed. Error: " + e.description); + } +} + +// Optionally send the server a notification that onload was fired. +// To be called from within window.onload. +function sendOnLoadEvent() { + writeToServer("OnLoadEvent", "loaded"); +} + +function writeToServer(name, result) { + var xhr = getXHRObject(); + if(!xhr) + return; + + // synchronously POST the results + xhr.open("POST", reportURL + name, false); + xhr.setRequestHeader("X-Requested-With", "XMLHttpRequest"); + try { + xhr.send(result); + } catch(e) { + appendStatus("XHR send failed. Error: " + e.description); + } +} + +function postResult(name, result) { + writeToServer(name, result); + // NOTE: + // not watching for failure or return status issues. What should we do here? + shutdownServer(); +} + +// Finish running a test by setting the status +// and the cookie. +function onFinished(name, id, result) { + appendStatus(result); + + // set a cookie to report the results... + var cookie = name + "." + id + ".status=" + result + "; path=/"; + document.cookie = cookie; + + // ...and POST the status back to the server + postResult(name, result); +} + +function appendStatus(message) { + var statusPanel = document.getElementById("statusPanel"); + if (statusPanel) { + statusPanel.innerHTML += '<BR>' + message; + } +} + +function readCookie(name) { + var cookie_name = name + "="; + var ca = document.cookie.split(';'); + + for(var i = 0 ; i < ca.length ; i++) { + var c = ca[i]; + while (c.charAt(0) == ' ') { + c = c.substring(1,c.length); + } + if (c.indexOf(cookie_name) == 0) { + return c.substring(cookie_name.length, c.length); + } + } + return null; +} + +function createCookie(name,value,days) { + var expires = ""; + if (days) { + var date = new Date(); + date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000)); + expires = "; expires=" + date.toGMTString(); + } + document.cookie = name+"="+value+expires+"; path=/"; +} + +function eraseCookie(name) { + createCookie(name, "", -1); +} + +function isRunningInMSIE() { + if (/MSIE (\d+\.\d+);/.test(navigator.userAgent)) + return true; + + return false; +} + +function reloadUsingCFProtocol() { + var redirect_location = "cf:"; + redirect_location += window.location; + window.location = redirect_location; +} + diff --git a/chrome_frame/test/data/event_listener.html b/chrome_frame/test/data/event_listener.html new file mode 100644 index 0000000..6fbd158 --- /dev/null +++ b/chrome_frame/test/data/event_listener.html @@ -0,0 +1,42 @@ +<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 language="javascript"> + var g_test_name = 'EventListener'; + + function onChromeFrameLoaded() { + appendStatus('Chrome frame loaded.'); + onSuccess(g_test_name, 1); + } + + function onEventNotFired() { + onFailure(g_test_name, 1, 'Did not receive onload event'); + } + + function onDocumentLoad() { + appendStatus('document loaded'); + var cf = getCf(); + cf.addEventListener("load", onChromeFrameLoaded, false); + setTimeout(onEventNotFired, 10000) + cf.src = "CFInstance_basic_frame.html"; + } + + function getCf() { + return window.document.ChromeFrame; + } + </script> +</head> +<body onload="onDocumentLoad();"> + <object id="ChromeFrame" width="500" height ="300" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <embed id="ChromeFramePlugin" name="ChromeFrame" width="500" + height="500" type="application/chromeframe"> + </embed> + </object> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> +</body> +</html> diff --git a/chrome_frame/test/data/iframe_basic_host.html b/chrome_frame/test/data/iframe_basic_host.html new file mode 100644 index 0000000..f9a4c0c --- /dev/null +++ b/chrome_frame/test/data/iframe_basic_host.html @@ -0,0 +1,13 @@ +<!-- saved from url=(0014)about:internet --> +<html> +<!-- This page is meant to load inside the host browser like IE/FF --> +<head></head> +<body> + <iframe src ="postmessage_basic_host.html" width="50%" height="600">
+ </iframe> + + <br> + <br> + Test for ChromeFrame inside iframe +</body> +</html> diff --git a/chrome_frame/test/data/in_head.html b/chrome_frame/test/data/in_head.html new file mode 100644 index 0000000..a093c71 --- /dev/null +++ b/chrome_frame/test/data/in_head.html @@ -0,0 +1,62 @@ +<html> + <!-- This page is meant to load inside the host browser like IE/FF --> + <head><title>Initialize hidden chrome frame</title> + <script type="text/javascript" src="chrome_frame_tester_helpers.js"> + </script> + <script type="text/javascript"> + var g_failure_timeout = null; + var g_test_id = 1; + var g_test_name = 'InHead'; + var g_cf3_loaded = false; + + function OnNavigationFailed() { + onFailure(g_test_name, g_test_id, 'ChromeFrame Navigation failed'); + } + + function OnObjectFocusFailed() { + appendStatus('chrome frame focus failed'); + onFailure(g_test_name, g_test_id, 'Embed in head test failed'); + } + + function OnFrameMessage(evt) { + appendStatus('Chrome frame visible and focused'); + if (evt.data == 'btnOnFocus') { + window.clearTimeout(g_failure_timeout); + g_failure_timeout = null; + appendStatus('Chrome frame visible and focused'); + + onSuccess(g_test_name, g_test_id); + } + } + + function OnFrameLoad() { + document.ChromeFrame.focus(); + } + + function OnLoad() { + g_failure_timeout = window.setTimeout(OnObjectFocusFailed, 10000); + } + </script> + <object id="ChromeFrame" width="300" height="80" tabindex="0" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="src" value="simple_object_focus_cf.html"> + <param name="onload" value="OnFrameLoad();"> + <param name="onloaderror" value="OnNavigationFailed();"> + <param name="onmessage" value="OnFrameMessage(arguments[0]);"> + <embed width="300" height="80" name="ChromeFrame" + type="application/chromeframe" + src="simple_object_focus_cf.html" + onload="OnFrameLoad();" + onloaderror="OnNavigationFailed();" + onmessage="OnFrameMessage(arguments[0]);"> + </embed> + </object> + </head> + <body onload = "OnLoad();"> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + <div id = "dummy"> </div> + </body> +</html> diff --git a/chrome_frame/test/data/initialize_hidden.html b/chrome_frame/test/data/initialize_hidden.html new file mode 100644 index 0000000..2da0917 --- /dev/null +++ b/chrome_frame/test/data/initialize_hidden.html @@ -0,0 +1,120 @@ +<html> + <!-- This page is meant to load inside the host browser like IE/FF --> + <head><title>Initialize hidden chrome frame</title> + <script type="text/javascript" src="chrome_frame_tester_helpers.js"> + </script> + <script type="text/javascript"> + var g_failure_timeout = null; + var g_test_id = 1; + var g_test_name = 'InitializeHidden'; + var g_cf3_loaded = false; + + function OnNavigationFailed() { + onFailure(g_test_name, g_test_id, 'ChromeFrame Navigation failed'); + } + + function OnObjectFocusFailed() { + appendStatus('chrome frame focus failed'); + onFailure(g_test_name, g_test_id, 'Visibility test failed'); + } + + function OnCF1Loaded() { + appendStatus('Chrome frame 1 loaded, not visible yet.'); + try { + // Make chrome frame visible + var cf1 = document.getElementById('CFDiv1'); + cf1.style.visibility = 'visible'; + appendStatus('Chrome frame 1 visibility - ' + cf1.style.visibility); + // Set focus to chrome frame. This should set focus to the + // first element inside the frame, which a script inside the + // page will detect and notify us back by sending us a message. + document.ChromeFrame1.focus(); + g_failure_timeout = window.setTimeout(OnObjectFocusFailed, 10000); + } catch(e) { + appendStatus('Error setting focus to CF1. Error: ' + e.description); + onFailure(g_test_name, g_test_id, 'CF1 focus() error'); + } + } + + function OnCF1Message(evt) { + if (evt.data == 'btnOnFocus') { + window.clearTimeout(g_failure_timeout); + g_failure_timeout = null; + appendStatus('CF1 visible and focused'); + + // Now make second chrome frame instance visible + document.getElementById('CFDiv2').style.display = 'block'; + appendStatus('Chrome frame 2 visible, should start loading now'); + g_failure_timeout = window.setTimeout(OnObjectFocusFailed, 10000); + } + } + + function OnCF2Loaded() { + appendStatus('Chrome frame 2 loaded'); + try { + // Set focus to chrome frame. This should set focus to the + // first element inside the frame, which a script inside the + // page will detect and notify us back by sending us a message. + // We set focus on a timeout as on IE it takes a while for the window + // to become visible. + setTimeout(SetFocusToCF2, 100); + } catch(e) { + appendStatus('Error setting focus to CF2. Error: ' + e.description); + onFailure(g_test_name, g_test_id, 'CF2 focus() error'); + } + } + + function SetFocusToCF2() { + document.ChromeFrame2.focus(); + } + + function OnCF2Message(evt) { + if (evt.data == 'btnOnFocus') { + window.clearTimeout(g_failure_timeout); + g_failure_timeout = null; + appendStatus('CF2 visible and focused'); + onSuccess(g_test_name, g_test_id); + } + } + </script> + </head> + <body> + <div id="CFDiv1" style="visibility: hidden;"> + <object id="ChromeFrame1" width="300" height="80" tabindex="0" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="src" value="simple_object_focus_cf.html"> + <param name="onload" value="OnCF1Loaded();"> + <param name="onloaderror" value="OnNavigationFailed();"> + <param name="onmessage" value="OnCF1Message(arguments[0]);"> + <embed width="300" height="80" name="ChromeFrame1" + type="application/chromeframe" + src="simple_object_focus_cf.html" + onload="OnCF1Loaded();" + onloaderror="OnNavigationFailed();" + onmessage="OnCF1Message(arguments[0]);"> + </embed> + </object> + </div> + <div id="CFDiv2" style="display: none;"> + <object id="ChromeFrame2" width="300" height="80" tabindex="1" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="src" value="simple_object_focus_cf.html"> + <param name="onload" value="OnCF2Loaded();"> + <param name="onloaderror" value="OnNavigationFailed();"> + <param name="onmessage" value="OnCF2Message(arguments[0]);"> + <embed width="300" height="80" name="ChromeFrame2" + type="application/chromeframe" + src="simple_object_focus_cf.html" + onload="OnCF2Loaded();" + onloaderror="OnNavigationFailed();" + onmessage="OnCF2Message(arguments[0]);"> + </embed> + </object> + </div> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + </body> +</html> diff --git a/chrome_frame/test/data/meta_tag.html b/chrome_frame/test/data/meta_tag.html new file mode 100644 index 0000000..9b17406 --- /dev/null +++ b/chrome_frame/test/data/meta_tag.html @@ -0,0 +1,21 @@ +<html>
+ <head>
+ <meta http-equiv="x-ua-compatible" content="chrome=1" /> + <title>Load chrome frame using meta tag</title>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+
+ <script type="text/javascript">
+ function test() {
+ if (isRunningInMSIE()) {
+ onFailure("meta_tag", 1, "Failed");
+ } else {
+ onSuccess("meta_tag", 1);
+ }
+ }
+ </script>
+ </head>
+ <body onLoad="setTimeout(test, 100);"> + chrome trame in tab mode + </body> +</html> diff --git a/chrome_frame/test/data/navigate_out.html b/chrome_frame/test/data/navigate_out.html new file mode 100644 index 0000000..7b910b4 --- /dev/null +++ b/chrome_frame/test/data/navigate_out.html @@ -0,0 +1,20 @@ +<html>
+ <head><title>Test to make sure that navigations sent back to IE</title>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+
+ <script type="text/javascript">
+ function test() {
+ if (isRunningInMSIE()) {
+ reloadUsingCFProtocol();
+ } else {
+ window.location = "back_to_ie.html";
+ }
+ }
+ </script>
+ </head>
+ <body onLoad="setTimeout(test, 100);">
+ <h2>Prepare to be redirected!</h2>
+ <p>Redirects the same page to its 'cf:' version and </p>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/navigateurl_absolute_host.html b/chrome_frame/test/data/navigateurl_absolute_host.html new file mode 100644 index 0000000..03e1de2 --- /dev/null +++ b/chrome_frame/test/data/navigateurl_absolute_host.html @@ -0,0 +1,64 @@ +<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.onloaderror = OnNavigationFailed; + setTimeout(NavigateToURL, 100); + } + + function NavigateToURL() { + var frame_location = new String(window.location); + frame_location = frame_location.replace( + /navigateurl_absolute_host.html/, "navigateurl_basic_frame.html"); + var chromeFrame = GetChromeFrame(); + chromeFrame.src = frame_location; + setTimeout(OnNavigationTimeout, 10000); + } + + var navigation_success = 0; + + function OnNavigationFailed(msg) { + if (!navigation_success) { + onFailure("NavigateURL", 1, 'ChromeFrame Navigation failed: ' + msg); + } + } + + function OnNavigationTimeout() { + OnNavigationFailed('TIMEOUT'); + } + + function OnChromeFrameLoaded() { + navigation_success = 1; + onSuccess("NavigateURL", 1); + } + + function GetChromeFrame() { + return window.document.ChromeFrame; + } + </script> + </head> + + <body onload="onLoad();"> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + <object id="ChromeFrame" width="500" height="500" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="onload" value="return OnChromeFrameLoaded();"> + <embed id="ChromeFramePlugin" width="500" height="500" + name="ChromeFrame" onload="return OnChromeFrameLoaded();" + type="application/chromeframe"> + </embed> + </OBJECT> + <br /> + <br /> + + <p>Tests ChromeFrame Navigation</p> + + </body> +</html> diff --git a/chrome_frame/test/data/navigateurl_basic_frame.html b/chrome_frame/test/data/navigateurl_basic_frame.html new file mode 100644 index 0000000..4d99b43 --- /dev/null +++ b/chrome_frame/test/data/navigateurl_basic_frame.html @@ -0,0 +1,12 @@ +<html> +<!-- This page is meant to load inside ChromeFrame --> + +<body> +<div id="statusPanel" style="border: 1px solid red; width: 100%"> +Test running.... +</div> + +<p>ChromeFrame NavigateURL Test<br> +Tests ChromeFrame Navigation</p> +</body> +</html> diff --git a/chrome_frame/test/data/navigateurl_relative_host.html b/chrome_frame/test/data/navigateurl_relative_host.html new file mode 100644 index 0000000..06ec63e --- /dev/null +++ b/chrome_frame/test/data/navigateurl_relative_host.html @@ -0,0 +1,60 @@ +<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.onloaderror = OnNavigationFailed; + setTimeout(NavigateToURL, 100); + } + + function NavigateToURL() { + var chromeFrame = GetChromeFrame(); + chromeFrame.src = "navigateurl_basic_frame.html"; + setTimeout(OnNavigationTimeout, 10000); + } + + var navigation_complete = 0; + + function OnNavigationFailed(msg) { + if (!navigation_complete) { + onFailure("NavigateURL", 1, 'ChromeFrame Navigation failed: ' + msg); + } + } + + function OnNavigationTimeout() { + OnNavigationFailed('TIMEOUT'); + } + + function OnChromeFrameLoaded() { + navigation_success = 1; + onSuccess("NavigateURL", 1); + } + + function GetChromeFrame() { + return window.document.ChromeFrame; + } + </script> + </head> + + <body onload="onLoad();"> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + <object id="ChromeFrame" width="500" height="500" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="onload" value="return OnChromeFrameLoaded();"> + <embed id="ChromeFramePlugin" width="500" height="500" + name="ChromeFrame" onload="return OnChromeFrameLoaded();" + type="application/chromeframe"> + </embed> + </OBJECT> + <br /> + <br /> + + <p>Tests ChromeFrame Navigation</p> + </body> +</html> diff --git a/chrome_frame/test/data/persistent_cookie_test_page.html b/chrome_frame/test/data/persistent_cookie_test_page.html new file mode 100644 index 0000000..ea56262 --- /dev/null +++ b/chrome_frame/test/data/persistent_cookie_test_page.html @@ -0,0 +1,36 @@ +<html>
+ <head><title>Persistent host browser chrome frame cookie test</title>
+ <script type="text/javascript"
+ src="chrome_frame_tester_helpers.js"></script>
+
+ <script type="text/javascript">
+ function validatePersistentCookie() {
+ if (readCookie("PersistentCookie1") != "Cookie1" ||
+ readCookie("PersistentCookie2") != "Cookie2") {
+ onFailure("PersistentCookieTest", 1, "Failed");
+ } else {
+ onSuccess("PersistentCookieTest", 1);
+ }
+ eraseCookie("PersistentCookie1");
+ eraseCookie("PersistentCookie2");
+ }
+
+ function setPersistentCookieAndRedirect() {
+ if (isRunningInMSIE()) {
+ eraseCookie("PersistentCookie1");
+ eraseCookie("PersistentCookie2");
+ createCookie("PersistentCookie1", "Cookie1", 365);
+ createCookie("PersistentCookie2", "Cookie2", 365);
+ reloadUsingCFProtocol();
+ } else {
+ validatePersistentCookie();
+ }
+ }
+ </script>
+ </head>
+ <body onLoad="setTimeout(setPersistentCookieAndRedirect, 100);">
+ <h2>Prepare to be redirected!</h2>
+ <p>Sets two persistent cookies in the host and redirects ChromeFrame <br />
+ to the same page </p>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/postmessage_basic_frame.html b/chrome_frame/test/data/postmessage_basic_frame.html new file mode 100644 index 0000000..76f8cb3 --- /dev/null +++ b/chrome_frame/test/data/postmessage_basic_frame.html @@ -0,0 +1,27 @@ +<!-- saved from url=(0014)about:internet -->
+<html>
+<!-- This page is meant to load inside ChromeFrame -->
+ <head>
+ <script type="text/javascript" src="chrome_frame_tester_helpers.js"> + </script> + <script type="text/javascript">
+ function OnLoad() { + externalHost.onmessage = OnHostMessage; + }
+
+ function OnHostMessage(evt) {
+ appendStatus('Host message: ' + evt.data); + externalHost.postMessage("Hello from ChromeFrame");
+ }
+ </script>
+ </head>
+
+ <body onload="OnLoad();">
+ <div id="statusPanel" style="border: 1px solid red; width: 100%">
+ Test running....
+ </div>
+
+ <p>ChromeFrame PostMessage Test
+ <br>Test for PostMessage from the host browser to ChromeFrame and back</p>
+ </body>
+</html>
diff --git a/chrome_frame/test/data/postmessage_basic_host.html b/chrome_frame/test/data/postmessage_basic_host.html new file mode 100644 index 0000000..e5ecef9 --- /dev/null +++ b/chrome_frame/test/data/postmessage_basic_host.html @@ -0,0 +1,69 @@ +<!-- saved from url=(0014)about:internet --> +<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"> + var post_message_reply_received = 0; + + function onChromeFrameLoaded() { + appendStatus('Chrome frame loaded...'); + document.ChromeFrame.postMessage('Hello from host'); + setTimeout(onPostMessageFailure, 10000); + } + + function onNavigationFailed(msg) { + onFailure('PostMessage', 1, 'ChromeFrame Navigation failed: ' + msg); + } + + function onChromeFrameMessage(evt) { + try { + var d = new String(evt.data); + appendStatus('Message: ' + d); + if (d == 'Hello from ChromeFrame') { + post_message_reply_received = 1; + onSuccess('PostMessage', 1); + } else { + onFailure('PostMessage', 1, 'unexpected data'); + } + } catch (e) { + onFailure('PostMessage', 1, 'exception in onChromeFrameMessage'); + } + } + + function onPostMessageFailure() { + if (!post_message_reply_received) { + onFailure('PostMessage', 1, 'Did not receive reply back from frame'); + } + } + </script> + </head> + + <body> + <object id="ChromeFrame" width="500" height ="300" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="src" value="postmessage_basic_frame.html"> + <param name="onload" value="onChromeFrameLoaded();"> + <param name="onloaderror" value="onNavigationFailed();"> + <param name="onmessage" value="onChromeFrameMessage(arguments[0]);"> + <embed id="ChromeFramePlugin" name="ChromeFrame" + width="500" height="500" + src="postmessage_basic_frame.html" + type="application/chromeframe" + onload="onChromeFrameLoaded();" + onloaderror="onNavigationFailed();" + onmessage="onChromeFrameMessage(arguments[0]);"> + </embed> + </object> + <br> + <br> + <p>Test for PostMessage from the host browser to ChromeFrame and back</p> + <button onclick="document.ChromeFrame.postMessage('Message from button');"> + Send message to frame</button> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + </body> +</html> diff --git a/chrome_frame/test/data/privileged_apis_frame.html b/chrome_frame/test/data/privileged_apis_frame.html new file mode 100644 index 0000000..9e51152 --- /dev/null +++ b/chrome_frame/test/data/privileged_apis_frame.html @@ -0,0 +1,33 @@ +<!-- saved from url=(0014)about:internet --> +<html> +<!-- This page is meant to load inside ChromeFrame --> + <head> + <script type="text/javascript" src="chrome_frame_tester_helpers.js"> + </script> + <script type="text/javascript"> + function OnLoad() { + externalHost.onmessage = OnHostMessage; + } + + function OnHostMessage(evt) { + // Any time we receive a message, we reflect it back both + // with a nonsensical target, and with "*". + appendStatus('Host message: ' + evt.data); + externalHost.postMessage(evt.data, + "privileged_target"); + appendStatus('After postMessage(' + evt.data + ', "privileged_target)"'); + externalHost.postMessage(evt.data); + appendStatus('After postMessage(' + evt.data + '")'); + } + </script> + </head> + + <body onload="OnLoad();"> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <p>ChromeFrame PrivilegeApis Test + <br>Tests that private messaging is not available to regular web pages</p> + </body> +</html> diff --git a/chrome_frame/test/data/privileged_apis_host.html b/chrome_frame/test/data/privileged_apis_host.html new file mode 100644 index 0000000..7261704 --- /dev/null +++ b/chrome_frame/test/data/privileged_apis_host.html @@ -0,0 +1,85 @@ +<html> + <head><title>Privileged Apis test</title> + <script type='text/javascript' src='chrome_frame_tester_helpers.js'> + </script> + <script type='text/javascript'> + var testName = 'PrivilegedApis'; + function OnNavigationFailed(msg) { + onFailure(testName, 1, 'ChromeFrame Navigation failed: ' + msg); + } + + function OnPrivateMessage() { + onFailure(testName, 1, 'OnPrivateMessage should not execute'); + } + + function OnChromeFrameMessage(evt) { + try { + var d = new String(evt.data); + appendStatus('Message: ' + d); + if (d == 'succeed') { + onSuccess(testName, 1); + } else { + onFailure(testName, 1, 'unexpected data'); + } + } catch (e) { + onFailure(testName, 1, 'exception in OnChromeFrameMessage'); + } + } + + function OnChromeFrameLoaded(url) { + var cf = GetChromeFrame(); + + try { + // Any message received by this listener is a failure. + // This succeeds in FF, but throws an exception in IE. + cf.addEventListener('onprivatemessage', OnPrivateMessage, false); + } catch(e) { + cf.onprivatemessage = + appendStatus('addEventListener onprivatemessage threw exception') + } + + // If this invocation succeeds, then 'fail' is reflected by the frame + // and we fail in the OnChromeFrameMessage handler above. + try { + cf.postPrivateMessage('fail', String(document.location), '*'); + onFailure(testName, 1, 'postPrivateMessage should throw'); + } catch(e) { + } + appendStatus('After postPrivateMessage') + // The frame reflects this twice, first to a bogus target + // and again to the default target '*'. We succeed if we + // get the reflected message to OnChromeFrameMessage and not to + // OnPrivateMessage. + cf.postMessage('succeed'); + } + + function GetChromeFrame() { + return window.document.ChromeFrame; + } + </script> + </head> + <body> + <div id='statusPanel' style='border: 1px solid red; width: 100%'> + Test running.... + </div> + + <!-- TODO(siggi): Test setting onprivatemessage in these params --> + <object id='ChromeFrame' width='500' height='500' + codebase='http://www.google.com' + classid='CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A'> + <param name='src' value='privileged_apis_frame.html'> + <param name='onload' value='OnChromeFrameLoaded(arguments[0]);'> + <param name='onloaderror' value='OnNavigationFailed();'> + <param name='onmessage' value='OnChromeFrameMessage(arguments[0]);'> + <embed id='ChromeFramePlugin' width='500' height='500' name='ChromeFrame' + src='privileged_apis_frame.html' + type='application/chromeframe' + onload='OnChromeFrameLoaded(arguments[0]);' + onloaderror='OnNavigationFailed();' + onmessage='return OnChromeFrameMessage(arguments[0]);' + privileged_mode='1' + </embed> + </object> + <p>Tests that privileged apis are unavailable from regular pages</p> + </body> +</html> diff --git a/chrome_frame/test/data/simple_object_focus.html b/chrome_frame/test/data/simple_object_focus.html new file mode 100644 index 0000000..138ffa5 --- /dev/null +++ b/chrome_frame/test/data/simple_object_focus.html @@ -0,0 +1,95 @@ +<!-- saved from url=(0014)about:internet --> +<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"> +var g_failure_timeout = null; +var g_test_id = 1; +var g_test_name = "ObjectFocus"; + +function onLoad() { + status("onload"); + + try { + var cf = getCf(); + cf.onmessage = OnChromeFrameMessage; + window.setTimeout(NavigateToURL, 100); + } catch(e) { + status("error: onload"); + onFailure(g_test_name, g_test_id, "error in onload"); + } + + sendOnLoadEvent(); +} + +function NavigateToURL() { + try { + status("Navigate to URL"); + var cf = getCf(); + cf.src = "simple_object_focus_cf.html"; + g_failure_timeout = window.setTimeout(OnObjectFocusFailed, 10000); + } catch(e) { + status("error: NavigateToURL"); + onFailure(g_test_name, g_test_id, "NavigateToURL error"); + } +} + +function OnObjectFocusFailed() { + status("OnNavigationFailed"); + onFailure(g_test_name, g_test_id, "focus test failed"); +} + +function OnChromeFrameLoaded() { + status("OnChromeFrameLoaded"); + try { + // Set focus to chrome frame. This should set focus to the first element + // inside the frame, which a script inside the page will detect and notify + // us back by sending us a message. + getCf().focus(); + } catch(e) { + status("error: can't set focus"); + onFailure(g_test_name, g_test_id, "focus() error"); + } +} + +function OnChromeFrameMessage(evt) { + if (evt.data != "btnOnFocus") { + status("unexpected message: " + evt.data + " from " + evt.origin); + } else { + window.clearTimeout(g_failure_timeout); + g_failure_timeout = null; + status("success"); + } + onSuccess(g_test_name, g_test_id); +} + +function getCf() { + // Fetching chrome frame with getElementById doesn't work in Firefox. + // Most likely due to object vs embed. + return document.ChromeFrame; +} + +// Useful while writing and debugging the unit test. +function status(s) { + var panel = document.getElementById("status_panel"); + panel.innerHTML = s; +} + +</script> +</head> +<body onload="onLoad();"> +<div id="status_panel" style="border: 1px solid red; width: 100%"> +Test running.... +</div> +<object id="ChromeFrame" width="300" height="60" tabindex="0" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="onload" value="return OnChromeFrameLoaded();">
+ <embed width="300" height="60" name="ChromeFrame" + onload="return OnChromeFrameLoaded();" + type="application/chromeframe"> + </embed> +</object> +</body> +</html> diff --git a/chrome_frame/test/data/simple_object_focus_cf.html b/chrome_frame/test/data/simple_object_focus_cf.html new file mode 100644 index 0000000..9b06711 --- /dev/null +++ b/chrome_frame/test/data/simple_object_focus_cf.html @@ -0,0 +1,10 @@ +<html> +<!-- This page is meant to load inside Chrome Frame --> + <body> + <button onfocus="externalHost.postMessage('btnOnFocus');"> + hello world</button> + <div id="statusPanel" style="border: 1px solid green; width: 100%"> + Inside Chrome Frame.... + </div> + </body> +</html> diff --git a/chrome_frame/test/data/src_property_frame1.html b/chrome_frame/test/data/src_property_frame1.html new file mode 100644 index 0000000..1eaa3cf --- /dev/null +++ b/chrome_frame/test/data/src_property_frame1.html @@ -0,0 +1,13 @@ +<html>
+ <head><title>src property test - page 1</title>
+ <script type="text/javascript">
+ function redirect(){
+ window.location = "src_property_frame2.html";
+ }
+ </script>
+ </head>
+ <body onLoad="setTimeout(redirect, 100);">
+ <h2>Prepare to be redirected!</h2>
+ <p>Redirecting to a new page within frame...</p>
+ </body>
+</html>
\ No newline at end of file diff --git a/chrome_frame/test/data/src_property_frame2.html b/chrome_frame/test/data/src_property_frame2.html new file mode 100644 index 0000000..c5c0364 --- /dev/null +++ b/chrome_frame/test/data/src_property_frame2.html @@ -0,0 +1,8 @@ +<html>
+ <head><title>src property test - page 2</title>
+ </head>
+ <body>
+ <h2>Redirected!</h2>
+ <p>All finished.</p>
+ </body>
+</html>
\ No newline at end of file diff --git a/chrome_frame/test/data/src_property_host.html b/chrome_frame/test/data/src_property_host.html new file mode 100644 index 0000000..7b7b358 --- /dev/null +++ b/chrome_frame/test/data/src_property_host.html @@ -0,0 +1,65 @@ +<html>
+ <head><title>src property test</title> + <script type="text/javascript" src="chrome_frame_tester_helpers.js"> + </script> + <script type="text/javascript"> + function OnNavigationFailed() { + onFailure("ChromeFrame_SrcTest", 1, "ChromeFrame Navigation failed"); + } + + var load_count = 2; + + function OnChromeFrameLoaded(url) { + url = url.data; + + var chromeFrame = GetChromeFrame(); + var frame_url = chromeFrame.src; + + appendStatus("Loaded URL: " + url + " Frame url: " + frame_url); + load_count--; + + if (load_count) { + // For the first load, the URLs should match. + if (frame_url != url) { + onFailure("SrcProperty", 1, "Url: " + url); + } + } else { + // Previous versions changed the frame URL when internal navigation + // was performed. This does not match how iframes behave, and so we + // report success only in the case that they continue to match, even + // though the "internal" URL is different (and not visible) to the + // external host. + if (frame_url == url) { + onFailure("SrcProperty", 1, "Url: " + url); + } else { + onSuccess("SrcProperty", 1); + } + } + } + + function GetChromeFrame() { + return window.document.ChromeFrame; + } + </script> + </head> + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <object id="ChromeFrame" width="500" height="500" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="src" value="src_property_frame1.html"> + <param name="onload" value="return OnChromeFrameLoaded(arguments[0]);"> + <param name="onloaderror" value="return OnNavigationFailed(arguments[0]);"> + <embed id="ChromeFramePlugin" width="500" height="500" name="ChromeFrame" + src="src_property_frame1.html" + type="application/chromeframe" + onload="return OnChromeFrameLoaded(arguments[0]);" + onloaderror="return OnNavigationFailed(arguments[0]);"> + </embed> + </object> + <p>Tests ChromeFrame Navigation</p> + </body> +</html> diff --git a/chrome_frame/test/data/version.html b/chrome_frame/test/data/version.html new file mode 100644 index 0000000..b585a6d --- /dev/null +++ b/chrome_frame/test/data/version.html @@ -0,0 +1,29 @@ +<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() { + appendStatus('Chrome frame version: ' + document.ChromeFrame.version); + onFinished('version', 1, document.ChromeFrame.version); + } + </script> + </head> + + <body onload="onLoad();"> + <object id="ChromeFrame" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <embed id="ChromeFramePlugin" name="ChromeFrame" + type="application/chromeframe" + </embed> + </object> + <br> + <br> + <p>Test for Chrome frame version</p> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + </body> +</html> |