blob: 0e2a95b2ef54a80184d2d7c030b4038ede66e615 [file] [log] [blame]
<!DOCTYPE html>
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script>
function test()
{
let suite = ProtocolTest.createAsyncSuite("Timeline.setInstruments.errors");
InspectorProtocol.sendCommand("Heap.enable");
InspectorProtocol.sendCommand("Memory.enable");
InspectorProtocol.sendCommand("Timeline.enable");
suite.addTestCase({
name: "MissingRequiredArgument",
test(resolve, reject) {
InspectorProtocol.sendCommand("Timeline.setInstruments", {}, (messageObject) => {
ProtocolTest.expectThat(messageObject.error, `Should be an error: ${messageObject.error ? messageObject.error.message : ""}`);
resolve();
});
}
});
suite.addTestCase({
name: "InvalidTypeInInstrumentsList",
test(resolve, reject) {
InspectorProtocol.sendCommand("Timeline.setInstruments", {"instruments": [123]}, (messageObject) => {
ProtocolTest.expectThat(messageObject.error, `Should be an error: ${messageObject.error ? messageObject.error.message : ""}`);
resolve();
});
}
});
suite.addTestCase({
name: "InvalidInstrumentInInstrumentsList",
test(resolve, reject) {
InspectorProtocol.sendCommand("Timeline.setInstruments", {"instruments": ["NoSuchInstrument"]}, (messageObject) => {
ProtocolTest.expectThat(messageObject.error, `Should be an error: ${messageObject.error ? messageObject.error.message : ""}`);
resolve();
});
}
});
suite.addTestCase({
name: "ValidInstrumentInInstrumentsList",
test(resolve, reject) {
InspectorProtocol.sendCommand("Timeline.setInstruments", {"instruments": ["ScriptProfiler", "Heap", "Timeline", "Memory"]}, (messageObject) => {
ProtocolTest.expectThat(!messageObject.error, "Should not be an error setting valid instruments.");
resolve();
});
}
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onload="runTest()">
<p>Tests for error cases with Timeline.setInstruments.</p>
</body>
</html>