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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 <html> 1 <html>
2 <head> 2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script> 3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/console-test.js"></script> 4 <script src="../../http/tests/inspector/console-test.js"></script>
5 <script> 5 <script>
6 6
7 var a = {name: "a"}; 7 var a = {name: "a"};
8 var b = {name: "b"}; 8 var b = {name: "b"};
9 var c = {name: "c"}; 9 var c = {name: "c"};
10 10
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 { 46 {
47 return true; 47 return true;
48 }, 48 },
49 49
50 body: function(x) 50 body: function(x)
51 { 51 {
52 return ["span", {}, "Body formatted by 2 ", x.name] 52 return ["span", {}, "Body formatted by 2 ", x.name]
53 } 53 }
54 }; 54 };
55 55
56 window.devtoolsFormatters = [formatter1, formatter2]; 56 var configTest = {};
57 var formatterWithConfig1 = {
58 header: function(x, config)
59 {
60 if (x !== configTest || config)
61 return null;
62
63 return ["span", {}, "Formatter with config ", ["object", {"object": x, " config": {"info": "additional info"}}]];
64 },
65
66 hasBody: function(x)
67 {
68 return false;
69 },
70
71 body: function(x)
72 {
73 throw "Unreachable"
74 }
75 }
76
77 var formatterWithConfig2 = {
78 header: function(x, config)
79 {
80 if (x !== configTest || !config)
81 return null;
82
83 return ["span", {}, "Header ", "info: ", config.info];
84 },
85
86 hasBody: function(x, config)
87 {
88 return config && config.info;
89 },
90
91 body: function(x, config)
92 {
93 return ["span", {}, "body", "info: ", config.info]
94 }
95 }
96
97 var selfReferenceTest = {};
98 var selfReferencingFormatter = {
99 header: function(x)
100 {
101 if (x !== selfReferenceTest)
102 return null;
103
104 return ["span", {}, "Formatter with config ", ["object", {"object": x}]] ;
105 },
106
107 hasBody: function(x)
108 {
109 return false;
110 },
111
112 body: function(x)
113 {
114 throw "Unreachable"
115 }
116
117 }
118
119 window.devtoolsFormatters = [formatter1, formatter2, formatterWithConfig1, forma tterWithConfig2, selfReferencingFormatter];
57 120
58 function logVars() 121 function logVars()
59 { 122 {
60 console.log(a); 123 console.log(a);
61 console.log(b); 124 console.log(b);
62 console.log(c); 125 console.log(c);
63 window.devtoolsFormatters = [formatter2, formatter1]; 126 console.log(configTest);
127 console.log(selfReferenceTest);
128 //swap first formatters: test that header+body should be generated by the sa me formatter
129 window.devtoolsFormatters = [formatter2, formatter1, formatterWithConfig1, f ormatterWithConfig2, selfReferencingFormatter];
64 } 130 }
65 131
66 function test() 132 function test()
67 { 133 {
68 InspectorTest.mainTarget.runtimeAgent().setCustomObjectFormatterEnabled(true ); 134 InspectorTest.mainTarget.runtimeAgent().setCustomObjectFormatterEnabled(true );
69 InspectorTest.evaluateInPage("logVars()", expandVariablesInConsole); 135 InspectorTest.evaluateInPage("logVars()", expandVariablesInConsole);
70 136
71 function expandVariablesInConsole() 137 function expandVariablesInConsole()
72 { 138 {
73 var consoleView = WebInspector.ConsolePanel._view(); 139 var consoleView = WebInspector.ConsolePanel._view();
(...skipping 16 matching lines...) Expand all
90 InspectorTest.completeTest(); 156 InspectorTest.completeTest();
91 } 157 }
92 } 158 }
93 </script> 159 </script>
94 </head> 160 </head>
95 161
96 <body onload="runTest()"> 162 <body onload="runTest()">
97 <p>Tests that console logging dumps properly when there are multiple custom form atters on the page</p> 163 <p>Tests that console logging dumps properly when there are multiple custom form atters on the page</p>
98 </body> 164 </body>
99 </html> 165 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698