docshell/test/chrome/test_bug846906.xul

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:a60ec3f40bec
1 <?xml version="1.0"?>
2 <?xml-stylesheet type="text/css" href="chrome://global/skin"?>
3 <?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
4 <!--
5 https://bugzilla.mozilla.org/show_bug.cgi?id=846906
6 -->
7 <window title="Mozilla Bug 846906"
8 xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
9
10 <script type="application/javascript"
11 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
12
13 <!-- test code goes here -->
14 <script type="application/javascript">
15 <![CDATA[
16
17 /** Test for Bug 846906 **/
18 SimpleTest.waitForExplicitFinish();
19
20 var appShellService = Components.classes["@mozilla.org/appshell/appShellService;1"]
21 .getService(Components.interfaces.nsIAppShellService);
22 ok(appShellService, "Should be able to get app shell service");
23
24 var webNavigation = appShellService.createWindowlessBrowser();
25 ok(webNavigation, "Should be able to create windowless browser");
26
27 var interfaceRequestor = webNavigation.QueryInterface(Components.interfaces.nsIInterfaceRequestor);
28 ok(interfaceRequestor, "Should be able to query interface requestor interface");
29
30 var docShell = interfaceRequestor.getInterface(Components.interfaces.nsIDocShell);
31 ok(docShell, "Should be able to get doc shell interface");
32
33 var document = webNavigation.document;
34 ok(document, "Should be able to get document");
35
36 var iframe = document.createElement("iframe");
37 ok(iframe, "Should be able to create iframe");
38
39 iframe.onload = function () {
40 ok(true, "Should receive initial onload event");
41
42 iframe.onload = function () {
43 ok(true, "Should receive onload event");
44
45 var contentDocument = iframe.contentDocument;
46 ok(contentDocument, "Should be able to get content document");
47
48 var div = contentDocument.getElementById("div1");
49 ok(div, "Should be able to get element by id");
50
51 var rect = div.getBoundingClientRect();
52 ok(rect, "Should be able to get bounding client rect");
53
54 // xxx: can we do better than hardcoding these values here?
55 is(rect.width, 1024);
56 is(rect.height, 768);
57
58 SimpleTest.finish();
59 };
60 iframe.setAttribute("src", "http://mochi.test:8888/chrome/docshell/test/chrome/bug846906.html");
61 };
62 document.documentElement.appendChild(iframe);
63
64 ]]>
65 </script>
66
67 <!-- test results are displayed in the html:body -->
68 <body xmlns="http://www.w3.org/1999/xhtml">
69 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=846906"
70 target="_blank">Mozilla Bug 846906</a>
71 </body>
72 </window>

mercurial