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

Side by Side Diff: test/inspector/runtime/get-properties-preview.js

Issue 2891213002: [inspector] Refactor protocol-test.js (Closed)
Patch Set: comments addressed Created 3 years, 7 months 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 InspectorTest.setupInjectedScriptEnvironment(); 5 let {session, contextGroup, Protocol} = InspectorTest.start('Tests generated pre views in Runtime.getProperties');
6
7 contextGroup.setupInjectedScriptEnvironment();
6 8
7 Protocol.Runtime.evaluate({ "expression": "({p1: {a:1}, p2: {b:'foo', bb:'bar'}} )" }).then(callbackEvaluate); 9 Protocol.Runtime.evaluate({ "expression": "({p1: {a:1}, p2: {b:'foo', bb:'bar'}} )" }).then(callbackEvaluate);
8 10
9 function callbackEvaluate(result) 11 function callbackEvaluate(result)
10 { 12 {
11 Protocol.Runtime.getProperties({ "objectId": result.result.result.objectId, "o wnProperties": true }).then(callbackGetProperties.bind(null, false)); 13 Protocol.Runtime.getProperties({ "objectId": result.result.result.objectId, "o wnProperties": true }).then(callbackGetProperties.bind(null, false));
12 Protocol.Runtime.getProperties({ "objectId": result.result.result.objectId, "o wnProperties": true, "generatePreview": true }).then(callbackGetProperties.bind( null, true)); 14 Protocol.Runtime.getProperties({ "objectId": result.result.result.objectId, "o wnProperties": true, "generatePreview": true }).then(callbackGetProperties.bind( null, true));
13 } 15 }
14 16
15 function callbackGetProperties(completeTest, result) 17 function callbackGetProperties(completeTest, result)
16 { 18 {
17 for (var property of result.result.result) { 19 for (var property of result.result.result) {
18 if (!property.value || property.name === "__proto__") 20 if (!property.value || property.name === "__proto__")
19 continue; 21 continue;
20 if (property.value.preview) 22 if (property.value.preview)
21 InspectorTest.log(property.name + " : " + JSON.stringify(property.value.pr eview, null, 4)); 23 InspectorTest.log(property.name + " : " + JSON.stringify(property.value.pr eview, null, 4));
22 else 24 else
23 InspectorTest.log(property.name + " : " + property.value.description); 25 InspectorTest.log(property.name + " : " + property.value.description);
24 } 26 }
25 if (completeTest) 27 if (completeTest)
26 InspectorTest.completeTest(); 28 InspectorTest.completeTest();
27 } 29 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698