Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(157)

Unified Diff: LayoutTests/fast/forms/file/resources/file-drag-common.js

Issue 148983008: Reduce test code duplication in fast/forms/file (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/fast/forms/file/recover-file-input-in-unposted-form.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
+}
« no previous file with comments | « LayoutTests/fast/forms/file/recover-file-input-in-unposted-form.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698