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

Side by Side Diff: third_party/WebKit/LayoutTests/http/tests/inspector/console-test.js

Issue 1733073002: Prepare inspector layout tests for ES2015 Function.name changes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 var initialize_ConsoleTest = function() { 1 var initialize_ConsoleTest = function() {
2 2
3 InspectorTest.preloadModule("source_frame"); 3 InspectorTest.preloadModule("source_frame");
4 InspectorTest.preloadPanel("console"); 4 InspectorTest.preloadPanel("console");
5 5
6 InspectorTest.evaluateInConsole = function(code, callback) 6 InspectorTest.evaluateInConsole = function(code, callback)
7 { 7 {
8 callback = InspectorTest.safeWrap(callback); 8 callback = InspectorTest.safeWrap(callback);
9 9
10 var consoleView = WebInspector.ConsolePanel._view(); 10 var consoleView = WebInspector.ConsolePanel._view();
(...skipping 15 matching lines...) Expand all
26 26
27 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_consoleMessag eAddedForTest", sniffer, opt_sticky); 27 InspectorTest.addSniffer(WebInspector.ConsoleView.prototype, "_consoleMessag eAddedForTest", sniffer, opt_sticky);
28 } 28 }
29 29
30 InspectorTest.evaluateInConsoleAndDump = function(code, callback) 30 InspectorTest.evaluateInConsoleAndDump = function(code, callback)
31 { 31 {
32 callback = InspectorTest.safeWrap(callback); 32 callback = InspectorTest.safeWrap(callback);
33 33
34 function mycallback(text) 34 function mycallback(text)
35 { 35 {
36 InspectorTest.addResult(code + " = " + text.replace(/\bVM\d+/g, "VM").re place(/InjectedScript\.\w+ @ VM:\d+/g, "")); 36 text = text.replace(/\bVM\d+/g, "VM");
37 text = text.replace(/(?:InjectedScript\.)?_?evaluate\w* @ VM:\d+/g, "");
38 InspectorTest.addResult(code + " = " + text);
37 callback(text); 39 callback(text);
38 } 40 }
39 InspectorTest.evaluateInConsole(code, mycallback); 41 InspectorTest.evaluateInConsole(code, mycallback);
40 } 42 }
41 43
42 InspectorTest.prepareConsoleMessageText = function(messageElement, consoleMessag e) 44 InspectorTest.prepareConsoleMessageText = function(messageElement, consoleMessag e)
43 { 45 {
44 var messageText = messageElement.deepTextContent().replace(/\u200b/g, ""); 46 var messageText = messageElement.deepTextContent().replace(/\u200b/g, "");
45 // Replace scriptIds with generic scriptId string to avoid flakiness. 47 // Replace scriptIds with generic scriptId string to avoid flakiness.
46 messageText = messageText.replace(/VM\d+/g, "VM"); 48 messageText = messageText.replace(/VM\d+/g, "VM");
47 // Strip out InjectedScript line numbers from stack traces to avoid rebaseli ning each time InjectedScriptSource is edited. 49 // Strip out InjectedScript line numbers from stack traces to avoid rebaseli ning each time InjectedScriptSource is edited.
48 messageText = messageText.replace(/InjectedScript\.\w+ @ VM:\d+/g, ""); 50 messageText = messageText.replace(/(?:InjectedScript\.)?_?evaluate\w* @ VM:\ d+/g, "");
49 // Strip out InjectedScript line numbers from console message anchor. 51 // Strip out InjectedScript line numbers from console message anchor.
50 var functionName = consoleMessage && consoleMessage.stackTrace && consoleMes sage.stackTrace.callFrames[0] && consoleMessage.stackTrace.callFrames[0].functio nName || ""; 52 var functionName = consoleMessage && consoleMessage.stackTrace && consoleMes sage.stackTrace.callFrames[0] && consoleMessage.stackTrace.callFrames[0].functio nName || "";
51 if (functionName.indexOf("InjectedScript") !== -1) 53 if (functionName.indexOf("InjectedScript") !== -1)
52 messageText = messageText.replace(/\bVM:\d+/, ""); // Only first replace . 54 messageText = messageText.replace(/\bVM:\d+/, ""); // Only first replace .
53 if (messageText.startsWith("Navigated to")) { 55 if (messageText.startsWith("Navigated to")) {
54 var fileName = messageText.split(" ").pop().split("/").pop(); 56 var fileName = messageText.split(" ").pop().split("/").pop();
55 messageText = "Navigated to " + fileName; 57 messageText = "Navigated to " + fileName;
56 } 58 }
57 // The message might be extremely long in case of dumping stack overflow mes sage. 59 // The message might be extremely long in case of dumping stack overflow mes sage.
58 messageText = messageText.substring(0, 1024); 60 messageText = messageText.substring(0, 1024);
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 { 126 {
125 function isNotEmptyLine(string) 127 function isNotEmptyLine(string)
126 { 128 {
127 return string.trim().length > 0; 129 return string.trim().length > 0;
128 } 130 }
129 131
130 function ignoreStackFrameAndMutableData(string) 132 function ignoreStackFrameAndMutableData(string)
131 { 133 {
132 var buffer = string.replace(/\u200b/g, ""); 134 var buffer = string.replace(/\u200b/g, "");
133 buffer = buffer.replace(/VM\d+/g, "VM"); 135 buffer = buffer.replace(/VM\d+/g, "VM");
134 buffer = buffer.replace(/InjectedScript\.\w+ @ VM:\d+/g, ""); 136 buffer = buffer.replace(/(?:InjectedScript\.)?_?evaluate\w* @ VM:\d+/g, "");
135 return buffer.replace(/^\s+at [^\]]+(]?)$/, "$1"); 137 return buffer.replace(/^\s+at [^\]]+(]?)$/, "$1");
136 } 138 }
137 139
138 messageFormatter = messageFormatter || InspectorTest.textContentWithLineBrea ks; 140 messageFormatter = messageFormatter || InspectorTest.textContentWithLineBrea ks;
139 var buffer = messageFormatter(node); 141 var buffer = messageFormatter(node);
140 return buffer.split("\n").map(ignoreStackFrameAndMutableData).filter(isNotEm ptyLine).join("\n"); 142 return buffer.split("\n").map(ignoreStackFrameAndMutableData).filter(isNotEm ptyLine).join("\n");
141 } 143 }
142 144
143 InspectorTest.simpleFormatter = function(element, message) 145 InspectorTest.simpleFormatter = function(element, message)
144 { 146 {
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
395 if (consoleView._visibleViewMessages.length === expectedCount) { 397 if (consoleView._visibleViewMessages.length === expectedCount) {
396 InspectorTest.addResult("Message count: " + expectedCount); 398 InspectorTest.addResult("Message count: " + expectedCount);
397 callback(); 399 callback();
398 } else { 400 } else {
399 InspectorTest.addSniffer(consoleView, "_messageAppendedForTests", ch eckAndReturn); 401 InspectorTest.addSniffer(consoleView, "_messageAppendedForTests", ch eckAndReturn);
400 } 402 }
401 } 403 }
402 } 404 }
403 405
404 } 406 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698