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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 | 174 |
175 RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd) { | 175 RemoteDebuggerCommandExecutorStub.prototype.DebuggerCommand = function(cmd) { |
176 if ('{"seq":2,"type":"request","command":"scripts","arguments":{"' + | 176 if ('{"seq":2,"type":"request","command":"scripts","arguments":{"' + |
177 'includeSource":false}}' == cmd) { | 177 'includeSource":false}}' == cmd) { |
178 var response1 = | 178 var response1 = |
179 '{"seq":5,"request_seq":2,"type":"response","command":"scripts","' + | 179 '{"seq":5,"request_seq":2,"type":"response","command":"scripts","' + |
180 'success":true,"body":[{"handle":61,"type":"script","name":"' + | 180 'success":true,"body":[{"handle":61,"type":"script","name":"' + |
181 'http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' + | 181 'http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' + |
182 '"lineCount":1,"sourceStart":"function fib(n) {","sourceLength":300,' + | 182 '"lineCount":1,"sourceStart":"function fib(n) {","sourceLength":300,' + |
183 '"scriptType":2,"compilationType":0,"context":{"ref":60}}],"refs":[{' + | 183 '"scriptType":2,"compilationType":0,"context":{"ref":60}}],"refs":[{' + |
184 '"handle":60,"type":"context","data":{"type":"page","value":3}}],' + | 184 '"handle":60,"type":"context","data":"page,3"}],"running":false}'; |
185 '"running":false}'; | |
186 this.sendResponse_(response1); | 185 this.sendResponse_(response1); |
187 } else if ('{"seq":3,"type":"request","command":"scripts","arguments":{' + | 186 } else if ('{"seq":3,"type":"request","command":"scripts","arguments":{' + |
188 '"ids":[59],"includeSource":true}}' == cmd) { | 187 '"ids":[59],"includeSource":true}}' == cmd) { |
189 this.sendResponse_( | 188 this.sendResponse_( |
190 '{"seq":8,"request_seq":3,"type":"response","command":"scripts",' + | 189 '{"seq":8,"request_seq":3,"type":"response","command":"scripts",' + |
191 '"success":true,"body":[{"handle":1,"type":"script","name":' + | 190 '"success":true,"body":[{"handle":1,"type":"script","name":' + |
192 '"http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' + | 191 '"http://www/~test/t.js","id":59,"lineOffset":0,"columnOffset":0,' + |
193 '"lineCount":1,"source":"function fib(n) {return n+1;}",' + | 192 '"lineCount":1,"source":"function fib(n) {return n+1;}",' + |
194 '"sourceLength":244,"scriptType":2,"compilationType":0,"context":{' + | 193 '"sourceLength":244,"scriptType":2,"compilationType":0,"context":{' + |
195 '"ref":0}}],"refs":[{"handle":0,"type":"context","data":{"type":' + | 194 '"ref":0}}],"refs":[{"handle":0,"type":"context","data":"page,3}],"' + |
196 '"page","value":3}}],"running":false}'); | 195 '"running":false}'); |
197 } else { | 196 } else { |
198 debugPrint('Unexpected command: ' + cmd); | 197 debugPrint('Unexpected command: ' + cmd); |
199 } | 198 } |
200 }; | 199 }; |
201 | 200 |
202 | 201 |
203 RemoteDebuggerCommandExecutorStub.prototype.sendResponse_ = function(response) { | 202 RemoteDebuggerCommandExecutorStub.prototype.sendResponse_ = function(response) { |
204 setTimeout(function() { | 203 setTimeout(function() { |
205 RemoteDebuggerAgent.DebuggerOutput(response); | 204 RemoteDebuggerAgent.DebuggerOutput(response); |
206 }, 0); | 205 }, 0); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
283 }; | 282 }; |
284 | 283 |
285 | 284 |
286 if (!window['DevToolsHost']) { | 285 if (!window['DevToolsHost']) { |
287 window['RemoteDebuggerAgent'] = new RemoteDebuggerAgentStub(); | 286 window['RemoteDebuggerAgent'] = new RemoteDebuggerAgentStub(); |
288 window['RemoteDebuggerCommandExecutor'] = | 287 window['RemoteDebuggerCommandExecutor'] = |
289 new RemoteDebuggerCommandExecutorStub(); | 288 new RemoteDebuggerCommandExecutorStub(); |
290 window['RemoteToolsAgent'] = new RemoteToolsAgentStub(); | 289 window['RemoteToolsAgent'] = new RemoteToolsAgentStub(); |
291 window['DevToolsHost'] = new DevToolsHostStub(); | 290 window['DevToolsHost'] = new DevToolsHostStub(); |
292 } | 291 } |
OLD | NEW |