Index: chrome/test/data/webui/menu_test.html |
diff --git a/chrome/test/data/webui/menu_test.html b/chrome/test/data/webui/menu_test.html |
index 7e0e9205a06d1766491e64abf1a9c0e387aebfd6..83b188fcbdce611a62d4816a20f210340fdc9942 100644 |
--- a/chrome/test/data/webui/menu_test.html |
+++ b/chrome/test/data/webui/menu_test.html |
@@ -18,6 +18,36 @@ function testHandleMouseOver() { |
assertTrue(called); |
} |
+function testHandleMouseUp() { |
+ var realNow = Date.now; |
+ Date.now = function() { return 10; }; |
+ |
+ var menu = new cr.ui.Menu; |
+ menu.show({x: 5, y: 5}); |
+ |
+ function mouseUpAt(x, y) { |
+ return menu.dispatchEvent(new MouseEvent('mouseup', { |
+ bubbles: true, |
+ cancelable: true, |
+ target: menu, |
+ screenX: x, |
+ screenY: y, |
+ })); |
+ } |
+ |
+ // Stop mouseups at the same time and position. |
+ assertFalse(mouseUpAt(5, 5)); |
+ |
+ // Allow mouseups with different positions but the same time. |
+ assertTrue(mouseUpAt(50, 50)); |
+ |
+ // Alow mouseups with the same position but different times. |
+ Date.now = function() { return 1000; }; |
+ assertTrue(mouseUpAt(5, 5)); |
+ |
+ Date.now = realNow; |
+} |
+ |
</script> |
</body> |
</html> |