OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2015 The Chromium Authors. All rights reserved. | 3 Copyright (c) 2015 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/core/test_utils.html"> | 8 <link rel="import" href="/tracing/core/test_utils.html"> |
9 <link rel="import" href="/tracing/ui/timeline_viewport.html"> | 9 <link rel="import" href="/tracing/ui/timeline_viewport.html"> |
10 <link rel="import" href="/tracing/ui/tracks/drawing_container.html"> | 10 <link rel="import" href="/tracing/ui/tracks/drawing_container.html"> |
11 <link rel="import" href="/tracing/ui/tracks/global_memory_dump_track.html"> | 11 <link rel="import" href="/tracing/ui/tracks/global_memory_dump_track.html"> |
12 <link rel="import" href="/tracing/ui/tracks/memory_dump_track_test_utils.html"> | 12 <link rel="import" href="/tracing/ui/tracks/memory_dump_track_test_utils.html"> |
13 | 13 |
14 <script> | 14 <script> |
15 'use strict'; | 15 'use strict'; |
16 | 16 |
17 tr.b.unittest.testSuite(function() { | 17 tr.b.unittest.testSuite(function() { |
18 var Viewport = tr.ui.TimelineViewport; | 18 var Viewport = tr.ui.TimelineViewport; |
19 var GlobalMemoryDumpTrack = tr.ui.tracks.GlobalMemoryDumpTrack; | 19 var GlobalMemoryDumpTrack = tr.ui.tracks.GlobalMemoryDumpTrack; |
20 var createTestGlobalMemoryDumps = tr.ui.tracks.createTestGlobalMemoryDumps; | 20 var createTestGlobalMemoryDumps = tr.ui.tracks.createTestGlobalMemoryDumps; |
21 | 21 |
22 function instantiateTrack(withVMRegions, withAllocatorDumps, | 22 function instantiateTrack(withVMRegions, withAllocatorDumps, |
23 expectedTrackCount) { | 23 expectedTrackCount) { |
24 var dumps = createTestGlobalMemoryDumps(withVMRegions, withAllocatorDumps); | 24 var dumps = createTestGlobalMemoryDumps(withVMRegions, withAllocatorDumps); |
25 | 25 |
26 var div = document.createElement('div'); | 26 var div = document.createElement('div'); |
27 var viewport = new Viewport(div); | 27 var viewport = new Viewport(div); |
28 var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport); | 28 var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport); |
29 div.appendChild(drawingContainer); | 29 Polymer.dom(div).appendChild(drawingContainer); |
30 | 30 |
31 var track = new GlobalMemoryDumpTrack(viewport); | 31 var track = new GlobalMemoryDumpTrack(viewport); |
32 drawingContainer.appendChild(track); | 32 Polymer.dom(drawingContainer).appendChild(track); |
33 drawingContainer.invalidate(); | 33 drawingContainer.invalidate(); |
34 | 34 |
35 track.memoryDumps = dumps; | 35 track.memoryDumps = dumps; |
36 this.addHTMLOutput(div); | 36 this.addHTMLOutput(div); |
37 | 37 |
38 var dt = new tr.ui.TimelineDisplayTransform(); | 38 var dt = new tr.ui.TimelineDisplayTransform(); |
39 dt.xSetWorldBounds(0, 50, track.clientWidth); | 39 dt.xSetWorldBounds(0, 50, track.clientWidth); |
40 track.viewport.setDisplayTransformImmediately(dt); | 40 track.viewport.setDisplayTransformImmediately(dt); |
41 | 41 |
42 assert.lengthOf(track.tracks_, expectedTrackCount); | 42 assert.lengthOf(track.tracks_, expectedTrackCount); |
43 }; | 43 }; |
44 | 44 |
45 test('instantiate_dotsOnly', function() { | 45 test('instantiate_dotsOnly', function() { |
46 instantiateTrack.call(this, false, false, 1); | 46 instantiateTrack.call(this, false, false, 1); |
47 }); | 47 }); |
48 | 48 |
49 test('instantiate_withVMRegions', function() { | 49 test('instantiate_withVMRegions', function() { |
50 instantiateTrack.call(this, true, false, 2); | 50 instantiateTrack.call(this, true, false, 2); |
51 }); | 51 }); |
52 | 52 |
53 test('instantiate_withMemoryAllocatorDumps', function() { | 53 test('instantiate_withMemoryAllocatorDumps', function() { |
54 instantiateTrack.call(this, false, true, 2); | 54 instantiateTrack.call(this, false, true, 2); |
55 }); | 55 }); |
56 | 56 |
57 test('instantiate_withBoth', function() { | 57 test('instantiate_withBoth', function() { |
58 instantiateTrack.call(this, true, true, 3); | 58 instantiateTrack.call(this, true, true, 3); |
59 }); | 59 }); |
60 }); | 60 }); |
61 </script> | 61 </script> |
OLD | NEW |