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

Side by Side Diff: test/mjsunit/mirror-array.js

Issue 16539: Factored the generation of JSON serialization from beeing part of the mirror ... (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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/mirror-delay.js ('k') | test/mjsunit/mirror-function.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2008 the V8 project authors. All rights reserved. 1 // Copyright 2008 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 29 matching lines...) Expand all
40 assertTrue(mirror instanceof debug.ArrayMirror); 40 assertTrue(mirror instanceof debug.ArrayMirror);
41 41
42 // Check the mirror properties. 42 // Check the mirror properties.
43 assertTrue(mirror.isArray()); 43 assertTrue(mirror.isArray());
44 assertEquals('object', mirror.type()); 44 assertEquals('object', mirror.type());
45 assertFalse(mirror.isPrimitive()); 45 assertFalse(mirror.isPrimitive());
46 assertEquals('Array', mirror.className()); 46 assertEquals('Array', mirror.className());
47 assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror); 47 assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror);
48 assertTrue(mirror.protoObject() instanceof debug.Mirror); 48 assertTrue(mirror.protoObject() instanceof debug.Mirror);
49 assertTrue(mirror.prototypeObject() instanceof debug.Mirror); 49 assertTrue(mirror.prototypeObject() instanceof debug.Mirror);
50 assertEquals(mirror.length(), a.length); 50 assertEquals(mirror.length(), a.length, "Length mismatch");
51 51
52 var indexedValueMirrors = mirror.indexedPropertiesFromRange(); 52 var indexedValueMirrors = mirror.indexedPropertiesFromRange();
53 assertEquals(indexedValueMirrors.length, a.length); 53 assertEquals(indexedValueMirrors.length, a.length);
54 for (var i = 0; i < indexedValueMirrors.length; i++) { 54 for (var i = 0; i < indexedValueMirrors.length; i++) {
55 assertTrue(indexedValueMirrors[i] instanceof debug.Mirror); 55 assertTrue(indexedValueMirrors[i] instanceof debug.Mirror);
56 if (a[i]) { 56 if (a[i]) {
57 assertTrue(indexedValueMirrors[i] instanceof debug.PropertyMirror); 57 assertTrue(indexedValueMirrors[i] instanceof debug.PropertyMirror);
58 } 58 }
59 } 59 }
60 60
61 // Parse JSON representation and check. 61 // Parse JSON representation and check.
62 var fromJSON = eval('(' + json + ')'); 62 var fromJSON = eval('(' + json + ')');
63 assertEquals('object', fromJSON.type); 63 assertEquals('object', fromJSON.type);
64 assertEquals('Array', fromJSON.className); 64 assertEquals('Array', fromJSON.className);
65 assertEquals('function', fromJSON.constructorFunction.type); 65 assertEquals('function', fromJSON.constructorFunction.type);
66 assertEquals('Array', fromJSON.constructorFunction.name); 66 assertEquals('Array', fromJSON.constructorFunction.name);
67 assertEquals(a.length, fromJSON.length); 67 assertEquals(a.length, fromJSON.length, "Length mismatch in parsed JSON");
68 68
69 // Check that the serialization contains all indexed properties. 69 // Check that the serialization contains all indexed properties.
70 for (var i = 0; i < fromJSON.indexedProperties.length; i++) { 70 for (var i = 0; i < fromJSON.indexedProperties.length; i++) {
71 var index = fromJSON.indexedProperties[i].name; 71 var index = fromJSON.indexedProperties[i].name;
72 assertEquals(indexedValueMirrors[index].name(), index); 72 assertEquals(indexedValueMirrors[index].name(), index);
73 assertEquals(indexedValueMirrors[index].value().type(), fromJSON.indexedProp erties[i].value.type, index); 73 assertEquals(indexedValueMirrors[index].value().type(), fromJSON.indexedProp erties[i].value.type, index);
74 } 74 }
75 75
76 // Check that the serialization contains all names properties. 76 // Check that the serialization contains all names properties.
77 if (names) { 77 if (names) {
(...skipping 22 matching lines...) Expand all
100 a[100]=7; 100 a[100]=7;
101 testArrayMirror(a); 101 testArrayMirror(a);
102 102
103 a=[1,2,3]; 103 a=[1,2,3];
104 a.x=2.2; 104 a.x=2.2;
105 a.y=function(){return null;} 105 a.y=function(){return null;}
106 testArrayMirror(a, ['x','y']); 106 testArrayMirror(a, ['x','y']);
107 107
108 var a = []; a.push(a); 108 var a = []; a.push(a);
109 testArrayMirror(a); 109 testArrayMirror(a);
OLDNEW
« no previous file with comments | « src/mirror-delay.js ('k') | test/mjsunit/mirror-function.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698