OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 InspectorTest.log("Tests that Runtime.evaluate will generate correct previews.")
; | 5 InspectorTest.log("Tests that Runtime.evaluate will generate correct previews.")
; |
6 | 6 |
7 InspectorTest.addScript( | 7 InspectorTest.addScript( |
8 ` | 8 ` |
9 var f1 = function(){}; | 9 var f1 = function(){}; |
10 | 10 |
(...skipping 25 matching lines...) Expand all Loading... |
36 get() { return 2 }, | 36 get() { return 2 }, |
37 set(x) { return x } | 37 set(x) { return x } |
38 } | 38 } |
39 }); | 39 }); |
40 arr.nonEntryFunction = f1; | 40 arr.nonEntryFunction = f1; |
41 | 41 |
42 var inheritingObj = {}; | 42 var inheritingObj = {}; |
43 var inheritingArr = []; | 43 var inheritingArr = []; |
44 inheritingObj.prototype = obj; | 44 inheritingObj.prototype = obj; |
45 inheritingArr.prototype = arr; | 45 inheritingArr.prototype = arr; |
| 46 |
| 47 var shortTypedArray = new Uint8Array(3); |
| 48 var longTypedArray = new Uint8Array(500001); |
| 49 var set = new Set([1, 2, 3]); |
| 50 var bigSet = new Set(); |
| 51 var mixedSet = new Set(); |
| 52 for (var i = 0; i < 10; i++) { |
| 53 bigSet.add(i); |
| 54 mixedSet["_prop_" + i] = 1; |
| 55 mixedSet.add(i); |
| 56 } |
| 57 |
| 58 var deterministicNativeFunction = Math.log; |
| 59 var parentObj = {}; |
| 60 Object.defineProperty(parentObj, 'propNotNamedProto', { |
| 61 get: deterministicNativeFunction, |
| 62 set: function() {} |
| 63 }); |
| 64 var objInheritsGetterProperty = {__proto__: parentObj}; |
| 65 allowAccessorFormatting(objInheritsGetterProperty); |
46 `); | 66 `); |
47 | 67 |
48 InspectorTest.runTestSuite([ | 68 InspectorTest.runTestSuite([ |
49 function testObjectPropertiesPreview(next) | 69 function testObjectPropertiesPreview(next) |
50 { | 70 { |
51 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) | 71 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) |
52 .then(result => InspectorTest.logMessage(result.result.result.preview)) | 72 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
53 .then(next); | 73 .then(next); |
54 }, | 74 }, |
55 | 75 |
56 function testArrayPropertiesPreview(next) | 76 function testArrayPropertiesPreview(next) |
57 { | 77 { |
58 Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true }) | 78 Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true }) |
59 .then(result => InspectorTest.logMessage(result.result.result.preview)) | 79 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
60 .then(next); | 80 .then(next); |
61 }, | 81 }, |
62 | 82 |
63 function testInheritingObjectPropertiesPreview(next) | 83 function testInheritingObjectPropertiesPreview(next) |
64 { | 84 { |
65 Protocol.Runtime.evaluate({ "expression": "inheritingObj", "generatePreview"
: true }) | 85 Protocol.Runtime.evaluate({ "expression": "inheritingObj", "generatePreview"
: true }) |
66 .then(result => InspectorTest.logMessage(result.result.result.preview)) | 86 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
67 .then(next); | 87 .then(next); |
68 }, | 88 }, |
69 | 89 |
70 function testInheritingArrayPropertiesPreview(next) | 90 function testInheritingArrayPropertiesPreview(next) |
71 { | 91 { |
72 Protocol.Runtime.evaluate({ "expression": "inheritingArr", "generatePreview"
: true }) | 92 Protocol.Runtime.evaluate({ "expression": "inheritingArr", "generatePreview"
: true }) |
73 .then(result => InspectorTest.logMessage(result.result.result.preview)) | 93 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
74 .then(next); | 94 .then(next); |
| 95 }, |
| 96 |
| 97 function testShortTypedArrayPropertiesPreview(next) |
| 98 { |
| 99 Protocol.Runtime.evaluate({ "expression": "shortTypedArray", "generatePrevie
w": true }) |
| 100 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 101 .then(next); |
| 102 }, |
| 103 |
| 104 function testLongTypedArrayPropertiesPreview(next) |
| 105 { |
| 106 Protocol.Runtime.evaluate({ "expression": "longTypedArray", "generatePreview
": true }) |
| 107 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 108 .then(next); |
| 109 }, |
| 110 |
| 111 function testSetPropertiesPreview(next) |
| 112 { |
| 113 Protocol.Runtime.evaluate({ "expression": "set", "generatePreview": true }) |
| 114 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 115 .then(next); |
| 116 }, |
| 117 |
| 118 function testBigSetPropertiesPreview(next) |
| 119 { |
| 120 Protocol.Runtime.evaluate({ "expression": "bigSet", "generatePreview": true
}) |
| 121 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 122 .then(next); |
| 123 }, |
| 124 |
| 125 function testMixedSetPropertiesPreview(next) |
| 126 { |
| 127 Protocol.Runtime.evaluate({ "expression": "mixedSet", "generatePreview": tru
e }) |
| 128 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 129 .then(next); |
| 130 }, |
| 131 |
| 132 function testObjInheritsGetterProperty(next) |
| 133 { |
| 134 Protocol.Runtime.evaluate({ "expression": "objInheritsGetterProperty", "gene
ratePreview": true }) |
| 135 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
| 136 .then(next); |
75 } | 137 } |
76 ]); | 138 ]); |
OLD | NEW |