OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview These stubs emulate backend functionality and allows | 6 * @fileoverview These stubs emulate backend functionality and allows |
7 * DevTools frontend to function as a standalone web app. | 7 * DevTools frontend to function as a standalone web app. |
8 */ | 8 */ |
9 | 9 |
10 /** | 10 /** |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 var result = eval(script); | 151 var result = eval(script); |
152 RemoteToolsAgent.DidEvaluateJavaScript(callId, result); | 152 RemoteToolsAgent.DidEvaluateJavaScript(callId, result); |
153 }, 0); | 153 }, 0); |
154 }; | 154 }; |
155 | 155 |
156 | 156 |
157 RemoteToolsAgentStub.prototype.ExecuteUtilityFunction = function(callId, | 157 RemoteToolsAgentStub.prototype.ExecuteUtilityFunction = function(callId, |
158 functionName, nodeId, args) { | 158 functionName, nodeId, args) { |
159 setTimeout(function() { | 159 setTimeout(function() { |
160 var result = []; | 160 var result = []; |
161 if (functionName == 'devtools$$getProperties') { | 161 if (functionName == 'getProperties') { |
162 result = [ | 162 result = [ |
163 'undefined', 'undefined_key', undefined, | 163 'undefined', 'undefined_key', undefined, |
164 'string', 'string_key', 'value', | 164 'string', 'string_key', 'value', |
165 'function', 'func', undefined, | 165 'function', 'func', undefined, |
166 'array', 'array_key', [10], | 166 'array', 'array_key', [10], |
167 'object', 'object_key', undefined, | 167 'object', 'object_key', undefined, |
168 'boolean', 'boolean_key', true, | 168 'boolean', 'boolean_key', true, |
169 'number', 'num_key', 911, | 169 'number', 'num_key', 911, |
170 'date', 'date_key', new Date() ]; | 170 'date', 'date_key', new Date() ]; |
171 } else if (functionName == 'devtools$$getPrototypes') { | 171 } else if (functionName == 'getPrototypes') { |
172 result = ['Proto1', 'Proto2', 'Proto3']; | 172 result = ['Proto1', 'Proto2', 'Proto3']; |
173 } else if (functionName == 'devtools$$getStyles') { | 173 } else if (functionName == 'getStyles') { |
174 result = { | 174 result = { |
175 'computedStyle' : [['display', false, false, '', 'none']], | 175 'computedStyle' : [0, null, null, null, ['display', false, false, '', 'n
one']], |
176 'inlineStyle' : [['display', false, false, '', 'none']], | 176 'inlineStyle' : [1, null, null, null, ['display', false, false, '', 'non
e']], |
177 'styleAttributes' : { | 177 'styleAttributes' : { |
178 attr: [['display', false, false, '', 'none']] | 178 attr: [2, null, null, null, ['display', false, false, '', 'none']] |
179 }, | 179 }, |
180 'matchedCSSRules' : [ | 180 'matchedCSSRules' : [ |
181 { 'selector' : 'S', | 181 { 'selector' : 'S', |
182 'style' : [['display', false, false, '', 'none']], | 182 'style' : [3, null, null, null, ['display', false, false, '', 'none'
]], |
183 'parentStyleSheetHref' : 'http://localhost', | 183 'parentStyleSheet' : { 'href' : 'http://localhost', |
184 'parentStyleSheetOwnerNodeName' : 'DIV' | 184 'ownerNodeName' : 'DIV' } |
185 } | 185 } |
186 ] | 186 ] |
187 }; | 187 }; |
| 188 } else if (functionName == 'toggleNodeStyle') { |
| 189 alert('toggleNodeStyle ' + args); |
188 } else { | 190 } else { |
189 alert('Unexpected utility function:' + functionName); | 191 alert('Unexpected utility function:' + functionName); |
190 } | 192 } |
191 RemoteToolsAgent.DidExecuteUtilityFunction(callId, | 193 RemoteToolsAgent.DidExecuteUtilityFunction(callId, |
192 goog.json.serialize(result)); | 194 goog.json.serialize(result), ''); |
193 }, 0); | 195 }, 0); |
194 }; | 196 }; |
195 | 197 |
196 | 198 |
197 RemoteToolsAgentStub.prototype.GetNodePrototypes = function(callId, nodeId) { | 199 RemoteToolsAgentStub.prototype.GetNodePrototypes = function(callId, nodeId) { |
198 setTimeout(function() { | 200 setTimeout(function() { |
199 RemoteToolsAgent.DidGetNodePrototypes(callId, | 201 RemoteToolsAgent.DidGetNodePrototypes(callId, |
200 goog.json.serialize()); | 202 goog.json.serialize()); |
201 }, 0); | 203 }, 0); |
202 }; | 204 }; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
242 | 244 |
243 if (!window['DevToolsHost']) { | 245 if (!window['DevToolsHost']) { |
244 window['RemoteDebuggerAgent'] = new RemoteDebuggerAgentStub(); | 246 window['RemoteDebuggerAgent'] = new RemoteDebuggerAgentStub(); |
245 window['RemoteDebuggerCommandExecutor'] = | 247 window['RemoteDebuggerCommandExecutor'] = |
246 new RemoteDebuggerCommandExecutorStub(); | 248 new RemoteDebuggerCommandExecutorStub(); |
247 window['RemoteDomAgent'] = new RemoteDomAgentStub(); | 249 window['RemoteDomAgent'] = new RemoteDomAgentStub(); |
248 window['RemoteNetAgent'] = new RemoteNetAgentStub(); | 250 window['RemoteNetAgent'] = new RemoteNetAgentStub(); |
249 window['RemoteToolsAgent'] = new RemoteToolsAgentStub(); | 251 window['RemoteToolsAgent'] = new RemoteToolsAgentStub(); |
250 window['DevToolsHost'] = new DevToolsHostStub(); | 252 window['DevToolsHost'] = new DevToolsHostStub(); |
251 } | 253 } |
OLD | NEW |