blob: fa9faabacb6191fa1cbf38e68aecc57f6cca1e9f [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");
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>