Commit 5423aa48 authored by Xiaocheng Hu's avatar Xiaocheng Hu Committed by Commit Bot

Convert editing/spelling/spellcheck-async-remove-frame.html with spellcheck_test

This patch converts the layout test to use spellcheck_test, so that the
test remains valid after we remove the non-idle-time spellcheck code
path.

Bug: 757525
Change-Id: I15859a271baaa59e99b77a7862610a8f8b92f1b4
Reviewed-on: https://chromium-review.googlesource.com/627037
Commit-Queue: Yoshifumi Inoue <yosin@chromium.org>
Reviewed-by: default avatarYoshifumi Inoue <yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496612}
parent 224c043b
<!DOCTYPE html>
<html>
<head>
<script src="../../resources/testharness.js"></script>
<script src="../../resources/testharnessreport.js"></script>
<script src="../assert_selection.js"></script>
<script src="spellcheck_test.js"></script>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
testRunner.setMockSpellCheckerEnabled(true);
}
spellcheck_test(
'<iframe></iframe>',
parentDocument => {
const iframe = parentDocument.querySelector('iframe');
const document = iframe.contentDocument;
document.documentElement.contentEditable = true;
document.documentElement.focus();
document.execCommand('insertText', false, 'zz.');
function runTest() {
var textToSelect = "This text should be selected, but this frame shouldn't be focused.";
var frame = document.getElementById("frame");
var s = frame.contentDocument.getSelection();
s.collapse(frame.contentDocument.body, 0);
frame.contentDocument.execCommand("InsertText", false, textToSelect);
frame.parentNode.removeChild(frame);
window.setTimeout(function() {
if (window.testRunner)
testRunner.notifyDone();
}, 50);
}
if (window.internals && internals.runtimeFlags.idleTimeSpellCheckingEnabled)
internals.runIdleTimeSpellChecker(document);
// Remove frame after sending the spellcheck request and before its response.
iframe.remove();
},
'',
'Spellchecker should not crash when frame is removed.');
</script>
</head>
<body>
<div>PASS unless crash.</div>
<iframe id="frame" src="../resources/contenteditable-iframe-src.html" onload="runTest();"></iframe>
</body>
</html>
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