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

Unified Diff: third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-008.html

Issue 1462823002: Make layout tests in editing/pasteboard to use w3c test harness (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 2015-11-20T10:44:42 Created 5 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
Index: third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-008.html
diff --git a/third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-008.html b/third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-008.html
index 37e10482fc55a98b5b5ba508809b4c4c39fb4adb..119553d2673b71470bc79225d874ac691c82edc4 100644
--- a/third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-008.html
+++ b/third_party/WebKit/LayoutTests/editing/pasteboard/smart-paste-008.html
@@ -1,21 +1,42 @@
+<!DOCTYPE html>
+<script src="../../resources/testharness.js"></script>
+<script src="../../resources/testharnessreport.js"></script>
+<p>There was a bug in paste's smart replace whitespace handling. In some cases,
+it used information gathered at the start of the selection being pasted into to
+decide whether or not a space needed to be added to the end of the incoming
+content.</p>
+<p>A smart paste is performed into a selection starting in one block and ending
+in another. Spaces should surround the pasted word.</p>
+<div id="sample" contenteditable="true"><div id="foo">foo</div><div id="bar">x bar</div></div>
+<div id="log"></div>
<script>
-if (window.testRunner)
- testRunner.dumpEditingCallbacks();
-</script>
-<p>There was a bug in paste's smart replace whitespace handling. In some cases, it used information gathered at the start of the selection being pasted into to decide whether or not a space needed to be added to the end of the incoming content.</p>
-<p>A smart paste is performed into a selection starting in one block and ending in another. Spaces should surround the pasted word.</p>
-<div id="test" contenteditable="true"><div>foo</div><div>x bar</div></div>
+test(function() {
+ var selection = window.getSelection();
+ var sample = document.getElementById('sample');
-<script type="text/javascript" src="../editing.js"></script>
-<script>
-var s = window.getSelection();
-var e = document.getElementById("test");
+ if (!window.internals && !window.eventSender)
+ return;
+
+ internals.settings.setEditingBehavior('win');
+
+ selection.setBaseAndExtent(sample, 0, sample, 0);
+ var rects = window.getSelection().getRangeAt(0).getClientRects();
+ var x = rects[0].left;
+ var y = rects[0].top;
+ eventSender.mouseMoveTo(x, y);
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ eventSender.mouseDown();
+ eventSender.mouseUp();
+ document.execCommand('copy');
+
+ selection.collapse(document.getElementById('foo').firstChild, 1);
+ selection.extend(document.getElementById('bar').firstChild, 1);
+ document.execCommand('paste');
-setSelectionCommand(e, 0, e, 0);
-doubleClickAtSelectionStart();
-copyCommand();
-moveSelectionBackwardByCharacterCommand();
-moveSelectionForwardByCharacterCommand();
-extendSelectionForwardByLineCommand();
-pasteCommand();
+ assert_equals(sample.innerHTML, '<div id="foo">f foo bar</div>', 'innerHTML');
+ assert_true(selection.isCollapsed, 'isCollapsed');
+ assert_equals(selection.anchorNode, document.getElementById('foo').firstChild, 'anchorNode');
+ assert_equals(selection.anchorOffset, 5, 'anchorOffset');
+});
</script>

Powered by Google App Engine
This is Rietveld 408576698