Lines Matching full:mirror
29 // Test the mirror object for objects
44 // Create mirror and JSON representation.
45 var mirror = debug.MakeMirror(obj);
47 var json = JSON.stringify(serializer.serializeValue(mirror));
51 // Check the mirror hierachy.
52 assertTrue(mirror instanceof debug.Mirror, 'Unexpected mirror hierachy');
53 assertTrue(mirror instanceof debug.ValueMirror, 'Unexpected mirror hierachy');
54 assertTrue(mirror instanceof debug.ObjectMirror, 'Unexpected mirror hierachy');
56 // Check the mirror properties.
57 assertTrue(mirror.isObject(), 'Unexpected mirror');
58 assertEquals('object', mirror.type(), 'Unexpected mirror type');
59 assertFalse(mirror.isPrimitive(), 'Unexpected primitive mirror');
60 assertEquals(cls_name, mirror.className(), 'Unexpected mirror class name');
61 assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror, 'Unexpected mirror hierachy');
62 assertEquals(ctor_name, mirror.constructorFunction().name(), 'Unexpected constructor function name');
63 assertTrue(mirror.protoObject() instanceof debug.Mirror, 'Unexpected mirror hierachy');
64 assertTrue(mirror.prototypeObject() instanceof debug.Mirror, 'Unexpected mirror hierachy');
65 assertFalse(mirror.hasNamedInterceptor(), 'No named interceptor expected');
66 assertFalse(mirror.hasIndexedInterceptor(), 'No indexed interceptor expected');
68 var names = mirror.propertyNames();
69 var properties = mirror.properties();
72 assertTrue(properties[i] instanceof debug.Mirror, 'Unexpected mirror hierachy');
73 assertTrue(properties[i] instanceof debug.PropertyMirror, 'Unexpected mirror hierachy');
74 assertEquals('property', properties[i].type(), 'Unexpected mirror type');
79 var property_mirror = mirror.property(p);
93 assertEquals('object', fromJSON.type, 'Unexpected mirror type in JSON');
94 assertEquals(cls_name, fromJSON.className, 'Unexpected mirror class name in JSON');
95 assertEquals(mirror.constructorFunction().handle(), fromJSON.constructorFunction.ref, 'Unexpected constructor function handle in JSON');
98 assertEquals(mirror.protoObject().handle(), fromJSON.protoObject.ref, 'Unexpected proto object handle in JSON');
99 assertEquals(mirror.protoObject().type(), refs.lookup(fromJSON.protoObject.ref).type, 'Unexpected proto object type in JSON');
100 assertEquals(mirror.prototypeObject().handle(), fromJSON.prototypeObject.ref, 'Unexpected prototype object handle in JSON');
101 assertEquals(mirror.prototypeObject().type(), refs.lookup(fromJSON.prototypeObject.ref).type, 'Unexpected prototype object type in JSON');
181 // Test that non enumerable properties are part of the mirror
199 mirror = debug.MakeMirror(o);
201 assertTrue(mirror.property('a').hasGetter());
202 assertFalse(mirror.property('a').hasSetter());
203 assertEquals(debug.PropertyType.Callbacks, mirror.property('a').propertyType());
204 assertEquals('function', mirror.property('a').getter().type());
205 assertEquals('undefined', mirror.property('a').setter().type());
206 assertEquals('function (){return \'a\';}', mirror.property('a').getter().source());
208 assertFalse(mirror.property('b').hasGetter());
209 assertTrue(mirror.property('b').hasSetter());
210 assertEquals(debug.PropertyType.Callbacks, mirror.property('b').propertyType());
211 assertEquals('undefined', mirror.property('b').getter().type());
212 assertEquals('function', mirror.property('b').setter().type());
213 assertEquals('function (){}', mirror.property('b').setter().source());
214 assertFalse(mirror.property('b').isException());
216 assertTrue(mirror.property('c').hasGetter());
217 assertTrue(mirror.property('c').hasSetter());
218 assertEquals(debug.PropertyType.Callbacks, mirror.property('c').propertyType());
219 assertEquals('function', mirror.property('c').getter().type());
220 assertEquals('function', mirror.property('c').setter().type());
221 assertEquals('function (){throw \'c\';}', mirror.property('c').getter().source());
222 assertEquals('function (){throw \'c\';}', mirror.property('c').setter().source());
225 mirror = debug.MakeMirror(new String('abc'));
226 assertTrue(mirror instanceof debug.ObjectMirror);
227 assertFalse(mirror.property('length').hasGetter());
228 assertFalse(mirror.property('length').hasSetter());
229 assertTrue(mirror.property('length').isNative());
230 assertEquals('a', mirror.property(0).value().value());
231 assertEquals('b', mirror.property(1).value().value());
232 assertEquals('c', mirror.property(2).value().value());