Commit 872a3b6d authored by grt@chromium.org's avatar grt@chromium.org

Chrome Frame test fixes for Vista/IE7.

Write the ActiveX control from an external script in all test documents.  This works around a "feature" of IE versions released between April, 2006 and April, 2008 that required the user to click on an ActiveX control to "activate" it.  See http://msdn.microsoft.com/en-us/library/ms537508.aspx.

I also added asserts for the copying of CFInstance and CFInstall so that the whole test aborts if the files can't be copied, since otherwise test results are bogus.

BUG=60987
TEST=no manual testing needed; chrome_frame_tests.exe will either become better or worse.

Review URL: http://codereview.chromium.org/8777002

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@113291 0039d316-1c4b-4281-b951-d872f2087c98
parent 65165551
......@@ -117,16 +117,16 @@ function DebugResizeChromeFrame(delta) {
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>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl("ChromeFrameSpan",
{ "width": null,
"height": null,
"objectAttributes": { "style": "border: 1px solid blue" },
"eventHandlers": { "onload": "return OnNavigationSucceeded();" },
"embedAttributes": { "style": "border: 1px solid green" }
});
</script>
<br />
<br />
......@@ -135,4 +135,3 @@ Test running....
</body>
</html>
......@@ -189,3 +189,128 @@ function buildURL(pageName, queryString) {
url += ((queryString == "") ? "" : "?" + queryString);
return url;
}
// Helper function for insertControl.
function generateControlHtml(configuration) {
var objectAttributes = new Object();
var params = new Array();
var embedAttributes = new Object();
var param;
var html;
function stringifyAttributes(attributeCollection) {
var result = new String();
for (var attributeName in attributeCollection) {
result += ' ' + attributeName + '="' +
attributeCollection[attributeName] + '"';
}
return result;
}
function applyAttribute(attributeCollection, name, value, defaultValue) {
if (value === undefined)
value = defaultValue;
if (value !== null)
attributeCollection[name] = value;
}
objectAttributes.classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A";
objectAttributes.codebase="http://www.google.com";
applyAttribute(objectAttributes, "id", configuration.id, "ChromeFrame");
applyAttribute(objectAttributes, "width", configuration.width, "500");
applyAttribute(objectAttributes, "height", configuration.height, "500");
// Attributes provided by the caller override any defaults.
for (var attribute in configuration.objectAttributes) {
if (configuration.objectAttributes[attribute] === null)
delete objectAttributes[attribute];
else
objectAttributes[attribute] = configuration.objectAttributes[attribute];
}
embedAttributes.type = "application/chromeframe";
// By default, embed id = object.id + "Plugin". null id means omit id.
if (embedAttributes.id === null)
delete embedAttributes.id;
else if (embedAttributes.id === undefined && objectAttributes.id !== null)
embedAttributes.id = objectAttributes.id + "Plugin";
// By default, embed name = object.id. null name means omit name.
if (embedAttributes.name === null)
delete embedAttributes.name;
else if (embedAttributes.name === undefined && objectAttributes.id !== null)
embedAttributes.name = objectAttributes.id;
applyAttribute(embedAttributes, "width", configuration.width, "500");
applyAttribute(embedAttributes, "height", configuration.height, "500");
applyAttribute(embedAttributes, "src", configuration.src, null);
for (var attribute in configuration.embedAttributes) {
if (configuration.embedAttributes[attribute] === null)
delete embedAttributes[attribute];
else
embedAttributes[attribute] = configuration.embedAttributes[attribute];
}
if (embedAttributes.src !== undefined) {
param = new Object();
param.name = "src";
param.value = embedAttributes.src;
params.push(param);
}
// All event handlers are params and attributes of the embed object.
for (var eventName in configuration.eventHandlers) {
param = new Object();
param.name = eventName;
param.value = configuration.eventHandlers[eventName];
params.push(param);
embedAttributes[eventName] = configuration.eventHandlers[eventName];
}
html = "<object" + stringifyAttributes(objectAttributes) + ">\r\n";
for (var i = 0; i < params.length; ++i) {
html += " <param" + stringifyAttributes(params[i]) + ">\r\n";
}
html += " <embed" + stringifyAttributes(embedAttributes) + "></embed>\r\n"
html += "</object>";
return html;
}
// Write the text for the Chrome Frame ActiveX control into an element.
// This works around a "feature" of IE versions released between April, 2006
// and April, 2008 that required the user to click on an ActiveX control to
// "activate" it. See http://msdn.microsoft.com/en-us/library/ms537508.aspx.
//
// |elementId| identifies the element in the current document into which the
// control markup will be inserted. |configuration| is an Object used to
// configure the control as below. Values shown are defaults, which may be
// overridden by supplying null values.
// {
// "id": "ChromeFrame", // id of object tag, name of the embed tag, and
// // basis of id of the embed tag.
// "width": "500", // width of both object and embed tags.
// "height": "500", // height of both object and embed tags.
// "src": "url", // src of embed tag and of param to object tag.
// "eventHandlers": { // Applied to embed tag and params to object tag.
// "onclose": "...",
// "onload": "...",
// "onloaderror": "..."
// }
// "objectAttributes": { // Custom attributes for the object tag. Any
// "tabindex": "...", // properties explicitly set to null will override
// "border": "...", // defaults.
// "style": "..."
// },
// "embedAttributes": { // Custom attributes for the embed tag;
// "privileged_mode": "...", // similar to above.
// "style": "..."
// }
// }
function insertControl(elementId, configuration) {
var e = document.getElementById(elementId);
e.innerHTML = generateControlHtml(configuration);
}
......@@ -28,13 +28,10 @@
</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>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl("ChromeFrameSpan", { "objectAttributes": { "height": "300" } });
</script>
<div id="statusPanel" style="border: 1px solid red; width: 100%">
Test running....
</div>
......
......@@ -85,40 +85,34 @@
</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="CFDiv1" style="visibility: hidden;"></div>
<script type="text/javascript">
insertControl("CFDiv1",
{ "id": "ChromeFrame1",
"width": "300",
"height": "80",
"src": "simple_object_focus_cf.html",
"eventHandlers": { "onload": "OnCF1Loaded();",
"onloaderror": "OnNavigationFailed();",
"onmessage": "OnCF1Message(arguments[0]);" },
"objectAttributes": { "tabindex": "0" },
"embedAttributes": {"id": null}
});
</script>
<div id="CFDiv2" style="display: none;"></div>
<script type="text/javascript">
insertControl("CFDiv2",
{ "id": "ChromeFrame2",
"width": "300",
"height": "80",
"src": "simple_object_focus_cf.html",
"eventHandlers": { "onload": "OnCF2Loaded();",
"onloaderror": "OnNavigationFailed();",
"onmessage": "OnCF2Message(arguments[0]);" },
"objectAttributes": { "tabindex": "1" },
"embedAttributes": { "id": null}
});
</script>
<div id="statusPanel" style="border: 1px solid red; width: 100%">
Test running....
</div>
......
<html>
<head>
<title>Multiple chrome frame instances test</title>
<script type="text/javascript" src="chrome_frame_tester_helpers.js"></script>
<script type="text/javascript">
function createSecondChromeFrameInstance() {
var dummy = document.createElement('span');
dummy.id = "dummy";
document.body.appendChild(dummy);
dummy.innerHTML = '<object border="1" width="100%" height ="200px"' +
'classid="clsid:E0A900DF-9611-4446-86BD-4B1D47E7DB2A">' +
'<param name="src"' +
'value="multiple_cf_instances_test.html">' +
'<embed id="CFPlugin" width="500" height="500"' +
'name="ChromeFrame" type="application/chromeframe"' +
'src="multiple_cf_instances_test.html">' +
'</embed></object>';
insertControl("dummy",
{ "src": "multiple_cf_instances_test.html",
"objectAttributes": { "id": null, "border": "1", "width": "100%",
"height": "200px", "codebase": null },
"embedAttributes": {"id": "CFPlugin", "name": "ChromeFrame" }
});
}
function onLoad() {
......@@ -22,14 +22,15 @@
</head>
<body onload="onLoad();">
<object id="ChromeFrame1" width="500" height="500"
classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A">
<param name="src" value="about:blank">
<embed id="ChromeFramePlugin" width="500" height="500"
name="ChromeFrame" type="application/chromeframe"
src="about:blank">
</embed>
</object>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl("ChromeFrameSpan",
{ "id": "ChromeFrame1",
"src": "about:blank",
"objectAttributes": { "codebase": null },
"embedAttributes": {"id": "ChromeFramePlugin", "name": "ChromeFrame"}
});
</script>
ChromeFrame multiple widget instances test page. This testcase verifies
whether multiple chrome frame widget instances can be created on the
same page.
......
......@@ -46,15 +46,11 @@
<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>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl("ChromeFrameSpan",
{ "eventHandlers": { "onload": "return OnChromeFrameLoaded();" } });
</script>
<br />
<br />
......
......@@ -43,15 +43,11 @@
<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>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl("ChromeFrameSpan",
{ "eventHandlers": { "onload": "return OnChromeFrameLoaded();" } });
</script>
<br />
<br />
......
......@@ -41,22 +41,17 @@
</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>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl(
"ChromeFrameSpan",
{ "src": "postmessage_basic_frame.html",
"eventHandlers": { "onload": "onChromeFrameLoaded();",
"onloaderror": "onNavigationFailed();",
"onmessage": "onChromeFrameMessage(arguments[0]);" },
"objectAttributes": { "height": "300" }
});
</script>
<br>
<br>
<p>Test for PostMessage from the host browser to ChromeFrame and back</p>
......
......@@ -69,23 +69,20 @@
Test running....
</div>
<span id='ChromeFrameSpan'></span>
<!-- 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>
<script type='text/javascript'>
insertControl(
'ChromeFrameSpan',
{ "src": "privileged_apis_frame.html",
"eventHandlers": {
"onload": "OnChromeFrameLoaded(arguments[0]);",
"onloaderror": "OnNavigationFailed();",
"onmessage": "return OnChromeFrameMessage(arguments[0]);"
},
"embedAttributes": { "privileged_mode": "1" }
});
</script>
<p>Tests that privileged apis are unavailable from regular pages</p>
</body>
</html>
......@@ -82,14 +82,16 @@ function status(s) {
<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>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl(
"ChromeFrameSpan",
{ "width": "300",
"height": "60",
"eventHandlers": { "onload": "return OnChromeFrameLoaded();" },
"objectAttributes": { "tabindex": "0" },
"embedAttributes": {"id": null }
});
</script>
</body>
</html>
......@@ -26,20 +26,17 @@
<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>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl(
"ChromeFrameSpan",
{ "src": "src_property_frame1.html",
"eventHandlers": {
"onload": "return OnChromeFrameLoaded();",
"onloaderror": "return OnNavigationFailed(arguments[0]);"
}
});
</script>
<p>Tests ChromeFrame Navigation</p>
</body>
</html>
......@@ -12,13 +12,10 @@
</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>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl("ChromeFrameSpan", { "width": null, "height": null });
</script>
<br>
<br>
<p>Test for Chrome frame version</p>
......
......@@ -28,21 +28,18 @@
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="window_close_frame.html">
<param name="onload" value="return OnChromeFrameLoaded(arguments[0]);">
<param name="onloaderror" value="return OnNavigationFailed(arguments[0]);">
<param name="onclose" value="return OnCloseWindow();">
<embed id="ChromeFramePlugin" width="500" height="500" name="ChromeFrame"
src="window_close_frame.html"
type="application/chromeframe"
onload="return OnChromeFrameLoaded(arguments[0]);"
onloaderror="return OnNavigationFailed(arguments[0]);"
onclose="return OnCloseWindow();">
</embed>
</object>
<span id="ChromeFrameSpan"></span>
<script type="text/javascript">
insertControl(
"ChromeFrameSpan",
{ "src": "window_close_frame.html",
"eventHandlers": {
"onload": "return OnChromeFrameLoaded(arguments[0]);",
"onloaderror": "return OnNavigationFailed(arguments[0]);",
"onclose": "return OnCloseWindow();"
}
});
</script>
<p>Tests window.close notification from ChromeFrame to its container</p>
</body>
</html>
......@@ -115,12 +115,12 @@ void ChromeFrameTestWithWebServer::SetUp() {
CFInstance_src_path = chrome_frame_source_path.AppendASCII("CFInstance.js");
CFInstance_path_ = test_file_path_.AppendASCII("CFInstance.js");
file_util::CopyFileW(CFInstance_src_path, CFInstance_path_);
ASSERT_TRUE(file_util::CopyFile(CFInstance_src_path, CFInstance_path_));
CFInstall_src_path = chrome_frame_source_path.AppendASCII("CFInstall.js");
CFInstall_path_ = test_file_path_.AppendASCII("CFInstall.js");
file_util::CopyFileW(CFInstall_src_path, CFInstall_path_);
ASSERT_TRUE(file_util::CopyFile(CFInstall_src_path, CFInstall_path_));
server_mock_.ExpectAndServeAnyRequests(CFInvocation(CFInvocation::NONE));
server_mock_.set_expected_result("OK");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment