<!DOCTYPE html>
<html>
<body>
<p>This test ensures that a synthetic event dispatched on a plugin doesn't cause a crash.</p>
<embed id="plugin" type="application/x-webkit-test-webplugin"></embed>
<script>
if (window.testRunner) {
    testRunner.dumpAsText();
    testRunner.waitUntilDone();
}
var plugin = document.getElementById("plugin");

var listenerCalledCount = 0;
var eventTypes = ["touchmove", "gesturescrollstart", "mousewheel"];

eventTypes.forEach(function(eventType) {
    plugin.addEventListener(eventType, function(event) {
        listenerCalledCount++;
        if (listenerCalledCount == eventTypes.length) {
            if (window.testRunner) {
                testRunner.notifyDone();
            }
        }
    });
});

plugin.dispatchEvent(new PopStateEvent("touchmove", { bubbles: true, cancelable: true }));
plugin.dispatchEvent(new PopStateEvent("gesturescrollstart", { bubbles: true, cancelable: true }));
plugin.dispatchEvent(new PopStateEvent("mousewheel", { bubbles: true, cancelable: true }));
</script>
</body>
</html>
