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

Unified Diff: third_party/WebKit/LayoutTests/editing/pasteboard/drag-drop-url-with-style.html

Issue 2696083003: Convert drag-drop-url-with-style.html to utilize w3c test harness (Closed)
Patch Set: 2017-02-15T17:48:10 Created 3 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 | « no previous file | third_party/WebKit/LayoutTests/editing/pasteboard/drag-drop-url-with-style-expected.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/LayoutTests/editing/pasteboard/drag-drop-url-with-style.html
diff --git a/third_party/WebKit/LayoutTests/editing/pasteboard/drag-drop-url-with-style.html b/third_party/WebKit/LayoutTests/editing/pasteboard/drag-drop-url-with-style.html
index 9bdcca8042ae505c327784ad67161f1c78d44a75..91e5f11d96e9fded61a8bbbcfa53aa640d539e48 100644
--- a/third_party/WebKit/LayoutTests/editing/pasteboard/drag-drop-url-with-style.html
+++ b/third_party/WebKit/LayoutTests/editing/pasteboard/drag-drop-url-with-style.html
@@ -1,40 +1,50 @@
-<!DOCTYPE html>
-<html>
-<body>
-<p id="description">This tests dragging and dropping a URL. The content before and after the drag and drop should match.</p>
-<div contenteditable><a href="http://webkit.org/" title="some title" target="_blank" style="color:orange">drag me</a></div>
-<p>to the box blow:</p>
-<div id="destination" contenteditable ondrop="setTimeout(dump, 0);" style="border: solid 2px blue; padding: 5px;"><br></div>
-<script src="../../resources/dump-as-markup.js"></script>
+<!doctype html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<script src="../assert_selection.js"></script>
<script>
-
-Markup.waitUntilDone();
-
-Markup.description(document.getElementById('description').textContent);
-
-var target = document.getElementsByTagName("a")[0];
-getSelection().selectAllChildren(target);
-Markup.dump(target.parentNode, 'before');
-
-function dump() {
- Markup.dump('destination', 'after');
- Markup.notifyDone();
-}
-
-if (window.eventSender) {
- var x = target.offsetLeft + target.offsetWidth / 2;
- var y = target.offsetTop + target.offsetHeight / 2;
- eventSender.mouseMoveTo(x, y);
- eventSender.mouseDown();
-
- var destination = document.getElementById("destination");
- eventSender.leapForward(300);
- eventSender.mouseMoveTo(destination.offsetLeft + 10, destination.offsetTop + destination.offsetHeight / 2);
- eventSender.mouseUp();
-
- setTimeout(function () { destination.innerHTML = 'FAIL'; dump(); }, 100);
+function computePoint(selection, target) {
+ const x = selection.document.offsetLeft + target.offsetLeft +
+ target.offsetWidth / 2;
+ const y = selection.document.offsetTop + target.offsetTop +
+ target.offsetHeight / 2;
+ return {x, y};
}
+test(() => {
+ if (!window.eventSender) {
+ assert_unreached('This test requires eventSender.');
+ return;
+ }
+
+ assert_selection(
+ [
+ '<div contenteditable>',
+ '<a href="http://dev.chromium.org/"',
+ ' title="some title" style="color:orange">^drag me|</a>',
+ '</div>',
+ '<p>to the box blow:</p>',
+ '<div contenteditable id="drop"><br></div>',
+ ].join(''),
+ selection => {
+ const source = selection.document.querySelector('a');
+ const sourcePoint = computePoint(selection, source);
+ eventSender.mouseMoveTo(sourcePoint.x, sourcePoint.y);
+ eventSender.mouseDown();
+
+ const drop = selection.document.getElementById('drop');
+ const dropPoint = computePoint(selection, drop);
+ eventSender.leapForward(300);
+ eventSender.mouseMoveTo(dropPoint.x, dropPoint.y);
+ eventSender.mouseUp();
+ },
+ [
+ '<div contenteditable></div>',
+ '<p>to the box blow:</p>',
+ '<div contenteditable id="drop">',
+ '<a href="http://dev.chromium.org/"',
+ ' style="color: orange;" title="some title">^drag me|</a>',
+ '</div>',
+ ].join(''));
+}, 'Drag-and-Drop should keep attributes of A');
</script>
-</body>
-</html>
« no previous file with comments | « no previous file | third_party/WebKit/LayoutTests/editing/pasteboard/drag-drop-url-with-style-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698