summaryrefslogtreecommitdiffstats
path: root/devtools/client/webide/test/test_basic.html
blob: e619a0f06892a489648f0713ad61010a31c0413c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
<!DOCTYPE html>

<html>

  <head>
    <meta charset="utf8">
    <title></title>

    <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
    <script type="application/javascript" src="chrome://mochikit/content/chrome-harness.js"></script>
    <script type="application/javascript;version=1.8" src="head.js"></script>
    <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css">
  </head>

  <body>

    <script type="application/javascript;version=1.8">
      window.onload = function() {
        SimpleTest.waitForExplicitFinish();

        Task.spawn(function* () {
            let win = yield openWebIDE();

            const {gDevToolsBrowser} = require("devtools/client/framework/devtools-browser");
            yield gDevToolsBrowser.isWebIDEInitialized.promise;
            ok(true, "WebIDE was initialized");

            ok(win, "Found a window");
            ok(win.AppManager, "App Manager accessible");
            let appmgr = win.AppManager;
            ok(appmgr.connection, "App Manager connection ready");
            ok(appmgr.runtimeList, "Runtime list ready");

            // test error reporting
            let nbox = win.document.querySelector("#notificationbox");
            let notification =  nbox.getNotificationWithValue("webide:errornotification");
            ok(!notification, "No notification yet");
            let deferred = promise.defer();
            nextTick().then(() => {
              deferred.reject("BOOM!");
            });
            try {
              yield win.UI.busyUntil(deferred.promise, "xx");
            } catch(e) {/* This *will* fail */}
            notification =  nbox.getNotificationWithValue("webide:errornotification");
            ok(notification, "Error has been reported");

            yield closeWebIDE(win);

            SimpleTest.finish();
        });
      }
    </script>
  </body>
</html>