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 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
236 InspectorTest.completeTest(); | 236 InspectorTest.completeTest(); |
237 return; | 237 return; |
238 } | 238 } |
239 var fun = testSuite.shift(); | 239 var fun = testSuite.shift(); |
240 InspectorTest.log("\nRunning test: " + fun.name); | 240 InspectorTest.log("\nRunning test: " + fun.name); |
241 fun(nextTest); | 241 fun(nextTest); |
242 } | 242 } |
243 nextTest(); | 243 nextTest(); |
244 } | 244 } |
245 | 245 |
| 246 InspectorTest.runAsyncTestSuite = async function(testSuite) { |
| 247 for (var test of testSuite) { |
| 248 InspectorTest.log("\nRunning test: " + test.name); |
| 249 await test(); |
| 250 } |
| 251 InspectorTest.completeTest(); |
| 252 } |
| 253 |
246 InspectorTest._sendCommandPromise = function(method, params) | 254 InspectorTest._sendCommandPromise = function(method, params) |
247 { | 255 { |
248 var requestId = ++InspectorTest._requestId; | 256 var requestId = ++InspectorTest._requestId; |
249 var messageObject = { "id": requestId, "method": method, "params": params }; | 257 var messageObject = { "id": requestId, "method": method, "params": params }; |
250 var fulfillCallback; | 258 var fulfillCallback; |
251 var promise = new Promise(fulfill => fulfillCallback = fulfill); | 259 var promise = new Promise(fulfill => fulfillCallback = fulfill); |
252 InspectorTest.sendRawCommand(requestId, JSON.stringify(messageObject), fulfill
Callback); | 260 InspectorTest.sendRawCommand(requestId, JSON.stringify(messageObject), fulfill
Callback); |
253 return promise; | 261 return promise; |
254 } | 262 } |
255 | 263 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 } | 296 } |
289 } catch (e) { | 297 } catch (e) { |
290 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); | 298 InspectorTest.log("Exception when dispatching message: " + e + "\n" + e.stac
k + "\n message = " + JSON.stringify(messageObject, null, 2)); |
291 InspectorTest.completeTest(); | 299 InspectorTest.completeTest(); |
292 } | 300 } |
293 } | 301 } |
294 | 302 |
295 InspectorTest.loadScript = function(fileName) { | 303 InspectorTest.loadScript = function(fileName) { |
296 InspectorTest.addScript(utils.read(fileName)); | 304 InspectorTest.addScript(utils.read(fileName)); |
297 } | 305 } |
OLD | NEW |