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

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

Issue 2508423002: Add getter properties to array entry previews (Closed)
Patch Set: just getters Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: test/inspector/runtime/evaluate-with-generate-preview.js
diff --git a/test/inspector/runtime/evaluate-with-generate-preview.js b/test/inspector/runtime/evaluate-with-generate-preview.js
new file mode 100644
index 0000000000000000000000000000000000000000..c7f8cea061a390f9ce4186d1ff17e3a324290796
--- /dev/null
+++ b/test/inspector/runtime/evaluate-with-generate-preview.js
@@ -0,0 +1,36 @@
+// Copyright 2016 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+print("Tests that Runtime.evaluate will generate correct previews.");
+
+InspectorTest.addScript(
+`
+Object.prototype[0] = 'default-first';
+var obj = {p1: {a:1}, p2: {b:'foo'}};
+Object.defineProperty(obj, 1, {
+ get() { return 2 }
+});
+
+Array.prototype[0] = 'default-first';
+var arr = [,, 1, [2]];
+Object.defineProperty(arr, 1, {
dgozman 2016/11/24 00:33:32 Let's add a property with only a setter, and with
luoe 2016/12/02 00:14:33 Done.
+ get() { return 2 }
+});
+`);
+
+InspectorTest.runTestSuite([
+ function testObjectPropertiesPreview(next)
+ {
+ Protocol.Runtime.evaluate({ "expression": "obj", "generatePreview": true })
+ .then(result => InspectorTest.logMessage(result.result.result.preview))
+ .then(next);
+ },
+
+ function testArrayPropertiesPreview(next)
+ {
+ Protocol.Runtime.evaluate({ "expression": "arr", "generatePreview": true })
+ .then(result => InspectorTest.logMessage(result.result.result.preview))
+ .then(next);
+ }
+]);

Powered by Google App Engine
This is Rietveld 408576698