Chromium Code Reviews| Index: test/inspector/runtime/evaluate-with-generate-preview.js |
| diff --git a/test/inspector/runtime/evaluate-with-generate-preview.js b/test/inspector/runtime/evaluate-with-generate-preview.js |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..c7f8cea061a390f9ce4186d1ff17e3a324290796 |
| --- /dev/null |
| +++ b/test/inspector/runtime/evaluate-with-generate-preview.js |
| @@ -0,0 +1,36 @@ |
| +// Copyright 2016 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. |
| + |
| +print("Tests that Runtime.evaluate will generate correct previews."); |
| + |
| +InspectorTest.addScript( |
| +` |
| +Object.prototype[0] = 'default-first'; |
| +var obj = {p1: {a:1}, p2: {b:'foo'}}; |
| +Object.defineProperty(obj, 1, { |
| + get() { return 2 } |
| +}); |
| + |
| +Array.prototype[0] = 'default-first'; |
| +var arr = [,, 1, [2]]; |
| +Object.defineProperty(arr, 1, { |
|
dgozman
2016/11/24 00:33:32
Let's add a property with only a setter, and with
luoe
2016/12/02 00:14:33
Done.
|
| + get() { return 2 } |
| +}); |
| +`); |
| + |
| +InspectorTest.runTestSuite([ |
| + function testObjectPropertiesPreview(next) |
| + { |
| + Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) |
| + .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| + .then(next); |
| + }, |
| + |
| + function testArrayPropertiesPreview(next) |
| + { |
| + Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true }) |
| + .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| + .then(next); |
| + } |
| +]); |