4 <script src=
"../../resources/js-test.js"></script>
5 <script src=
"resources/util.js"></script>
9 <div id=
"destination" contentEditable
></div>
14 description("Spellcheck should not crash after the text has changed and results are served from cache."
15 + " To test manually, launch Chromium compiled with Address Sanitizer, enable 'Ask Google for Suggestions', type 'Spell wellcome. Is it broken?', delete the words 'Is it broken?', and context-click on the word 'wellcome'."
16 + " The test succeeds when the browser does not crash and shows suggestions in the context menu.");
18 initSpellTest("destination", "Spell wellcome. Is it broken?", function(textNode
) {
19 // Select the text "Is it broken?".
20 var deleteRange
= document
.createRange();
21 deleteRange
.setStart(textNode
, 15);
22 deleteRange
.setEnd(textNode
, 29);
23 window
.getSelection().removeAllRanges();
24 window
.getSelection().addRange(deleteRange
);
25 shouldBeEqualToString("window.getSelection().toString()", " Is it broken?");
26 // Del key to delete the text "Is it broken?".
27 eventSender
.keyDown("delete", null);
29 // Context click to show the context menu.
30 var x
= destination
.offsetParent
.offsetLeft
+ destination
.offsetLeft
+ 50;
31 var y
= destination
.offsetParent
.offsetTop
+ destination
.offsetTop
+ destination
.offsetHeight
/ 2;
32 eventSender
.mouseMoveTo(x
, y
);
33 contextMenuElements
= eventSender
.contextClick();
34 // Esc key to hide the context menu.
35 eventSender
.keyDown("escape", null);
37 document
.getElementById("destination").innerHTML
= "";