blob: c5367b5550dbd782a7ff1969b44aba5da4bb5921 [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script>
function triggerMicrotask() {
Promise.resolve(100).then(function() {
console.log("Promise Microtask Fired");
});
}
function test()
{
let suite = ProtocolTest.createAsyncSuite("ScriptProfiler.EventType.Microtask");
suite.addTestCase({
name: "TrackingSession",
description: "Start a tracking session that includes a Microtask event type.",
test(resolve, reject) {
InspectorProtocol.awaitEvent({event: "ScriptProfiler.trackingStart"}).then((messageObject) => {
ProtocolTest.log("ScriptProfiler.trackingStart");
});
InspectorProtocol.addEventListener("ScriptProfiler.trackingUpdate", (messageObject) => {
ProtocolTest.log("ScriptProfiler.trackingUpdate");
ProtocolTest.expectThat(messageObject.params.event.type === "Microtask", "Event type should be Microtask.");
});
InspectorProtocol.awaitEvent({event: "ScriptProfiler.trackingComplete"}).then((messageObject) => {
ProtocolTest.log("ScriptProfiler.trackingComplete");
resolve();
});
InspectorProtocol.sendCommand("ScriptProfiler.startTracking", {});
ProtocolTest.evaluateInPage("triggerMicrotask()");
InspectorProtocol.sendCommand("ScriptProfiler.stopTracking", {});
}
});
// FIXME: <https://webkit.org/b/155851> Web Inspector: We should separate out attaching the debugger from the Debugger.enable event
// Debugger should not need to be enabled for profiling to work.
InspectorProtocol.sendCommand("Debugger.enable", {});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Tests for generating a ScriptProfiler.Event with ScriptProfiler.EventType.Microtask type.</p>
</body>
</html>