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 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 } | 128 } |
129 } | 129 } |
130 | 130 |
131 InspectorTest.completeTest = function() | 131 InspectorTest.completeTest = function() |
132 { | 132 { |
133 Protocol.Debugger.disable().then(() => quit()); | 133 Protocol.Debugger.disable().then(() => quit()); |
134 } | 134 } |
135 | 135 |
136 InspectorTest.completeTestAfterPendingTimeouts = function() | 136 InspectorTest.completeTestAfterPendingTimeouts = function() |
137 { | 137 { |
138 Protocol.Runtime.evaluate({ | 138 InspectorTest.waitPendingTasks().then(InspectorTest.completeTest); |
139 expression: "new Promise(resolve => setTimeout(resolve, 0))", | |
140 awaitPromise: true }).then(InspectorTest.completeTest); | |
141 } | 139 } |
142 | 140 |
143 InspectorTest.addScript = (string, lineOffset, columnOffset) => compileAndRunWit
hOrigin(string, "", lineOffset || 0, columnOffset || 0); | 141 InspectorTest.waitPendingTasks = function() |
144 InspectorTest.addScriptWithUrl = (string, url) => compileAndRunWithOrigin(string
, url, 0, 0); | 142 { |
| 143 return Protocol.Runtime.evaluate({ expression: "new Promise(r => setTimeout(r,
0))//# sourceURL=wait-pending-tasks.js", awaitPromise: true }); |
| 144 } |
| 145 |
| 146 InspectorTest.addScript = (string, lineOffset, columnOffset) => compileAndRunWit
hOrigin(string, "", lineOffset || 0, columnOffset || 0, false); |
| 147 InspectorTest.addScriptWithUrl = (string, url) => compileAndRunWithOrigin(string
, url, 0, 0, false); |
| 148 InspectorTest.addModule = (string, url, lineOffset, columnOffset) => compileAndR
unWithOrigin(string, url, lineOffset || 0, columnOffset || 0, true); |
145 | 149 |
146 InspectorTest.startDumpingProtocolMessages = function() | 150 InspectorTest.startDumpingProtocolMessages = function() |
147 { | 151 { |
148 InspectorTest._dumpInspectorProtocolMessages = true; | 152 InspectorTest._dumpInspectorProtocolMessages = true; |
149 } | 153 } |
150 | 154 |
151 InspectorTest.sendRawCommand = function(requestId, command, handler) | 155 InspectorTest.sendRawCommand = function(requestId, command, handler) |
152 { | 156 { |
153 if (InspectorTest._dumpInspectorProtocolMessages) | 157 if (InspectorTest._dumpInspectorProtocolMessages) |
154 print("frontend: " + command); | 158 print("frontend: " + command); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 if (InspectorTest._scriptMap && eventName === "Debugger.scriptParsed") | 234 if (InspectorTest._scriptMap && eventName === "Debugger.scriptParsed") |
231 InspectorTest._scriptMap.set(messageObject.params.scriptId, JSON.parse(J
SON.stringify(messageObject.params))); | 235 InspectorTest._scriptMap.set(messageObject.params.scriptId, JSON.parse(J
SON.stringify(messageObject.params))); |
232 if (eventHandler) | 236 if (eventHandler) |
233 eventHandler(messageObject); | 237 eventHandler(messageObject); |
234 } | 238 } |
235 } catch (e) { | 239 } catch (e) { |
236 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); | 240 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); |
237 InspectorTest.completeTest(); | 241 InspectorTest.completeTest(); |
238 } | 242 } |
239 } | 243 } |
OLD | NEW |