OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script src="../../resources/js-test.js"></script> | 4 <script src="../../resources/js-test.js"></script> |
5 <script src="resources/util.js"></script> | 5 <script src="resources/util.js"></script> |
6 </head> | 6 </head> |
7 <body> | 7 <body> |
8 <div id="container"> | 8 <div id="container"> |
9 <div id="destination" contentEditable></div> | 9 <div id="destination" contentEditable></div> |
10 </div> | 10 </div> |
11 | 11 |
12 <script> | 12 <script> |
13 | 13 |
14 description("Spellcheck should not crash after the text has changed and results
are served from cache." | 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, enabl
e 'Ask Google for Suggestions', type 'Spell wellcome. Is it broken?', delete the
words 'Is it broken?', and context-click on the word 'wellcome'." | 15 + " To test manually, launch Chromium compiled with Address Sanitizer, enabl
e '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."); | 16 + " The test succeeds when the browser does not crash and shows suggestions
in the context menu."); |
17 | 17 |
18 initSpellTest("destination", "Spell wellcome. Is it broken?", function(textNode)
{ | 18 initSpellTest("destination", "Spell wellcome. Is it broken?", function(textNode)
{ |
19 // Select the text "Is it broken?". | 19 // Select the text "Is it broken?". |
20 var deleteRange = document.createRange(); | 20 var deleteRange = document.createRange(); |
21 deleteRange.setStart(textNode, 15); | 21 deleteRange.setStart(textNode, 15); |
22 deleteRange.setEnd(textNode, 29); | 22 deleteRange.setEnd(textNode, 29); |
23 window.getSelection().removeAllRanges(); | 23 window.getSelection().removeAllRanges(); |
24 window.getSelection().addRange(deleteRange); | 24 window.getSelection().addRange(deleteRange); |
25 shouldBeEqualToString("window.getSelection().toString()", " Is it broken?"); | 25 shouldBeEqualToString("window.getSelection().toString()", " Is it broken?"); |
26 // Del key to delete the text "Is it broken?". | 26 // Del key to delete the text "Is it broken?". |
27 eventSender.keyDown(String.fromCharCode(0x007F), null); | 27 eventSender.keyDown("delete", null); |
28 | 28 |
29 // Context click to show the context menu. | 29 // Context click to show the context menu. |
30 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 50; | 30 var x = destination.offsetParent.offsetLeft + destination.offsetLeft + 50; |
31 var y = destination.offsetParent.offsetTop + destination.offsetTop + destina
tion.offsetHeight / 2; | 31 var y = destination.offsetParent.offsetTop + destination.offsetTop + destina
tion.offsetHeight / 2; |
32 eventSender.mouseMoveTo(x, y); | 32 eventSender.mouseMoveTo(x, y); |
33 contextMenuElements = eventSender.contextClick(); | 33 contextMenuElements = eventSender.contextClick(); |
34 // Esc key to hide the context menu. | 34 // Esc key to hide the context menu. |
35 eventSender.keyDown(String.fromCharCode(0x001B), null); | 35 eventSender.keyDown("escape", null); |
36 | 36 |
37 document.getElementById("destination").innerHTML = ""; | 37 document.getElementById("destination").innerHTML = ""; |
38 }); | 38 }); |
39 | 39 |
40 </script> | 40 </script> |
41 </body> | 41 </body> |
42 </html> | 42 </html> |
OLD | NEW |