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 print('Checks that console message storage doesn\'t exceed limits'); |
| 6 |
| 7 InspectorTest.addScript(` |
| 8 function generateEmptyMessages(n) { |
| 9 for (var i = 0; i < n; ++i) { |
| 10 console.log(''); |
| 11 } |
| 12 } |
| 13 |
| 14 function generate1MbMessages(n) { |
| 15 for (var i = 0; i < n; ++i) { |
| 16 console.log(new Array(1024 * 1024 - 32).join('!')); |
| 17 } |
| 18 } |
| 19 //# sourceURL=test.js`, 7, 26); |
| 20 |
| 21 var messagesReported = 0; |
| 22 Protocol.Runtime.onConsoleAPICalled(message => { |
| 23 ++messagesReported; |
| 24 }); |
| 25 |
| 26 InspectorTest.runTestSuite([ |
| 27 function testMaxConsoleMessagesCount(next) { |
| 28 messagesReported = 0; |
| 29 Protocol.Runtime.evaluate({ expression: 'generateEmptyMessages(1005)'}) |
| 30 .then(() => Protocol.Runtime.enable()) |
| 31 .then(() => Protocol.Runtime.disable()) |
| 32 .then(() => InspectorTest.log(`Messages reported: ${messagesReported}`)) |
| 33 .then(next); |
| 34 }, |
| 35 |
| 36 function testMaxConsoleMessagesV8Size(next) { |
| 37 messagesReported = 0; |
| 38 Protocol.Runtime.evaluate({ expression: 'generate1MbMessages(11)'}) |
| 39 .then(() => Protocol.Runtime.enable()) |
| 40 .then(() => Protocol.Runtime.disable()) |
| 41 .then(() => InspectorTest.log(`Messages reported: ${messagesReported}`)) |
| 42 .then(next); |
| 43 } |
| 44 ]); |
OLD | NEW |