| OLD | NEW |
| 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/extensions-test.js"></script> | 4 <script src="../../http/tests/inspector/extensions-test.js"></script> |
| 5 <script type="text/javascript"> | 5 <script type="text/javascript"> |
| 6 | 6 |
| 7 function initialize_extensionsSidebarTest() | 7 function initialize_extensionsSidebarTest() |
| 8 { | 8 { |
| 9 InspectorTest.dumpSidebarContent = function(panelName, callback) | 9 InspectorTest.dumpSidebarContent = function(panelName, callback) |
| 10 { | 10 { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 } | 129 } |
| 130 | 130 |
| 131 function extension_testElementsSidebarSetExpression(nextTest) | 131 function extension_testElementsSidebarSetExpression(nextTest) |
| 132 { | 132 { |
| 133 var panelName = "elements"; | 133 var panelName = "elements"; |
| 134 function onSidebarCreated(sidebar) | 134 function onSidebarCreated(sidebar) |
| 135 { | 135 { |
| 136 function expression() | 136 function expression() |
| 137 { | 137 { |
| 138 document.body.testProperty = 'foo'; | 138 document.body.testProperty = 'foo'; |
| 139 function Foo() {}; |
| 140 var fooInstance = new Foo(); |
| 141 fooInstance.bar = 1; |
| 139 return { | 142 return { |
| 140 f0: 'expression', | 143 f0: 'expression', |
| 141 f1: undefined, | 144 f1: undefined, |
| 142 f2: null, | 145 f2: null, |
| 143 f3: {}, | 146 f3: {}, |
| 144 f4: [], | 147 f4: [], |
| 145 f5: ["aa", "bb", "cc"], | 148 f5: ["aa", "bb", "cc"], |
| 146 f6: { f60: 42, f61: "foo", f62: [] }, | 149 f6: { f60: 42, f61: "foo", f62: [] }, |
| 147 f7: 42, | 150 f7: 42, |
| 148 f8: window.location, | 151 f8: fooInstance, |
| 149 f9: document.body.children, | 152 f9: document.body.children, |
| 150 f10: function() {}, | 153 f10: function() {}, |
| 151 f11: $0.testProperty | 154 f11: $0.testProperty |
| 152 }; | 155 }; |
| 153 } | 156 } |
| 154 // Do an extra round-trip to the inspected page to assure inspect()'s ro
und-trip to | 157 // Do an extra round-trip to the inspected page to assure inspect()'s ro
und-trip to |
| 155 // front-end is complete and $0 is properly updated with currently inspe
cted node. | 158 // front-end is complete and $0 is properly updated with currently inspe
cted node. |
| 156 webInspector.inspectedWindow.eval("undefined", function() { | 159 webInspector.inspectedWindow.eval("undefined", function() { |
| 157 sidebar.setExpression("(" + expression.toString() + ")();", "title",
extension_dumpSidebarContent.bind(this, panelName, nextTest)); | 160 sidebar.setExpression("(" + expression.toString() + ")();", "title",
extension_dumpSidebarContent.bind(this, panelName, nextTest)); |
| 158 }); | 161 }); |
| 159 } | 162 } |
| 160 webInspector.inspectedWindow.eval("inspect(document.body)", function() { | 163 webInspector.inspectedWindow.eval("inspect(document.body)", function() { |
| 161 webInspector.panels.elements.createSidebarPane("Watch Test: Expression",
onSidebarCreated); | 164 webInspector.panels.elements.createSidebarPane("Watch Test: Expression",
onSidebarCreated); |
| 162 }); | 165 }); |
| 163 } | 166 } |
| 164 | 167 |
| 165 function extension_testSourcesSidebarSetExpression(nextTest) | 168 function extension_testSourcesSidebarSetExpression(nextTest) |
| 166 { | 169 { |
| 167 var panelName = "sources"; | 170 var panelName = "sources"; |
| 168 | 171 |
| 169 function onSidebarExpanded(sidebar) { | 172 function onSidebarExpanded(sidebar) { |
| 170 function expression() | 173 function expression() |
| 171 { | 174 { |
| 175 function Foo() {}; |
| 176 var fooInstance = new Foo(); |
| 177 fooInstance.bar = 1; |
| 172 return { | 178 return { |
| 173 f0: 'expression', | 179 f0: 'expression', |
| 174 f1: undefined, | 180 f1: undefined, |
| 175 f2: null, | 181 f2: null, |
| 176 f3: {}, | 182 f3: {}, |
| 177 f4: [], | 183 f4: [], |
| 178 f5: ["aa", "bb", "cc"], | 184 f5: ["aa", "bb", "cc"], |
| 179 f6: { f60: 42, f61: "foo", f62: [] }, | 185 f6: { f60: 42, f61: "foo", f62: [] }, |
| 180 f7: 42, | 186 f7: 42, |
| 181 f8: window.location, | 187 f8: fooInstance, |
| 182 f9: document.body.children, | 188 f9: document.body.children, |
| 183 f10: function() {}, | 189 f10: function() {}, |
| 184 }; | 190 }; |
| 185 } | 191 } |
| 186 sidebar.setExpression("(" + expression.toString() + ")();", "title", ext
ension_dumpSidebarContent.bind(this, panelName, nextTest)); | 192 sidebar.setExpression("(" + expression.toString() + ")();", "title", ext
ension_dumpSidebarContent.bind(this, panelName, nextTest)); |
| 187 } | 193 } |
| 188 | 194 |
| 189 function onSidebarCreated(sidebar) | 195 function onSidebarCreated(sidebar) |
| 190 { | 196 { |
| 191 extension_showPanel(panelName, extension_expandSidebar.bind(this, panelN
ame, onSidebarExpanded.bind(null, sidebar))); | 197 extension_showPanel(panelName, extension_expandSidebar.bind(this, panelN
ame, onSidebarExpanded.bind(null, sidebar))); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 } | 236 } |
| 231 webInspector.panels[panelName].createSidebarPane("Sidebar Test: replace pag
e with object", onSidebarCreated); | 237 webInspector.panels[panelName].createSidebarPane("Sidebar Test: replace pag
e with object", onSidebarCreated); |
| 232 } | 238 } |
| 233 | 239 |
| 234 </script> | 240 </script> |
| 235 </head> | 241 </head> |
| 236 <body onload="runTest()"> | 242 <body onload="runTest()"> |
| 237 <p>Tests sidebars in WebInspector extensions API</p> | 243 <p>Tests sidebars in WebInspector extensions API</p> |
| 238 </body> | 244 </body> |
| 239 </html> | 245 </html> |
| OLD | NEW |