<html>
<head>
<script src="../resources/js-test.js"></script>
</head>
<body>
<embed id="touch_plugin" type="application/x-webkit-test-webplugin" accepts-touch="raw" re-request-touch="true"></embed>
<p id="description"></p>
<script>
description("This test ensures that we don't imbalance the touch event handler count if a plugin requests touch events more than once. The test passes if there are no touch event listeners after the plugin is removed, and there is no crash. Must be run in DRT.");
if (window.testRunner) {
testRunner.dumpAsText();
// Force the plugin to initialize
touch_plugin.offsetTop;
shouldBe("internals.touchStartOrMoveEventHandlerCount(document)", "1")
touch_plugin.parentNode.removeChild(touch_plugin);
shouldBe("internals.touchStartOrMoveEventHandlerCount(document)", "0")
}
</script>
</body>