OLD | NEW |
| (Empty) |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 print("Check that console.log is reported through Console domain as well."); | |
6 | |
7 var expectedMessages = 4; | |
8 var messages = []; | |
9 | |
10 InspectorTest.eventHandler["Runtime.consoleAPICalled"] = consoleAPICalled; | |
11 InspectorTest.eventHandler["Console.messageAdded"] = messageAdded; | |
12 InspectorTest.sendCommandOrDie("Runtime.enable", {}); | |
13 InspectorTest.sendCommandOrDie("Console.enable", {}); | |
14 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "console.log(
42)" }); | |
15 InspectorTest.sendCommandOrDie("Runtime.evaluate", { "expression": "console.erro
r('abc')" }); | |
16 | |
17 function consoleAPICalled(result) | |
18 { | |
19 messages.push("api call: " + result.params.args[0].value); | |
20 if (!(--expectedMessages)) | |
21 done(); | |
22 } | |
23 | |
24 function messageAdded(result) | |
25 { | |
26 messages.push("console message: " + result.params.message.text); | |
27 if (!(--expectedMessages)) | |
28 done(); | |
29 } | |
30 | |
31 function done() | |
32 { | |
33 messages.sort(); | |
34 for (var message of messages) | |
35 InspectorTest.log(message); | |
36 InspectorTest.completeTest(); | |
37 } | |
OLD | NEW |