Bug 791975 - Move test_bug760802.html from mochitest-plain to mochitest-chrome. r=roc

--HG--
rename : widget/tests/test_bug760802.html => widget/tests/test_bug760802.xul
This commit is contained in:
foudfou 2012-09-19 15:26:19 +02:00
Родитель 0b867710f8
Коммит d85a20275f
2 изменённых файлов: 30 добавлений и 33 удалений

Просмотреть файл

@ -30,9 +30,6 @@ endif
CPP_UNIT_TESTS += TestAppShellSteadyState.cpp
MOCHITEST_FILES = test_bug760802.html \
$(NULL)
MOCHITEST_CHROME_FILES = test_bug343416.xul \
test_bug429954.xul \
window_bug429954.xul \
@ -58,6 +55,7 @@ MOCHITEST_CHROME_FILES = test_bug343416.xul \
test_position_on_resize.xul \
empty_window.xul \
test_sizemode_events.xul \
test_bug760802.xul \
$(NULL)
# test_bug413277.html mac-only based on 604789, 605178

Просмотреть файл

@ -1,31 +1,32 @@
<!DOCTYPE HTML>
<html>
<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=760802
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 760802</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=760802">Mozilla Bug 760802</a>
<p id="display"></p>
<div id="content" style="display: none">
<window title="Mozilla Bug 760802"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
</div>
<iframe id="iframe_not_editable" width="300" height="150"
src="data:text/html,&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;"></iframe><br/>
<pre id="test">
<script type="application/javascript">
<!-- test results are displayed in the html:body -->
<body xmlns="http://www.w3.org/1999/xhtml">
<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=760802"
target="_blank">Mozilla Bug 760802</a>
<p id="display"></p>
<div id="content" style="display: none"/>
<iframe id="iframe_not_editable" width="300" height="150"
src="data:text/html,&lt;html&gt;&lt;body&gt;&lt;/body&gt;&lt;/html&gt;"/><br/>
</body>
<!-- test code goes here -->
<script type="application/javascript"><![CDATA[
SimpleTest.waitForExplicitFinish();
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
const Cc = Components.classes;
const Ci = Components.interfaces;
function getBaseWindowInterface(win) {
return SpecialPowers.wrap(win).QueryInterface(Ci.nsIInterfaceRequestor)
return win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
@ -45,15 +46,14 @@ function shouldThrowException(fun, exception) {
fun.call();
return false;
} catch (e) {
$("display").innerHTML += "<br>OK thrown: "+e.message;
$("display").innerHTML += "<br/>OK thrown: "+e.message;
return (e instanceof Components.Exception &&
e.result === exception)
}
}
function doesntThrowException(fun) !shouldThrowException(fun)
var baseWindow = getBaseWindowInterface(window);
var baseWindow = getBaseWindowInterface(this);
var nativeHandle = baseWindow.nativeHandle;
$("display").innerHTML = "found nativeHandle for this window: "+nativeHandle;
@ -70,12 +70,12 @@ ok(
ok(typeof(nativeHandle) === "string", "nativeHandle should be a string");
ok(nativeHandle.match(/^0x[0-9a-f]+$/), "nativeHandle should have a memory address format");
var iWin = window.document.getElementById("iframe_not_editable").contentWindow;
var iWin = document.getElementById("iframe_not_editable").contentWindow;
is(getBaseWindowInterface(iWin).nativeHandle, nativeHandle,
"the nativeHandle of an iframe should be its parent's nativeHandle");
"the nativeHandle of an iframe should be its parent's nativeHandle");
var dialog = SpecialPowers.wrap(window).openDialog("data:text/plain,this is an active window.", "_blank",
"chrome,dialog=yes,width=100,height=100");
var dialog = win.openDialog("data:text/plain,this is an active window.", "_blank",
"chrome,dialog=yes,width=100,height=100");
isnot(getBaseWindowInterface(dialog).nativeHandle, "",
"the nativeHandle of a dialog should not be empty");
@ -84,7 +84,6 @@ dialog.close();
todo(false, "the nativeHandle of a window without a mainWidget should be empty"); // how to build a window without a mainWidget ?
</script>
</pre>
</body>
</html>
SimpleTest.finish();
]]></script>
</window>