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

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/editor/editor-test.js

Issue 2100243002: Remove non-standardize key code names from event_sender. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix inspector tests that were missed by sed Created 4 years, 5 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 function initialize_EditorTests() 1 function initialize_EditorTests()
2 { 2 {
3 3
4 InspectorTest.createTestEditor = function(clientHeight, textEditorDelegate) 4 InspectorTest.createTestEditor = function(clientHeight, textEditorDelegate)
5 { 5 {
6 var textEditor = new WebInspector.CodeMirrorTextEditor("", textEditorDelegat e || new WebInspector.TextEditorDelegate()); 6 var textEditor = new WebInspector.CodeMirrorTextEditor("", textEditorDelegat e || new WebInspector.TextEditorDelegate());
7 clientHeight = clientHeight || 100; 7 clientHeight = clientHeight || 100;
8 textEditor.element.style.height = clientHeight + "px"; 8 textEditor.element.style.height = clientHeight + "px";
9 textEditor.element.style.flex = "none"; 9 textEditor.element.style.flex = "none";
10 textEditor.show(WebInspector.inspectorView.element); 10 textEditor.show(WebInspector.inspectorView.element);
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
59 59
60 InspectorTest.typeIn = function(editor, typeText, callback) 60 InspectorTest.typeIn = function(editor, typeText, callback)
61 { 61 {
62 callback = callback || new Function(); 62 callback = callback || new Function();
63 var noop = new Function(); 63 var noop = new Function();
64 for(var charIndex = 0; charIndex < typeText.length; ++charIndex) { 64 for(var charIndex = 0; charIndex < typeText.length; ++charIndex) {
65 // As soon as the last key event was processed, the whole text was proce ssed. 65 // As soon as the last key event was processed, the whole text was proce ssed.
66 var iterationCallback = charIndex + 1 === typeText.length ? callback : n oop; 66 var iterationCallback = charIndex + 1 === typeText.length ? callback : n oop;
67 switch (typeText[charIndex]) { 67 switch (typeText[charIndex]) {
68 case "\n": 68 case "\n":
69 InspectorTest.fakeKeyEvent(editor, "enter", null, iterationCallback) ; 69 InspectorTest.fakeKeyEvent(editor, "Enter", null, iterationCallback) ;
70 break; 70 break;
71 case "L": 71 case "L":
72 InspectorTest.fakeKeyEvent(editor, "leftArrow", null, iterationCallb ack); 72 InspectorTest.fakeKeyEvent(editor, "ArrowLeft", null, iterationCallb ack);
73 break; 73 break;
74 case "R": 74 case "R":
75 InspectorTest.fakeKeyEvent(editor, "rightArrow", null, iterationCall back); 75 InspectorTest.fakeKeyEvent(editor, "ArrowRight", null, iterationCall back);
76 break; 76 break;
77 case "U": 77 case "U":
78 InspectorTest.fakeKeyEvent(editor, "upArrow", null, iterationCallbac k); 78 InspectorTest.fakeKeyEvent(editor, "ArrowUp", null, iterationCallbac k);
79 break; 79 break;
80 case "D": 80 case "D":
81 InspectorTest.fakeKeyEvent(editor, "downArrow", null, iterationCallb ack); 81 InspectorTest.fakeKeyEvent(editor, "ArrowDown", null, iterationCallb ack);
82 break; 82 break;
83 default: 83 default:
84 InspectorTest.fakeKeyEvent(editor, typeText[charIndex], null, iterat ionCallback); 84 InspectorTest.fakeKeyEvent(editor, typeText[charIndex], null, iterat ionCallback);
85 } 85 }
86 } 86 }
87 } 87 }
88 88
89 var eventCodes = { 89 var eventCodes = {
90 enter: 13, 90 Enter: 13,
91 home: 36, 91 Home: 36,
92 leftArrow: 37, 92 ArrowLeft: 37,
93 upArrow: 38, 93 ArrowUp: 38,
94 rightArrow: 39, 94 ArrowRight: 39,
95 downArrow: 40 95 ArrowDown: 40
96 }; 96 };
97 97
98 function createCodeMirrorFakeEvent(eventType, code, charCode, modifiers) 98 function createCodeMirrorFakeEvent(eventType, code, charCode, modifiers)
99 { 99 {
100 function eventPreventDefault() 100 function eventPreventDefault()
101 { 101 {
102 this._handled = true; 102 this._handled = true;
103 } 103 }
104 var event = { 104 var event = {
105 _handled: false, 105 _handled: false,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
199 var keyName = sortedKeys[i]; 199 var keyName = sortedKeys[i];
200 if (!keyName.length) 200 if (!keyName.length)
201 keyName = "<Empty string>"; 201 keyName = "<Empty string>";
202 else 202 else
203 keyName = "'" + keyName + "'"; 203 keyName = "'" + keyName + "'";
204 InspectorTest.addResult(keyName + ": " + listHashMap[sortedKeys[i]]); 204 InspectorTest.addResult(keyName + ": " + listHashMap[sortedKeys[i]]);
205 } 205 }
206 } 206 }
207 207
208 } 208 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698