| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright 2016 The Chromium Authors. All rights reserved. | 3 Copyright 2016 The Chromium Authors. All rights reserved. |
| 4 Use of this source code is governed by a BSD-style license that can be | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/model/container_memory_dump.html"> | 8 <link rel="import" href="/tracing/model/container_memory_dump.html"> |
| 9 <link rel="import" href="/tracing/model/global_memory_dump.html"> | 9 <link rel="import" href="/tracing/model/global_memory_dump.html"> |
| 10 <link rel="import" href="/tracing/model/memory_allocator_dump.html"> | 10 <link rel="import" href="/tracing/model/memory_allocator_dump.html"> |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 return value; | 38 return value; |
| 39 } | 39 } |
| 40 | 40 |
| 41 function MemoryDumpTestUtils() { | 41 function MemoryDumpTestUtils() { |
| 42 throw new Error('Static class'); | 42 throw new Error('Static class'); |
| 43 } | 43 } |
| 44 | 44 |
| 45 MemoryDumpTestUtils.SIZE_DELTA = 0.0001; | 45 MemoryDumpTestUtils.SIZE_DELTA = 0.0001; |
| 46 | 46 |
| 47 MemoryDumpTestUtils.addGlobalMemoryDump = function( | 47 MemoryDumpTestUtils.addGlobalMemoryDump = function( |
| 48 model, timestamp, opt_levelOfDetail) { | 48 model, timestamp, opt_levelOfDetail, opt_duration) { |
| 49 var gmd = new GlobalMemoryDump(model, timestamp); | 49 var gmd = new GlobalMemoryDump(model, timestamp); |
| 50 gmd.levelOfDetail = opt_levelOfDetail === undefined ? | 50 gmd.levelOfDetail = opt_levelOfDetail === undefined ? |
| 51 LIGHT : opt_levelOfDetail; | 51 LIGHT : opt_levelOfDetail; |
| 52 if (opt_duration) |
| 53 gmd.duration = opt_duration; |
| 52 model.globalMemoryDumps.push(gmd); | 54 model.globalMemoryDumps.push(gmd); |
| 53 return gmd; | 55 return gmd; |
| 54 }; | 56 }; |
| 55 | 57 |
| 56 MemoryDumpTestUtils.addProcessMemoryDump = function(gmd, process, timestamp) { | 58 MemoryDumpTestUtils.addProcessMemoryDump = function( |
| 57 var pmd = new ProcessMemoryDump(gmd, process, timestamp); | 59 gmd, process, opt_timestamp) { |
| 60 if (opt_timestamp === undefined) |
| 61 opt_timestamp = gmd.start; |
| 62 var pmd = new ProcessMemoryDump(gmd, process, opt_timestamp); |
| 58 process.memoryDumps.push(pmd); | 63 process.memoryDumps.push(pmd); |
| 59 if (process.pid in gmd.processMemoryDumps) { | 64 if (process.pid in gmd.processMemoryDumps) { |
| 60 // Test sanity check. | 65 // Test sanity check. |
| 61 throw new Error('Process memory dump for process with pid=' + | 66 throw new Error('Process memory dump for process with pid=' + |
| 62 process.pid + ' has already been provided'); | 67 process.pid + ' has already been provided'); |
| 63 } | 68 } |
| 64 gmd.processMemoryDumps[process.pid] = pmd; | 69 gmd.processMemoryDumps[process.pid] = pmd; |
| 65 return pmd; | 70 return pmd; |
| 66 }; | 71 }; |
| 67 | 72 |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 assert.strictEqual(actualRegion.mappedFile, expectedRegion.mappedFile); | 147 assert.strictEqual(actualRegion.mappedFile, expectedRegion.mappedFile); |
| 143 assert.deepEqual(actualRegion.byteStats, expectedRegion.byteStats); | 148 assert.deepEqual(actualRegion.byteStats, expectedRegion.byteStats); |
| 144 } | 149 } |
| 145 }; | 150 }; |
| 146 | 151 |
| 147 return { | 152 return { |
| 148 MemoryDumpTestUtils: MemoryDumpTestUtils | 153 MemoryDumpTestUtils: MemoryDumpTestUtils |
| 149 }; | 154 }; |
| 150 }); | 155 }); |
| 151 </script> | 156 </script> |
| OLD | NEW |