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..3b39e98f7f1bace01bf9a9389fb214cc3293853d |
--- /dev/null |
+++ b/content/test/data/drag_and_drop/event_monitoring.js |
@@ -0,0 +1,33 @@ |
+// 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); |
+ |
+ window.domAutomationController.setAutomationId(0); |
Łukasz Anforowicz
2016/11/01 23:43:42
The line above tells the renderer to enable window
|
+ 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 |
+ }); |
+} |