blob: da9f41b1b80d992fa3f82d18263b8685e94d1066 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test()
{
let suite = InspectorTest.createAsyncSuite("Promise");
suite.addTestCase({
name: "Promise.chain",
async test() {
function createPromise(lastValue, i) {
return new Promise((resolve, reject) => {
InspectorTest.pass(`Resolved promise ${i} with value ${lastValue}`);
resolve(lastValue * 2);
});
}
let results = await Promise.chain([createPromise, createPromise, createPromise], 1);
InspectorTest.assert(results[0] === 2, "Result 1 should be 2 (1 * 2)");
InspectorTest.assert(results[1] === 4, "Result 2 should be 4 (1 * 2 * 2)");
InspectorTest.assert(results[2] === 8, "Result 3 should be 8 (1 * 2 * 2 * 2)");
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onLoad="runTest()">
</body>
</html>