Chromium Code Reviews| Index: test/inspector/debugger/async-set-timeout.js |
| diff --git a/test/inspector/debugger/async-set-timeout.js b/test/inspector/debugger/async-set-timeout.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..6b5134807ce6dc3b94341975e6d39205ec2a219b |
| --- /dev/null |
| +++ b/test/inspector/debugger/async-set-timeout.js |
| @@ -0,0 +1,46 @@ |
| +// Copyright 2016 the V8 project authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +print('Checks that async stack contains setTimeout'); |
| + |
| +InspectorTest.addScript(` |
| +function foo1() { |
| + function inner1() { |
| + debugger; |
| + } |
| + inner1(); |
| +} |
| +function foo2() { |
| + function inner2() { |
| + setTimeout(foo1, 0); |
| + } |
| + inner2(); |
| +} |
| +function foo3() { |
| + function inner3() { |
| + setTimeout(foo2, 0); |
| + } |
| + inner3(); |
| +} |
| +//# sourceURL=test.js`, 7, 26) |
|
dgozman
2016/12/13 17:31:54
missing semicolon
kozy
2016/12/13 18:24:26
Done.
|
| + |
| +Protocol.Debugger.enable(); |
| +Protocol.Debugger.setAsyncCallStackDepth({ maxDepth: 128 }); |
| +var urlByScriptId = new Map(); |
| +Protocol.Debugger.onScriptParsed(message => { |
| + urlByScriptId.set(message.params.scriptId, message.params.url); |
|
dgozman
2016/12/13 17:31:54
Let's have a helper for this, something like Inspe
kozy
2016/12/13 18:24:26
Done.
|
| +}); |
| +Protocol.Debugger.onPaused(message => { |
| + InspectorTest.logCallFrames(message.params.callFrames, urlByScriptId); |
| + var asyncStackTrace = message.params.asyncStackTrace; |
| + while (asyncStackTrace) { |
| + InspectorTest.log(`-- ${asyncStackTrace.description} --`); |
| + InspectorTest.logCallFrames(asyncStackTrace.callFrames); |
| + asyncStackTrace = asyncStackTrace.parent; |
| + } |
| + InspectorTest.log(''); |
| + Protocol.Debugger.resume(); |
| +}); |
| +Protocol.Runtime.evaluate({ expression: "foo3()//# sourceURL=expr.js" }) |
| + .then(InspectorTest.completeTest); |