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 let {session, contextGroup, Protocol} = InspectorTest.start("Tests that Runtime.
evaluate will generate correct previews."); |
6 | 6 |
7 InspectorTest.addScript( | 7 contextGroup.addScript( |
8 ` | 8 ` |
9 var f1 = function(){}; | 9 var f1 = function(){}; |
10 | 10 |
11 Object.prototype[0] = 'default-first'; | 11 Object.prototype[0] = 'default-first'; |
12 var obj = {p1: {a:1}, p2: {b:'foo'}, p3: f1}; | 12 var obj = {p1: {a:1}, p2: {b:'foo'}, p3: f1}; |
13 Object.defineProperties(obj, { | 13 Object.defineProperties(obj, { |
14 p4: { | 14 p4: { |
15 get() { return 2 } | 15 get() { return 2 } |
16 }, | 16 }, |
17 p5: { | 17 p5: { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
58 var deterministicNativeFunction = Math.log; | 58 var deterministicNativeFunction = Math.log; |
59 var parentObj = {}; | 59 var parentObj = {}; |
60 Object.defineProperty(parentObj, 'propNotNamedProto', { | 60 Object.defineProperty(parentObj, 'propNotNamedProto', { |
61 get: deterministicNativeFunction, | 61 get: deterministicNativeFunction, |
62 set: function() {} | 62 set: function() {} |
63 }); | 63 }); |
64 var objInheritsGetterProperty = {__proto__: parentObj}; | 64 var objInheritsGetterProperty = {__proto__: parentObj}; |
65 inspector.allowAccessorFormatting(objInheritsGetterProperty); | 65 inspector.allowAccessorFormatting(objInheritsGetterProperty); |
66 `); | 66 `); |
67 | 67 |
68 InspectorTest.setupInjectedScriptEnvironment(); | 68 contextGroup.setupInjectedScriptEnvironment(); |
69 | 69 |
70 InspectorTest.runTestSuite([ | 70 InspectorTest.runTestSuite([ |
71 function testObjectPropertiesPreview(next) | 71 function testObjectPropertiesPreview(next) |
72 { | 72 { |
73 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) | 73 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) |
74 .then(result => InspectorTest.logMessage(result.result.result.preview)) | 74 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
75 .then(next); | 75 .then(next); |
76 }, | 76 }, |
77 | 77 |
78 function testArrayPropertiesPreview(next) | 78 function testArrayPropertiesPreview(next) |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
138 .then(next); | 138 .then(next); |
139 }, | 139 }, |
140 | 140 |
141 function testObjWithArrayAsProto(next) | 141 function testObjWithArrayAsProto(next) |
142 { | 142 { |
143 Protocol.Runtime.evaluate({ "expression": "Object.create([1,2])", "generateP
review": true }) | 143 Protocol.Runtime.evaluate({ "expression": "Object.create([1,2])", "generateP
review": true }) |
144 .then(result => InspectorTest.logMessage(result.result.result.preview)) | 144 .then(result => InspectorTest.logMessage(result.result.result.preview)) |
145 .then(next); | 145 .then(next); |
146 } | 146 } |
147 ]); | 147 ]); |
OLD | NEW |