Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(297)

Side by Side Diff: test/inspector/runtime/evaluate-with-generate-preview.js

Issue 2554623003: Show functions in object previews (Closed)
Patch Set: rebase to drop symbool cl Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 print("Tests that Runtime.evaluate will generate correct previews."); 5 print("Tests that Runtime.evaluate will generate correct previews.");
6 6
7 InspectorTest.addScript( 7 InspectorTest.addScript(
8 ` 8 `
9 var f1 = function(){};
10
9 Object.prototype[0] = 'default-first'; 11 Object.prototype[0] = 'default-first';
10 var obj = {p1: {a:1}, p2: {b:'foo'}}; 12 var obj = {p1: {a:1}, p2: {b:'foo'}, p3: f1};
11 Object.defineProperties(obj, { 13 Object.defineProperties(obj, {
12 p3: { 14 p4: {
13 get() { return 2 } 15 get() { return 2 }
14 }, 16 },
15 p4: { 17 p5: {
16 set(x) { return x } 18 set(x) { return x }
17 }, 19 },
18 p5: { 20 p6: {
19 get() { return 2 }, 21 get() { return 2 },
20 set(x) { return x } 22 set(x) { return x }
21 } 23 }
22 }); 24 });
23 25
24 Array.prototype[0] = 'default-first'; 26 Array.prototype[0] = 'default-first';
25 var arr = [,, 1, [2]]; 27 var arr = [,, 1, [2], f1];
26 Object.defineProperties(arr, { 28 Object.defineProperties(arr, {
27 4: { 29 5: {
28 get() { return 2 } 30 get() { return 2 }
29 }, 31 },
30 5: { 32 6: {
31 set(x) { return x } 33 set(x) { return x }
32 }, 34 },
33 6: { 35 7: {
34 get() { return 2 }, 36 get() { return 2 },
35 set(x) { return x } 37 set(x) { return x }
36 } 38 }
37 }); 39 });
40 arr.nonEntryFunction = f1;
41
42 var inheritingObj = {};
43 var inheritingArr = [];
44 inheritingObj.prototype = obj;
45 inheritingArr.prototype = arr;
38 `); 46 `);
39 47
40 InspectorTest.runTestSuite([ 48 InspectorTest.runTestSuite([
41 function testObjectPropertiesPreview(next) 49 function testObjectPropertiesPreview(next)
42 { 50 {
43 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true }) 51 Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true })
44 .then(result => InspectorTest.logMessage(result.result.result.preview)) 52 .then(result => InspectorTest.logMessage(result.result.result.preview))
45 .then(next); 53 .then(next);
46 }, 54 },
47 55
48 function testArrayPropertiesPreview(next) 56 function testArrayPropertiesPreview(next)
49 { 57 {
50 Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true }) 58 Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true })
51 .then(result => InspectorTest.logMessage(result.result.result.preview)) 59 .then(result => InspectorTest.logMessage(result.result.result.preview))
52 .then(next); 60 .then(next);
61 },
62
63 function testInheritingObjectPropertiesPreview(next)
64 {
65 Protocol.Runtime.evaluate({ "expression": "inheritingObj", "generatePreview" : true })
66 .then(result => InspectorTest.logMessage(result.result.result.preview))
67 .then(next);
68 },
69
70 function testInheritingArrayPropertiesPreview(next)
71 {
72 Protocol.Runtime.evaluate({ "expression": "inheritingArr", "generatePreview" : true })
73 .then(result => InspectorTest.logMessage(result.result.result.preview))
74 .then(next);
53 } 75 }
54 ]); 76 ]);
OLDNEW
« no previous file with comments | « src/inspector/injected-script-source.js ('k') | test/inspector/runtime/evaluate-with-generate-preview-expected.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698