OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 InspectorTest = {}; | 5 InspectorTest = {}; |
6 InspectorTest._dispatchTable = new Map(); | 6 InspectorTest._dispatchTable = new Map(); |
7 InspectorTest._requestId = 0; | 7 InspectorTest._requestId = 0; |
8 InspectorTest._dumpInspectorProtocolMessages = false; | 8 InspectorTest._dumpInspectorProtocolMessages = false; |
9 InspectorTest._eventHandler = {}; | 9 InspectorTest._eventHandler = {}; |
10 | 10 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
107 } | 107 } |
108 | 108 |
109 InspectorTest.completeTestAfterPendingTimeouts = function() | 109 InspectorTest.completeTestAfterPendingTimeouts = function() |
110 { | 110 { |
111 Protocol.Runtime.evaluate({ | 111 Protocol.Runtime.evaluate({ |
112 expression: "new Promise(resolve => setTimeout(resolve, 0))", | 112 expression: "new Promise(resolve => setTimeout(resolve, 0))", |
113 awaitPromise: true }).then(InspectorTest.completeTest); | 113 awaitPromise: true }).then(InspectorTest.completeTest); |
114 } | 114 } |
115 | 115 |
116 InspectorTest.addScript = (string) => compileAndRunWithOrigin(string, "", 0, 0); | 116 InspectorTest.addScript = (string) => compileAndRunWithOrigin(string, "", 0, 0); |
| 117 InspectorTest.addScriptWithUrl = (string, url) => compileAndRunWithOrigin(string
, url, 0, 0); |
117 | 118 |
118 InspectorTest.startDumpingProtocolMessages = function() | 119 InspectorTest.startDumpingProtocolMessages = function() |
119 { | 120 { |
120 InspectorTest._dumpInspectorProtocolMessages = true; | 121 InspectorTest._dumpInspectorProtocolMessages = true; |
121 } | 122 } |
122 | 123 |
123 InspectorTest.sendRawCommand = function(requestId, command, handler) | 124 InspectorTest.sendRawCommand = function(requestId, command, handler) |
124 { | 125 { |
125 if (InspectorTest._dumpInspectorProtocolMessages) | 126 if (InspectorTest._dumpInspectorProtocolMessages) |
126 print("frontend: " + command); | 127 print("frontend: " + command); |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 var eventName = messageObject["method"]; | 195 var eventName = messageObject["method"]; |
195 var eventHandler = InspectorTest._eventHandler[eventName]; | 196 var eventHandler = InspectorTest._eventHandler[eventName]; |
196 if (eventHandler) | 197 if (eventHandler) |
197 eventHandler(messageObject); | 198 eventHandler(messageObject); |
198 } | 199 } |
199 } catch (e) { | 200 } catch (e) { |
200 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); | 201 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); |
201 InspectorTest.completeTest(); | 202 InspectorTest.completeTest(); |
202 } | 203 } |
203 } | 204 } |
OLD | NEW |