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 print("Tests checks that deprecation messages for console.") | 5 print("Tests checks that deprecation messages for console.") |
6 | 6 |
7 InspectorTest.eventHandler["Runtime.consoleAPICalled"] = messageAdded; | 7 Protocol.Runtime.onConsoleAPICalled(messageAdded); |
8 InspectorTest.sendCommand("Runtime.enable", {}); | 8 Protocol.Runtime.enable(); |
9 | 9 |
10 var deprecatedMethods = [ | 10 var deprecatedMethods = [ |
11 "console.timeline(\"42\")", | 11 "console.timeline(\"42\")", |
12 "console.timeline(\"42\")", | 12 "console.timeline(\"42\")", |
13 "console.timeline(\"42\")", // three calls should produce one warning message | 13 "console.timeline(\"42\")", // three calls should produce one warning message |
14 "console.timelineEnd(\"42\")", | 14 "console.timelineEnd(\"42\")", |
15 "console.markTimeline(\"42\")", | 15 "console.markTimeline(\"42\")", |
16 ]; | 16 ]; |
17 InspectorTest.sendCommand("Runtime.evaluate", { expression: deprecatedMethods.jo
in(";") }); | 17 Protocol.Runtime.evaluate({ expression: deprecatedMethods.join(";") }); |
18 | 18 |
19 var messagesLeft = 3; | 19 var messagesLeft = 3; |
20 function messageAdded(data) | 20 function messageAdded(data) |
21 { | 21 { |
22 var text = data.params.args[0].value; | 22 var text = data.params.args[0].value; |
23 if (text.indexOf("deprecated") === -1) | 23 if (text.indexOf("deprecated") === -1) |
24 return; | 24 return; |
25 InspectorTest.log(text); | 25 InspectorTest.log(text); |
26 if (!--messagesLeft) | 26 if (!--messagesLeft) |
27 InspectorTest.completeTest(); | 27 InspectorTest.completeTest(); |
28 } | 28 } |
OLD | NEW |