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

Unified Diff: third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html

Issue 2575303002: Fix webkitdropzone to accept file drops on non-file: page. (Closed)
Patch Set: jsbell feedback Created 4 years 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 | « no previous file | third_party/WebKit/LayoutTests/http/tests/dnd/resources/dragged-file.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html
diff --git a/third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html b/third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html
new file mode 100644
index 0000000000000000000000000000000000000000..2b6c44cb6aa804da2e96414965c8e351d710d20d
--- /dev/null
+++ b/third_party/WebKit/LayoutTests/http/tests/dnd/drop-file-on-webkitdropzone.html
@@ -0,0 +1,50 @@
+<!doctype html>
+<meta charset="utf-8">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+#dropzone {
+ display: block;
+ border: 1px solid black;
+ width: 200px;
+ height: 200px;
+}
+</style>
+
+<p>
+ Please download <a download href="resources/dragged-file.txt">this file</a>,
+ and drag it into the box below.
+</p>
+
+<div id="dropzone" webkitdropzone="copy file:text/plain">
+ Drop Here
+</div>
+
+<script>
+
+async_test(t => {
+ const dropZone = document.querySelector('#dropzone');
+ dropZone.ondrop = t.step_func_done(event => {
+ event.preventDefault(); // Needed to prevent drop navigation.
+
+ const dataTransfer = event.dataTransfer;
+ assert_equals(dataTransfer.items.length, 1);
+ const item = dataTransfer.items[0];
+ assert_equals(item.kind, 'file');
+ assert_equals(item.type, 'text/plain'); // application/x-moz-file in FF
+ const file = item.getAsFile();
+ assert_equals(file.name, 'dragged-file.txt');
+ assert_equals(file.type, 'text/plain');
+ });
+
+ const clientRect = dropZone.getBoundingClientRect();
+ if (window.eventSender) {
+ eventSender.beginDragWithFiles(['resources/dragged-file.txt']);
+ const centerX = (clientRect.left + clientRect.right) / 2;
+ const centerY = (clientRect.top + clientRect.bottom) / 2;
+ eventSender.mouseMoveTo(centerX, centerY);
+ eventSender.mouseUp();
+ }
+}, 'webkitdropzone element receives file drop on page served from HTTP');
+
+</script>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/http/tests/dnd/resources/dragged-file.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698