blob: cc1ba99fba8eaac9423b0e1057cf4c62bef137cd [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../http/tests/inspector/resources/inspector-test.js"></script>
<script>
function test()
{
let suite = InspectorTest.createAsyncSuite("RuntimeManager");
suite.addTestCase({
name: "RuntimeManager.prototype.evaluateInInspectedWindow.ImportFromConsole",
description: "Test evaluating an import expression from console.",
test(resolve, reject) {
function testSource(expression, count) {
let promise = WI.consoleManager.awaitEvent(WI.ConsoleManager.Event.MessageAdded);
return new Promise((resolve, reject) => {
WI.runtimeManager.evaluateInInspectedWindow(expression, {objectGroup: "test"}, (result, wasThrown) => {
promise.then(() => {
InspectorTest.log("Source: " + expression);
InspectorTest.expectThat(result.isUndefined(), "Transformed. Should log the value or an exception.");
resolve();
});
});
})
}
testSource("await import('')", 0)
.then(() => {
return testSource("await import('./not-found.js')");
})
.then(() => {
return testSource("await import('./resources/cocoa.js').then((cocoa) => { console.log(`${cocoa.name} is ${cocoa.taste}.`); })");
})
.then(() => {
return testSource("await import('./resources/drink.js').then((ns) => { console.log(`${ns.Cocoa.name} is ${ns.Cocoa.taste}. ${ns.Cappuccino.name} is ${ns.Cappuccino.taste}.`); })");
})
.then(resolve);
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Tests for RuntimeManager operations.</p>
</body>
</html>