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

Unified Diff: LayoutTests/inspector/console/console-custom-formatters.html

Issue 1096283003: Devtools:[CustomFormatter] Allow object tags in headers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add self reference test Created 5 years, 8 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/inspector/console/console-custom-formatters.html
diff --git a/LayoutTests/inspector/console/console-custom-formatters.html b/LayoutTests/inspector/console/console-custom-formatters.html
index 09464db234f91358ca9f67cd6b9a8daf2a55ae19..4aa79c17fc737a7fa515992645864d51512ea691 100644
--- a/LayoutTests/inspector/console/console-custom-formatters.html
+++ b/LayoutTests/inspector/console/console-custom-formatters.html
@@ -53,14 +53,80 @@ var formatter2 = {
}
};
-window.devtoolsFormatters = [formatter1, formatter2];
+var configTest = {};
+var formatterWithConfig1 = {
+ header: function(x, config)
+ {
+ if (x !== configTest || config)
+ return null;
+
+ return ["span", {}, "Formatter with config ", ["object", {"object": x, "config": {"info": "additional info"}}]];
+ },
+
+ hasBody: function(x)
+ {
+ return false;
+ },
+
+ body: function(x)
+ {
+ throw "Unreachable"
+ }
+}
+
+var formatterWithConfig2 = {
+ header: function(x, config)
+ {
+ if (x !== configTest || !config)
+ return null;
+
+ return ["span", {}, "Header ", "info: ", config.info];
+ },
+
+ hasBody: function(x, config)
+ {
+ return config && config.info;
+ },
+
+ body: function(x, config)
+ {
+ return ["span", {}, "body", "info: ", config.info]
+ }
+}
+
+var selfReferenceTest = {};
+var selfReferencingFormatter = {
+ header: function(x)
+ {
+ if (x !== selfReferenceTest)
+ return null;
+
+ return ["span", {}, "Formatter with config ", ["object", {"object": x}]];
+ },
+
+ hasBody: function(x)
+ {
+ return false;
+ },
+
+ body: function(x)
+ {
+ throw "Unreachable"
+ }
+
+}
+
+window.devtoolsFormatters = [formatter1, formatter2, formatterWithConfig1, formatterWithConfig2, selfReferencingFormatter];
function logVars()
{
console.log(a);
console.log(b);
console.log(c);
- window.devtoolsFormatters = [formatter2, formatter1];
+ console.log(configTest);
+ console.log(selfReferenceTest);
+ //swap first formatters: test that header+body should be generated by the same formatter
+ window.devtoolsFormatters = [formatter2, formatter1, formatterWithConfig1, formatterWithConfig2, selfReferencingFormatter];
}
function test()

Powered by Google App Engine
This is Rietveld 408576698