| <!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="/core/timeline_viewport.html"> |
| <link rel="import" href="/core/tracks/drawing_container.html"> |
| <link rel="import" href="/core/tracks/global_memory_dump_track.html"> |
| <link rel="import" href="/core/tracks/memory_dump_track_test_utils.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tv.b.unittest.testSuite(function() { |
| var Viewport = tv.c.TimelineViewport; |
| var GlobalMemoryDumpTrack = tv.c.tracks.GlobalMemoryDumpTrack; |
| var createTestGlobalMemoryDumps = tv.c.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 tv.c.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 tv.c.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> |