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

Unified Diff: content/test/data/drag_and_drop/event_monitoring.js

Issue 2453693003: Browser tests for OOPIF support for drag-n-drop. (Closed)
Patch Set: Addressed CR feedback from nick@. Created 4 years, 1 month 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 | « content/test/data/drag_and_drop/drop_target.html ('k') | content/test/data/drag_and_drop/image_source.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/test/data/drag_and_drop/event_monitoring.js
diff --git a/content/test/data/drag_and_drop/event_monitoring.js b/content/test/data/drag_and_drop/event_monitoring.js
new file mode 100644
index 0000000000000000000000000000000000000000..e27cf37f1fe7d58fc3bd2e6dd1c9ad921fe62075
--- /dev/null
+++ b/content/test/data/drag_and_drop/event_monitoring.js
@@ -0,0 +1,37 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+/* Reports an event to DragAndDropBrowserTest and DOMDragEventWaiter */
+window.reportDragAndDropEvent = function(ev) {
+ function safe(f) {
+ try {
+ return f();
+ } catch(err) {
+ return "exception: " + err.message;
+ }
+ }
+
+ console.log("got event: " + ev.type);
+
+ if (window.domAutomationController) {
+ window.domAutomationController.setAutomationId(0);
+ window.domAutomationController.send({
+ drop_effect: safe(function() { return ev.dataTransfer.dropEffect; }),
+ effect_allowed: safe(function() {
+ return ev.dataTransfer.effectAllowed;
+ }),
+ event_type: ev.type,
+ file_names: safe(function() {
+ return Array
+ .from(ev.dataTransfer.files)
+ .map(function(file) { return file.name; })
+ .sort().join();
+ }),
+ mime_types: safe(function() {
+ return Array.from(ev.dataTransfer.types).sort().join();
+ }),
+ window_name: window.name
+ });
+ }
+}
« no previous file with comments | « content/test/data/drag_and_drop/drop_target.html ('k') | content/test/data/drag_and_drop/image_source.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698