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

Unified Diff: test/mjsunit/mirror-regexp.js

Issue 18092: Added handles to the mirror objects. When a mirror for an object is created... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 11 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/mjsunit/mirror-object.js ('k') | test/mjsunit/mirror-script.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/mjsunit/mirror-regexp.js
===================================================================
--- test/mjsunit/mirror-regexp.js (revision 1079)
+++ test/mjsunit/mirror-regexp.js (working copy)
@@ -39,10 +39,24 @@
'lastIndex': debug.PropertyAttribute.DontEnum | debug.PropertyAttribute.DontDelete
};
+function MirrorRefCache(json_refs) {
+ var tmp = eval('(' + json_refs + ')');
+ this.refs_ = [];
+ for (var i = 0; i < tmp.length; i++) {
+ this.refs_[tmp[i].handle] = tmp[i];
+ }
+}
+
+MirrorRefCache.prototype.lookup = function(handle) {
+ return this.refs_[handle];
+}
+
function testRegExpMirror(r) {
// Create mirror and JSON representation.
var mirror = debug.MakeMirror(r);
- var json = mirror.toJSONProtocol(true);
+ var serializer = debug.MakeMirrorSerializer();
+ var json = serializer.serializeValue(mirror);
+ var refs = new MirrorRefCache(serializer.serializeReferencedObjects());
// Check the mirror hierachy.
assertTrue(mirror instanceof debug.Mirror);
@@ -54,10 +68,6 @@
assertTrue(mirror.isRegExp());
assertEquals('regexp', mirror.type());
assertFalse(mirror.isPrimitive());
- assertEquals(mirror.source(), r.source, 'source');
- assertEquals(mirror.global(), r.global, 'global');
- assertEquals(mirror.ignoreCase(), r.ignoreCase, 'ignoreCase');
- assertEquals(mirror.multiline(), r.multiline, 'multiline');
for (var p in expected_attributes) {
assertEquals(mirror.property(p).attributes(),
expected_attributes[p],
@@ -71,16 +81,21 @@
var fromJSON = eval('(' + json + ')');
assertEquals('regexp', fromJSON.type);
assertEquals('RegExp', fromJSON.className);
- assertEquals(fromJSON.source, r.source, 'source');
- assertEquals(fromJSON.global, r.global, 'global');
- assertEquals(fromJSON.ignoreCase, r.ignoreCase, 'ignoreCase');
- assertEquals(fromJSON.multiline, r.multiline, 'multiline');
for (var p in expected_attributes) {
for (var i = 0; i < fromJSON.properties.length; i++) {
if (fromJSON.properties[i].name == p) {
- assertEquals(fromJSON.properties[i].attributes,
- expected_attributes[p],
- p + ' attributes');
+ assertEquals(expected_attributes[p],
+ fromJSON.properties[i].attributes,
+ 'Unexpected value for ' + p + ' attributes');
+ assertEquals(mirror.property(p).propertyType(),
+ fromJSON.properties[i].propertyType,
+ 'Unexpected value for ' + p + ' propertyType');
+ assertEquals(mirror.property(p).value().handle(),
+ fromJSON.properties[i].ref,
+ 'Unexpected handle for ' + p);
+ assertEquals(mirror.property(p).value().value(),
+ refs.lookup(fromJSON.properties[i].ref).value,
+ 'Unexpected value for ' + p);
}
}
}
« no previous file with comments | « test/mjsunit/mirror-object.js ('k') | test/mjsunit/mirror-script.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698