v8/test/inspector/runtime/console-memory.js
kozyatinskiy 88f71126a5 [inspector] console get all information from inspector when needed
With this CL we don't need to store reference to InspectedContext inside of JavaScript console object and able to get all required information from callback data.
It allows us to implement console methods without taking in account how and where we create and store these methods:
- later we can move console object implementation to builtins..
- ..and install command line API methods smarter.

BUG=chromium:588893
R=dgozman@chromium.org

Review-Url: https://codereview.chromium.org/2784713002
Cr-Original-Commit-Position: refs/heads/master@{#44212}
Committed: 908cd38123
Review-Url: https://codereview.chromium.org/2784713002
Cr-Commit-Position: refs/heads/master@{#44238}
2017-03-29 15:50:03 +00:00

33 lines
1.0 KiB
JavaScript

// Copyright 2017 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.
InspectorTest.log('Checks console.memory');
InspectorTest.runAsyncTestSuite([
async function testWithoutMemory() {
InspectorTest.logMessage(
await Protocol.Runtime.evaluate({expression: 'console.memory'}));
},
async function testSetterInStrictMode() {
// crbug.com/468611
InspectorTest.logMessage(
await Protocol.Runtime.evaluate({
expression: '"use strict"\nconsole.memory = {};undefined' }));
},
async function testWithMemory() {
utils.setMemoryInfoForTest(239);
InspectorTest.logMessage(
await Protocol.Runtime.evaluate({expression: 'console.memory'}));
},
async function testSetterDoesntOverride() {
utils.setMemoryInfoForTest(42);
await Protocol.Runtime.evaluate({expression: 'console.memory = 0'});
InspectorTest.logMessage(
await Protocol.Runtime.evaluate({expression: 'console.memory'}));
}
]);