blob: a73e2a228a9e8113b38464b492100785de9c554a [file] [log] [blame]
<!doctype html>
<html>
<head>
<script src="../../http/tests/inspector/resources/protocol-test.js"></script>
<script>
function test()
{
let suite = ProtocolTest.createAsyncSuite("ProtocolTest.TestPage.dispatchEventToFrontend");
suite.addTestCase({
name: "ProtocolTest.TestPage.dispatchEventToFrontend",
description: "Ensure TestPage.dispatchEventToFrontend works with a ProtocolTest.",
test(resolve, reject) {
ProtocolTest.awaitEvent("MyEvent")
.then((event) => {
ProtocolTest.pass("Received Event");
ProtocolTest.expectThat(event.type === "MyEvent", "Event name should be the event dispatched.");
ProtocolTest.expectThat(event.data.count === 1, "Event data should be included.");
})
.then(resolve, reject);
ProtocolTest.evaluateInPage("TestPage.dispatchEventToFrontend('MyEvent', {count: 1})");
},
});
suite.runTestCasesAndFinish();
}
</script>
</head>
<body onLoad="runTest()">
</body>
</html>