OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 var source = |
| 6 ` |
| 7 function fib(x) { |
| 8 if (x < 2) return 1; |
| 9 return fib(x-1) + fib(x-2); |
| 10 } |
| 11 fib(5); |
| 12 `; |
| 13 |
| 14 var url = "fib.js" |
| 15 |
| 16 print("Test collecting code coverage data with Runtime.collectCoverage."); |
| 17 |
| 18 InspectorTest.runTestSuite([ |
| 19 function testCoverage(next) |
| 20 { |
| 21 Protocol.Runtime.enable() |
| 22 .then(() => Protocol.Runtime.startPreciseCoverage()) |
| 23 .then(() => Protocol.Runtime.compileScript({ expression: source, sourceURL
: url, persistScript: true })) |
| 24 .then((result) => Protocol.Runtime.runScript({ scriptId: result.result.scr
iptId })) |
| 25 .then((result) => InspectorTest.logMessage(result)) |
| 26 .then(() => Protocol.Runtime.collectCoverage()) |
| 27 .then((result) => InspectorTest.logMessage(result)) |
| 28 .then(() => Protocol.Runtime.stopPreciseCoverage()) |
| 29 .then(() => Protocol.Runtime.disable()) |
| 30 .then(() => next()); |
| 31 } |
| 32 ]); |
OLD | NEW |