Index: tracing/tracing/metrics/v8/utils_test.html |
diff --git a/tracing/tracing/metrics/v8/utils_test.html b/tracing/tracing/metrics/v8/utils_test.html |
index d5068a16c527a7487e4d338771de56562c065e2a..775de11e7027118b02392425cfecd69b42da8988 100644 |
--- a/tracing/tracing/metrics/v8/utils_test.html |
+++ b/tracing/tracing/metrics/v8/utils_test.html |
@@ -5,7 +5,9 @@ Use of this source code is governed by a BSD-style license that can be |
found in the LICENSE file. |
--> |
+<link rel="import" href="/tracing/core/test_utils.html"> |
<link rel="import" href="/tracing/metrics/v8/utils.html"> |
+<link rel="import" href="/tracing/model/memory_dump_test_utils.html"> |
<script> |
'use strict'; |
@@ -141,5 +143,34 @@ tr.b.unittest.testSuite(function() { |
assert.closeTo(expected.percentile(0.9), actual.percentile(0.9), 1e-3); |
}); |
+ function addDumpWithAllocator(model, process, allocator, start) { |
+ var gmd = tr.model.MemoryDumpTestUtils.addGlobalMemoryDump( |
+ model, {ts: start}); |
+ var pmd = tr.model.MemoryDumpTestUtils.addProcessMemoryDump(gmd, process); |
+ pmd.memoryAllocatorDumps = |
+ [tr.model.MemoryDumpTestUtils.newAllocatorDump(pmd, allocator)]; |
+ } |
+ |
+ test('rangeForMemoryDumps', function() { |
+ var model = tr.c.TestUtils.newModel(function(model) { |
+ var process = model.getOrCreateProcess(1); |
+ addDumpWithAllocator(model, process, 'dummy', 10); |
+ addDumpWithAllocator(model, process, 'v8', 20); |
+ }); |
+ var range = tr.metrics.v8.utils.rangeForMemoryDumps(model); |
+ assert.isFalse(range.isEmpty); |
+ assert.strictEqual(range.min, 20); |
+ assert.strictEqual(range.max, Infinity); |
+ }); |
+ |
+ test('rangeForMemoryDumpsEmpty', function() { |
+ var model = tr.c.TestUtils.newModel(function(model) { |
+ var process = model.getOrCreateProcess(1); |
+ addDumpWithAllocator(model, process, 'dummy', 10); |
+ addDumpWithAllocator(model, process, 'dummy', 20); |
+ }); |
+ var range = tr.metrics.v8.utils.rangeForMemoryDumps(model); |
+ assert.isTrue(range.isEmpty); |
+ }); |
}); |
</script> |