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

Unified Diff: LayoutTests/http/tests/inspector/console-test.js

Issue 23717011: DevTools: Use scriptId for resolving stack frames in console messages (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed tests Created 7 years, 3 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 side-by-side diff with in-line comments
Download patch
Index: LayoutTests/http/tests/inspector/console-test.js
diff --git a/LayoutTests/http/tests/inspector/console-test.js b/LayoutTests/http/tests/inspector/console-test.js
index 1b759bb4f6f19f8718b06fc66ff1ee03f1219bd7..f372c644788bbd0bd0b330793b85d17e829e7006 100644
--- a/LayoutTests/http/tests/inspector/console-test.js
+++ b/LayoutTests/http/tests/inspector/console-test.js
@@ -6,6 +6,18 @@ InspectorTest.showConsolePanel = function()
WebInspector.drawer.immediatelyFinishAnimation();
}
+InspectorTest.prepareConsoleMessageText = function(messageElement)
+{
+ var messageText = messageElement.textContent.replace(/\u200b/g, "");
+ // Replace scriptIds with generic scriptId string to avoid flakiness.
+ messageText = messageText.replace(/\[VM\]\s+\(\d+\)/g, "[VM] (scriptId)");
+ // Strip out InjectedScript from stack traces to avoid rebaselining each time InjectedScriptSource is edited.
+ messageText = messageText.replace(/InjectedScript[\.a-zA-Z_]+ \[VM\] \(scriptId\):\d+/g, "");
+ // The message might be extremely long in case of dumping stack overflow message.
+ messageText = messageText.substring(0, 1024);
+ return messageText;
+}
+
InspectorTest.dumpConsoleMessages = function(printOriginatingCommand, dumpClassNames)
{
var result = [];
@@ -22,7 +34,8 @@ InspectorTest.dumpConsoleMessages = function(printOriginatingCommand, dumpClassN
}
}
- InspectorTest.addResult(element.textContent.replace(/\u200b/g, "") + (dumpClassNames ? " " + classNames.join(" > ") : ""));
+ var messageText = InspectorTest.prepareConsoleMessageText(element)
+ InspectorTest.addResult(messageText + (dumpClassNames ? " " + classNames.join(" > ") : ""));
if (printOriginatingCommand && message.originatingCommand) {
var originatingElement = message.originatingCommand.toMessageElement();
InspectorTest.addResult("Originating from: " + originatingElement.textContent.replace(/\u200b/g, ""));
@@ -37,7 +50,8 @@ InspectorTest.dumpConsoleMessagesWithStyles = function(sortMessages)
var indices = WebInspector.consoleView._visibleMessagesIndices;
for (var i = 0; i < indices.length; ++i) {
var element = WebInspector.console.messages[indices[i]].toMessageElement();
- InspectorTest.addResult(element.textContent.replace(/\u200b/g, ""));
+ var messageText = InspectorTest.prepareConsoleMessageText(element)
+ InspectorTest.addResult(messageText);
var spans = element.querySelectorAll(".console-message-text > span > span");
for (var j = 0; j < spans.length; j++)
InspectorTest.addResult("Styled text #" + j + ": " + (spans[j].style.cssText || "NO STYLES DEFINED"));
@@ -49,7 +63,8 @@ InspectorTest.dumpConsoleMessagesWithClasses = function(sortMessages) {
var indices = WebInspector.consoleView._visibleMessagesIndices;
for (var i = 0; i < indices.length; ++i) {
var element = WebInspector.console.messages[indices[i]].toMessageElement();
- result.push(element.textContent.replace(/\u200b/g, "") + " " + element.getAttribute("class"));
+ var messageText = InspectorTest.prepareConsoleMessageText(element)
+ result.push(messageText + " " + element.getAttribute("class"));
}
if (sortMessages)
result.sort();

Powered by Google App Engine
This is Rietveld 408576698