Commit 45b98e98 authored by yosin's avatar yosin Committed by Commit bot

Convert editing/execCommand/find-after-replace.html to use w3c test harness

This patch converts "editing/execCommand/find-after-replace.html" to use w3c
test harness to simplify test script for improving readability.

BUG=n/a
TEST=n/a; no behavior changes

Review-Url: https://codereview.chromium.org/2300553002
Cr-Commit-Position: refs/heads/master@{#415586}
parent 3df8ab51
<body onload="runTest()">
<!doctype html>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script>
if (window.testRunner)
testRunner.dumpEditingCallbacks();
test(() => {
assert_not_equals(window.internals, undefined,
'This test requires window.internals to access clipboard');
assert_selection(
'<div contenteditable>|a b a</div>',
selection => {
selection.document.execCommand('findString', false, 'a b');
selection.document.execCommand('copy');
selection.document.execCommand('findString', false, 'a');
selection.document.execCommand('paste');
},
'<div contenteditable>a b a b|</div>');
}, 'simulate find and replace');
</script>
<p>This tests find and replace inside an editable iframe. You should see 'A B A B' below. With bug 4462420, you would see 'A B B A'.</p>
<iframe src="../resources/contenteditable-iframe-src.html"></iframe>
<script>
function runTest() {
document.body.offsetTop;
var frame = frames[0];
var sel = frame.getSelection();
var doc = frame.document;
sel.collapse(doc.body, 0);
doc.execCommand("InsertText", false, "A B A");
sel.collapse(doc.body, 0);
doc.execCommand("FindString", false, "A B");
doc.execCommand("Copy");
doc.execCommand("FindString", false, "A");
doc.execCommand("Paste");
}
</script>
</body>
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow {P} at (0,0) size 784x40
LayoutText {#text} at (0,0) size 771x39
text run at (0,0) width 312: "This tests find and replace inside an editable iframe. "
text run at (312,0) width 459: "You should see 'A B A B' below. With bug 4462420, you would see 'A B B"
text run at (0,20) width 18: "A'."
LayoutBlockFlow (anonymous) at (0,56) size 784x154
LayoutText {#text} at (0,0) size 0x0
LayoutText {#text} at (0,0) size 0x0
layer at (8,64) size 304x154
LayoutIFrame {IFRAME} at (0,0) size 304x154 [border: (2px inset #EEEEEE)]
layer at (0,0) size 300x150
LayoutView at (0,0) size 300x150
layer at (0,0) size 300x150
LayoutBlockFlow {HTML} at (0,0) size 300x150
LayoutBlockFlow {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
LayoutText {#text} at (0,0) size 54x19
text run at (0,0) width 54: "A B A B"
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow {P} at (0,0) size 784x36
LayoutText {#text} at (0,0) size 770x36
text run at (0,0) width 337: "This tests find and replace inside an editable iframe. "
text run at (336,0) width 434: "You should see 'A B A B' below. With bug 4462420, you would see"
text run at (0,18) width 67: "'A B B A'."
LayoutBlockFlow (anonymous) at (0,52) size 784x154
LayoutText {#text} at (0,0) size 0x0
LayoutText {#text} at (0,0) size 0x0
layer at (8,60) size 304x154
LayoutIFrame {IFRAME} at (0,0) size 304x154 [border: (2px inset #EEEEEE)]
layer at (0,0) size 300x150
LayoutView at (0,0) size 300x150
layer at (0,0) size 300x150
LayoutBlockFlow {HTML} at (0,0) size 300x150
LayoutBlockFlow {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
LayoutText {#text} at (0,0) size 57x18
text run at (0,0) width 57: "A B A B"
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChangeSelection:WebViewDidChangeSelectionNotification
EDITING DELEGATE: webViewDidChange:WebViewDidChangeNotification
layer at (0,0) size 800x600
LayoutView at (0,0) size 800x600
layer at (0,0) size 800x600
LayoutBlockFlow {HTML} at (0,0) size 800x600
LayoutBlockFlow {BODY} at (8,8) size 784x584
LayoutBlockFlow {P} at (0,0) size 784x36
LayoutText {#text} at (0,0) size 771x35
text run at (0,0) width 338: "This tests find and replace inside an editable iframe. "
text run at (337,0) width 434: "You should see 'A B A B' below. With bug 4462420, you would see"
text run at (0,18) width 67: "'A B B A'."
LayoutBlockFlow (anonymous) at (0,52) size 784x154
LayoutText {#text} at (0,0) size 0x0
LayoutText {#text} at (0,0) size 0x0
layer at (8,60) size 304x154
LayoutIFrame {IFRAME} at (0,0) size 304x154 [border: (2px inset #EEEEEE)]
layer at (0,0) size 300x150
LayoutView at (0,0) size 300x150
layer at (0,0) size 300x150
LayoutBlockFlow {HTML} at (0,0) size 300x150
LayoutBlockFlow {BODY} at (8,8) size 284x134 [bgcolor=#FFFFE0]
LayoutText {#text} at (0,0) size 57x17
text run at (0,0) width 57: "A B A B"
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment