v8/test/inspector/runtime/remote-object-get-properties.js
Alexey Kozyatinskiy c949f19b45 inspector: add couple tests
Test to cover a lot of injected script source corner cases.

R=dgozman@chromium.org

Bug: chromium:595206
Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ia631de58c5a92b39ec3933c56cf7e3f108b9bd9e
Reviewed-on: https://chromium-review.googlesource.com/c/1292688
Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org>
Reviewed-by: Dmitry Gozman <dgozman@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56863}
2018-10-22 16:12:02 +00:00

62 lines
1.6 KiB
JavaScript

// Copyright 2018 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.
const {session, contextGroup, Protocol} =
InspectorTest.start('Tests Runtime.getProperties.');
InspectorTest.runAsyncTestSuite([
async function testObject() {
await getProperties('({a: 1})', { ownProperties: true });
await getProperties(`(function(){
let b = {};
Object.defineProperty(b, 'a', {
configurable: false,
enumerable: false,
value: 42,
writable: false
});
Object.defineProperty(b, 'b', {
configurable: false,
enumerable: false,
value: 42,
writable: true
});
Object.defineProperty(b, 'c', {
configurable: true,
enumerable: false,
value: 42,
writable: false
});
Object.defineProperty(b, 'd', {
configurable: false,
enumerable: true,
value: 42,
writable: false
});
Object.defineProperty(b, 'e', {
set: () => 0,
get: () => 42
});
Object.defineProperty(b, Symbol(42), {
value: 239
});
return b;
})()`, { ownProperties: true });
}
]);
async function getProperties(expression, options) {
try {
const { result: { result: { objectId } } } =
await Protocol.Runtime.evaluate({ expression });
const result = await Protocol.Runtime.getProperties({
objectId,
ownProperties: options.ownProperties
});
InspectorTest.logMessage(result);
} catch (e) {
InspectorTest.log(e.stack);
}
}