OLD | NEW |
| (Empty) |
1 var initialize_MemoryInstrumentationTest = function() { | |
2 | |
3 InspectorTest._memoryBlockSize = function(path, root) | |
4 { | |
5 var pathPos = 0; | |
6 var children = [root]; | |
7 | |
8 while (true) { | |
9 var name = path[pathPos++]; | |
10 var child = null; | |
11 for (var i = 0; i < children.length; i++) { | |
12 if (children[i].name === name) { | |
13 if (pathPos === path.length) | |
14 return children[i].size; | |
15 else { | |
16 child = children[i]; | |
17 break; | |
18 } | |
19 } | |
20 } | |
21 if (child) { | |
22 children = child.children; | |
23 if (!children) { | |
24 InspectorTest.addResult(name + " has no children"); | |
25 return -1; | |
26 } | |
27 } else { | |
28 InspectorTest.addResult(name + " not found"); | |
29 return -1; | |
30 } | |
31 } | |
32 return -1; | |
33 }; | |
34 | |
35 InspectorTest.validateMemoryBlockSize = function(path, expectedMinimalSize) | |
36 { | |
37 function didReceiveMemorySnapshot(error, memoryBlock) | |
38 { | |
39 var size = InspectorTest._memoryBlockSize(path, memoryBlock); | |
40 if (size > expectedMinimalSize) | |
41 InspectorTest.addResult("PASS: block size for path = [" + path.join(
", ") + "] is OK."); | |
42 else { | |
43 InspectorTest.addResult("FAIL: block size for path = [" + path.join(
", ") + "] is too small."); | |
44 InspectorTest.addResult("expected minimal block size is " + expected
MinimalSize + " actual is " + size); | |
45 } | |
46 InspectorTest.completeTest(); | |
47 } | |
48 | |
49 MemoryAgent.getProcessMemoryDistribution(didReceiveMemorySnapshot.bind(this)
); | |
50 }; | |
51 | |
52 }; | |
OLD | NEW |