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

Side by Side Diff: LayoutTests/editing/selection/context-menu-text-selection.html

Issue 484353004: Test tidying: use "escape" and "backspace" with eventSender.keyDown() (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: More quoting consistency wibbles Created 6 years, 4 months 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 unified diff | Download patch
OLDNEW
1 <body onload="load()"> 1 <body onload="load()">
2 <p>This test checks that triggering the context menu selects/doesn't select as p latform-appropriate.</p> 2 <p>This test checks that triggering the context menu selects/doesn't select as p latform-appropriate.</p>
3 <div id="text">Lorem ipsum</div> 3 <div id="text">Lorem ipsum</div>
4 <div id="resultmac">RUNNING</div> 4 <div id="resultmac">RUNNING</div>
5 <div id="resultwin">RUNNING</div> 5 <div id="resultwin">RUNNING</div>
6 <div id="resultunix">RUNNING</div> 6 <div id="resultunix">RUNNING</div>
7 <div id="resultandroid">RUNNING</div> 7 <div id="resultandroid">RUNNING</div>
8 </body> 8 </body>
9 <script> 9 <script>
10 function test(platform, selectionExpected, result) 10 function test(platform, selectionExpected, result)
11 { 11 {
12 // clear selection 12 // clear selection
13 window.getSelection().removeAllRanges(); 13 window.getSelection().removeAllRanges();
14 14
15 internals.settings.setEditingBehavior(platform); 15 internals.settings.setEditingBehavior(platform);
16 16
17 var text = document.getElementById("text"); 17 var text = document.getElementById("text");
18 18
19 var x = text.offsetParent.offsetLeft + text.offsetLeft + 4; 19 var x = text.offsetParent.offsetLeft + text.offsetLeft + 4;
20 var y = text.offsetParent.offsetTop + text.offsetTop + text.offsetHeight / 2 ; 20 var y = text.offsetParent.offsetTop + text.offsetTop + text.offsetHeight / 2 ;
21 21
22 eventSender.mouseMoveTo(x, y); 22 eventSender.mouseMoveTo(x, y);
23 eventSender.contextClick(); 23 eventSender.contextClick();
24 // esc key to kill the context menu 24 // esc key to kill the context menu
25 eventSender.keyDown(String.fromCharCode(0x001B), null); 25 eventSender.keyDown("escape", null);
26 26
27 var resultElement = document.getElementById(result); 27 var resultElement = document.getElementById(result);
28 var selectionType = window.getSelection().type; 28 var selectionType = window.getSelection().type;
29 if (selectionExpected) { 29 if (selectionExpected) {
30 if (selectionType == "Range") 30 if (selectionType == "Range")
31 resultElement.innerHTML = "SUCCESS"; 31 resultElement.innerHTML = "SUCCESS";
32 else 32 else
33 resultElement.innerHTML = "FAILURE: There should be a selection."; 33 resultElement.innerHTML = "FAILURE: There should be a selection.";
34 } else { 34 } else {
35 if (selectionType == "Range") 35 if (selectionType == "Range")
36 resultElement.innerHTML = "FAILURE: There shouldn't be a selection." ; 36 resultElement.innerHTML = "FAILURE: There shouldn't be a selection." ;
37 else 37 else
38 resultElement.innerHTML = "SUCCESS"; 38 resultElement.innerHTML = "SUCCESS";
39 } 39 }
40 } 40 }
41 41
42 function load() 42 function load()
43 { 43 {
44 if (!window.eventSender || !window.testRunner || !window.internals) 44 if (!window.eventSender || !window.testRunner || !window.internals)
45 return; 45 return;
46 46
47 testRunner.dumpAsText(); 47 testRunner.dumpAsText();
48 48
49 test('mac', true, 'resultmac'); 49 test('mac', true, 'resultmac');
50 test('win', false, 'resultwin'); 50 test('win', false, 'resultwin');
51 test('unix', false, 'resultunix'); 51 test('unix', false, 'resultunix');
52 test('android', false, 'resultandroid'); 52 test('android', false, 'resultandroid');
53 } 53 }
54 </script> 54 </script>
OLDNEW
« no previous file with comments | « LayoutTests/editing/selection/5354455-1.html ('k') | LayoutTests/editing/spelling/input-type-text.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698