Backed out changeset b71c8c052463 (bug 1943846) for causing mass failures. CLOSED...
[gecko.git] / devtools / server / tests / chrome / test_inspector-resize.html
blobe0cf9abade49dc49bd15bbf7bb786f49539a95d2
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 Test that the inspector actor emits "resize" events when the page is resized.
5 https://bugzilla.mozilla.org/show_bug.cgi?id=1222409
6 -->
7 <head>
8 <meta charset="utf-8">
9 <title>Test for Bug 1222409</title>
10 <script src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
11 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
12 <script type="application/javascript" src="inspector-helpers.js"></script>
13 <script type="application/javascript">
14 "use strict";
16 window.onload = function() {
17 SimpleTest.waitForExplicitFinish();
19 let win = null;
20 let inspector = null;
22 addAsyncTest(async function setup() {
23 info("Setting up inspector and walker actors.");
25 const url = document.getElementById("inspectorContent").href;
27 const { target, doc } = await attachURL(url);
28 inspector = await target.getFront("inspector");
29 win = doc.defaultView;
30 runNextTest();
31 });
33 addAsyncTest(async function() {
34 const walker = inspector.walker;
36 // We can't receive events from the walker if we haven't first executed a
37 // method on the actor to initialize it.
38 await walker.querySelector(walker.rootNode, "img");
40 const {outerWidth, outerHeight} = win;
41 // eslint-disable-next-line new-cap
42 const onResize = new Promise(resolve => {
43 walker.once("resize", () => {
44 resolve();
45 });
46 });
47 win.resizeTo(800, 600);
48 await onResize;
50 ok(true, "The resize event was emitted");
51 win.resizeTo(outerWidth, outerHeight);
53 runNextTest();
54 });
56 runNextTest();
58 </script>
59 </head>
60 <body>
61 <a id="inspectorContent" target="_blank" href="inspector-search-data.html">Test Document</a>
62 <p id="display"></p>
63 <div id="content" style="display: none">
65 </div>
66 <pre id="test">
67 </pre>
68 </body>
69 </html>