Web Inspector: ES6: Show Symbol properties on Objects
[WebKit-https.git] / LayoutTests / inspector / protocol-promise-result.html
1 <!doctype html>
2 <html>
3 <head>
4 <script type="text/javascript" src="../http/tests/inspector/inspector-test.js"></script>
5 <script>
6 function test()
7 {
8     var c1 = RuntimeAgent.evaluate("41", function(err, result, wasThrown) {
9         InspectorTest.log("Using a callback, got RuntimeAgent.evaluate() result: " + result.value);
10
11         InspectorTest.log("Setting up two promises for RuntimeAgent.evaluate.");
12
13         var p1 = RuntimeAgent.evaluate.promise("42");
14         var p2 = RuntimeAgent.evaluate("43");
15
16         InspectorTest.assert(!(c1 instanceof Promise), "A promise was returned even though a callback was supplied to the command!");
17
18         p1.then(function(payload) {
19             InspectorTest.log("Using a promise, got RuntimeAgent.evaluate() result: " + payload.result.value);
20         });
21         p2.then(function(payload) {
22             InspectorTest.log("Using a promise, got RuntimeAgent.evaluate() result: " + payload.result.value);
23         });
24
25         Promise.all([p1, p2]).then(function() {
26             InspectorTest.completeTest();
27         }).catch(function(error) {
28             InspectorTest.log("ERROR: " + error);
29             InspectorTest.completeTest();
30         })
31     });
32 }
33 </script>
34 </head>
35 <body onload="runTest()">
36     <p>Testing that the inspector backend can return command results using promises.</p>
37 </body>
38 </html>