blob: 52dc706f1a4bfb8877e4ad8069d87ac59af72fdd [file] [log] [blame]
<!doctype html>
<html>
<head>
<script type="text/javascript" src="../http/tests/inspector/inspector-test.js"></script>
<script>
function test()
{
var c1 = RuntimeAgent.evaluate("41", function(err, result, wasThrown) {
InspectorTest.log("Using a callback, got RuntimeAgent.evaluate() result: " + result.value);
InspectorTest.log("Setting up two promises for RuntimeAgent.evaluate.");
var p1 = RuntimeAgent.evaluate.promise("42");
var p2 = RuntimeAgent.evaluate("43");
InspectorTest.assert(!(c1 instanceof Promise), "A promise was returned even though a callback was supplied to the command!");
p1.then(function(payload) {
InspectorTest.log("Using a promise, got RuntimeAgent.evaluate() result: " + payload.result.value);
});
p2.then(function(payload) {
InspectorTest.log("Using a promise, got RuntimeAgent.evaluate() result: " + payload.result.value);
});
Promise.all([p1, p2]).then(function() {
InspectorTest.completeTest();
}).catch(function(error) {
InspectorTest.log("ERROR: " + error);
InspectorTest.completeTest();
})
});
}
</script>
</head>
<body onload="runTest()">
<p>Testing that the inspector backend can return command results using promises.</p>
</body>
</html>