Index: LayoutTests/fast/forms/file/resources/file-drag-common.js |
diff --git a/LayoutTests/fast/forms/file/resources/file-drag-common.js b/LayoutTests/fast/forms/file/resources/file-drag-common.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..224e2b0f864d178af5889bfb5fcd0f72246e10e5 |
--- /dev/null |
+++ b/LayoutTests/fast/forms/file/resources/file-drag-common.js |
@@ -0,0 +1,19 @@ |
+function moveMouseToCenterOfElement(element) { |
+ var centerX = element.offsetLeft + element.offsetWidth / 2; |
+ var centerY = element.offsetTop + element.offsetHeight / 2; |
+ eventSender.mouseMoveTo(centerX, centerY); |
+} |
+ |
+function dragFilesOntoInput(input, files) { |
+ eventSender.beginDragWithFiles(files); |
+ moveMouseToCenterOfElement(input); |
+ eventSender.mouseUp(); |
+} |
+ |
+function dragFilesOntoElement(element, files) { |
+ eventSender.beginDragWithFiles(files); |
+ var centerX = element.offsetLeft + element.offsetWidth / 2; |
+ var centerY = element.offsetTop + element.offsetHeight / 2; |
+ eventSender.mouseMoveTo(centerX, centerY); |
+ eventSender.mouseUp(); |
+} |