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

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

Issue 2508423002: Add getter properties to array entry previews (Closed)
Patch Set: rebase 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 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..5e747d5ab9ea695c78d1e4bf903f18438ecdea68
--- /dev/null
+++ b/test/inspector/runtime/evaluate-with-generate-preview.js
@@ -0,0 +1,54 @@
+// 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.defineProperties(obj, {
+ p3: {
+ get() { return 2 }
+ },
+ p4: {
+ set(x) { return x }
+ },
+ p5: {
+ get() { return 2 },
+ set(x) { return x }
+ }
+});
+
+Array.prototype[0] = 'default-first';
+var arr = [,, 1, [2]];
+Object.defineProperties(arr, {
+ 4: {
+ get() { return 2 }
+ },
+ 5: {
+ set(x) { return x }
+ },
+ 6: {
+ get() { return 2 },
+ set(x) { return x }
+ }
+});
+`);
+
+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);
+ }
+]);
« 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