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("Test that descriptions for arrays, maps, and sets include the
correct length or size.") | 5 let {session, contextGroup, Protocol} = InspectorTest.start("Test that descripti
ons for arrays, maps, and sets include the correct length or size.") |
6 | 6 |
7 InspectorTest.setupInjectedScriptEnvironment(); | 7 contextGroup.setupInjectedScriptEnvironment(); |
8 | 8 |
9 Promise.all([ | 9 Promise.all([ |
10 testExpression("new Set()"), | 10 testExpression("new Set()"), |
11 testExpression("new Set([1,2])"), | 11 testExpression("new Set([1,2])"), |
12 testExpression("new Map()"), | 12 testExpression("new Map()"), |
13 testExpression("new Map([[1,2],[3,4]])"), | 13 testExpression("new Map([[1,2],[3,4]])"), |
14 testExpression("new Array()"), | 14 testExpression("new Array()"), |
15 testExpression("new Array(2)"), | 15 testExpression("new Array(2)"), |
16 testExpression("new Uint8Array()"), | 16 testExpression("new Uint8Array()"), |
17 testExpression("new Uint8Array(2)"), | 17 testExpression("new Uint8Array(2)"), |
18 // WeakMap and WeakSet should not have size in description. | 18 // WeakMap and WeakSet should not have size in description. |
19 testExpression("new WeakMap([[{}, 42]])"), | 19 testExpression("new WeakMap([[{}, 42]])"), |
20 testExpression("new WeakSet([{}])") | 20 testExpression("new WeakSet([{}])") |
21 ]).then(() => InspectorTest.completeTest()); | 21 ]).then(() => InspectorTest.completeTest()); |
22 | 22 |
23 function testExpression(expression) { | 23 function testExpression(expression) { |
24 return Protocol.Runtime.evaluate({ expression: expression }) | 24 return Protocol.Runtime.evaluate({ expression: expression }) |
25 .then(result => InspectorTest.logMessage(result.result.result.descri
ption)) | 25 .then(result => InspectorTest.logMessage(result.result.result.descri
ption)) |
26 .then(() => Protocol.Runtime.evaluate({ expression: "[" + expression
+ "]", generatePreview: true })) | 26 .then(() => Protocol.Runtime.evaluate({ expression: "[" + expression
+ "]", generatePreview: true })) |
27 .then(result => InspectorTest.logMessage(result.result.result.previe
w.properties[0].value)) | 27 .then(result => InspectorTest.logMessage(result.result.result.previe
w.properties[0].value)) |
28 } | 28 } |
OLD | NEW |