52 lines
1.9 KiB
HTML
52 lines
1.9 KiB
HTML
<!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>
|