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/process_memory_dump_track.html"> | 11 <link rel="import" href="/tracing/ui/tracks/process_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 ProcessMemoryDumpTrack = tr.ui.tracks.ProcessMemoryDumpTrack; | 19 var ProcessMemoryDumpTrack = tr.ui.tracks.ProcessMemoryDumpTrack; |
20 var createTestProcessMemoryDumps = tr.ui.tracks.createTestProcessMemoryDumps; | 20 var createTestProcessMemoryDumps = tr.ui.tracks.createTestProcessMemoryDumps; |
21 | 21 |
22 function instantiateTrack(withVMRegions, withAllocatorDumps, | 22 function instantiateTrack(withVMRegions, withAllocatorDumps, |
23 expectedTrackCount) { | 23 expectedTrackCount) { |
24 var dumps = createTestProcessMemoryDumps(withVMRegions, withAllocatorDumps); | 24 var dumps = createTestProcessMemoryDumps(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 ProcessMemoryDumpTrack(viewport); | 31 var track = new ProcessMemoryDumpTrack(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 | 36 |
37 // TODO(petrcermak): Check that the div has indeed zero size. | 37 // TODO(petrcermak): Check that the div has indeed zero size. |
38 if (expectedTrackCount > 0) | 38 if (expectedTrackCount > 0) |
39 this.addHTMLOutput(div); | 39 this.addHTMLOutput(div); |
40 | 40 |
41 var dt = new tr.ui.TimelineDisplayTransform(); | 41 var dt = new tr.ui.TimelineDisplayTransform(); |
42 dt.xSetWorldBounds(0, 50, track.clientWidth); | 42 dt.xSetWorldBounds(0, 50, track.clientWidth); |
43 track.viewport.setDisplayTransformImmediately(dt); | 43 track.viewport.setDisplayTransformImmediately(dt); |
44 | 44 |
45 assert.lengthOf(track.tracks_, expectedTrackCount); | 45 assert.lengthOf(track.tracks_, expectedTrackCount); |
46 }; | 46 }; |
47 | 47 |
48 test('instantiate_withoutMemoryAllocatorDumps', function() { | 48 test('instantiate_withoutMemoryAllocatorDumps', function() { |
49 instantiateTrack.call(this, false, false, 0); | 49 instantiateTrack.call(this, false, false, 0); |
50 }); | 50 }); |
51 test('instantiate_withMemoryAllocatorDumps', function() { | 51 test('instantiate_withMemoryAllocatorDumps', function() { |
52 instantiateTrack.call(this, false, true, 1); | 52 instantiateTrack.call(this, false, true, 1); |
53 }); | 53 }); |
54 }); | 54 }); |
55 </script> | 55 </script> |
OLD | NEW |