OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 print("Tests that Runtime.evaluate will generate correct previews."); |
| 6 |
| 7 InspectorTest.addScript( |
| 8 ` |
| 9 Object.prototype[0] = 'default-first'; |
| 10 var obj = {p1: {a:1}, p2: {b:'foo'}}; |
| 11 Object.defineProperties(obj, { |
| 12 p3: { |
| 13 get() { return 2 } |
| 14 }, |
| 15 p4: { |
| 16 set(x) { return x } |
| 17 }, |
| 18 p5: { |
| 19 get() { return 2 }, |
| 20 set(x) { return x } |
| 21 } |
| 22 }); |
| 23 |
| 24 Array.prototype[0] = 'default-first'; |
| 25 var arr = [,, 1, [2]]; |
| 26 Object.defineProperties(arr, { |
| 27 4: { |
| 28 get() { return 2 } |
| 29 }, |
| 30 5: { |
| 31 set(x) { return x } |
| 32 }, |
| 33 6: { |
| 34 get() { return 2 }, |
| 35 set(x) { return x } |
| 36 } |
| 37 }); |
| 38 `); |
| 39 |
| 40 InspectorTest.runTestSuite([ |
| 41 function testObjectPropertiesPreview(next) |
| 42 { |
| 43 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) |
| 44 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 45 .then(next); |
| 46 }, |
| 47 |
| 48 function testArrayPropertiesPreview(next) |
| 49 { |
| 50 Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true }) |
| 51 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 52 .then(next); |
| 53 } |
| 54 ]); |
OLD | NEW |