1 <html> 2 <head> 3 <title>Heap Profiler: heap snapshots comparison test</title> 4 <script type="text/javascript"> 5 var aHolder = [], bHolder = [], cHolder = [], dHolder = []; 6 7 function A(x) { 8 this.x = x; 9 } 10 11 function B(x) { 12 this.x = x; 13 } 14 15 function C() {} 16 17 var i; 18 for (i = 0; i < 100; ++i) { 19 var b = new B('hello'); 20 bHolder.push(b); 21 aHolder.push(new A(b)); 22 b = null; 23 } 24 for (i = 0; i < 25; ++i) { 25 cHolder.push(new C()); 26 } 27 28 function D() {} 29 30 function changeStuff() { 31 if (aHolder.length > 0) { 32 aHolder.splice(aHolder.length - 25, 25); 33 } 34 for (i = 0; i < 25; ++i) { 35 bHolder.push(new B('hello')); 36 } 37 cHolder = []; 38 for (i = 0; i < 25; ++i) { 39 dHolder.push(new D()); 40 } 41 } 42 </script> 43 </head> 44 <body> 45 This is the test for heap snapshot comparison functionality. 46 <br> 47 <br> 48 To use this test: 49 <ul> 50 <li>load file in the browser; 51 <li>open DevTools (Ctrl+Shift+I on Win/Linux, Command+Option+I on Mac); 52 <li>go to 'Profiles' page; 53 <li>press 'Take heap snapshot' button 54 (eye icon on the left side of the status bar); 55 <li>press 56 <input type="button" name="changeStuff" value="this button" onclick="changeStuff()" />; 57 <li>press 'Take heap snapshot' button again; 58 </ul> 59 <br> 60 On the left pane under 'Heap snapshots' section, items called 61 'Snapshot 1' and 'Snapshot 2' must appear. Select 'Snapshot 2'. 62 Ensure that absolute values are shown (not percents). 63 <br> 64 <br> 65 TEST 1. Verify the following: 66 <ul> 67 <li>the value in '+/- Count' column for 'A' must be '-25'; 68 <li>after expanding 'A' item, the value in '+/- Count' column 69 for 'Array' child entry must also be '-25'; 70 <li>the value in '+/- Count' column for 'B' must be '+25'; 71 <li>after expanding 'B' item, the value in '+/- Count' column 72 for 'Array' child entry must also be '+25'; the value for 'A' 73 child must be '-25'; 74 </ul> 75 <br> 76 TEST 2. Change display to percent view (using the percent button on the 77 status bar). Verify the following: 78 <ul> 79 <li>values in '+/- Count' and '+/- Size' columns for 'C' must be 'deleted'; 80 <li>values in '+/- Count' and '+/- Size' columns for 'D' must be 'new'; 81 </ul> 82 </body> 83 </html> 84