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