blob: 110bd67ba00ac2cc1c5f6fec5033f00bb2ac5b0b [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2015 The Chromium Authors. All rights reserved.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
-->
<link rel="import" href="/core/test_utils.html">
<link rel="import" href="/ui/timeline_viewport.html">
<link rel="import" href="/ui/tracks/drawing_container.html">
<link rel="import" href="/ui/tracks/global_memory_dump_track.html">
<link rel="import" href="/ui/tracks/memory_dump_track_test_utils.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
var Viewport = tr.ui.TimelineViewport;
var GlobalMemoryDumpTrack = tr.ui.tracks.GlobalMemoryDumpTrack;
var createTestGlobalMemoryDumps = tr.ui.tracks.createTestGlobalMemoryDumps;
function instantiateTrack(withVMRegions, withAllocatorDumps,
expectedTrackCount) {
var dumps = createTestGlobalMemoryDumps(withVMRegions, withAllocatorDumps);
var div = document.createElement('div');
var viewport = new Viewport(div);
var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport);
div.appendChild(drawingContainer);
var track = new GlobalMemoryDumpTrack(viewport);
drawingContainer.appendChild(track);
drawingContainer.invalidate();
track.memoryDumps = dumps;
this.addHTMLOutput(div);
var dt = new tr.ui.TimelineDisplayTransform();
dt.xSetWorldBounds(0, 50, track.clientWidth);
track.viewport.setDisplayTransformImmediately(dt);
assert.lengthOf(track.tracks_, expectedTrackCount);
};
test('instantiate_dotsOnly', function() {
instantiateTrack.call(this, false, false, 1);
});
test('instantiate_withVMRegions', function() {
instantiateTrack.call(this, true, false, 2);
});
test('instantiate_withMemoryAllocatorDumps', function() {
instantiateTrack.call(this, false, true, 2);
});
test('instantiate_withBoth', function() {
instantiateTrack.call(this, true, true, 3);
});
});
</script>