| 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/model/model.html"> | 9 <link rel="import" href="/tracing/model/model.html"> |
| 10 <link rel="import" href="/tracing/model/user_model/stub_expectation.html"> | 10 <link rel="import" href="/tracing/model/user_model/stub_expectation.html"> |
| 11 <link rel="import" href="/tracing/ui/timeline_viewport.html"> | 11 <link rel="import" href="/tracing/ui/timeline_viewport.html"> |
| 12 <link rel="import" href="/tracing/ui/tracks/interaction_track.html"> | 12 <link rel="import" href="/tracing/ui/tracks/interaction_track.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 // UserExpectations should be sorted by start time, not title, so that | 18 // UserExpectations should be sorted by start time, not title, so that |
| 19 // AsyncSliceGroupTrack.buildSubRows_ can lay them out in as few tracks as | 19 // AsyncSliceGroupTrack.buildSubRows_ can lay them out in as few tracks as |
| 20 // possible, so that they mesh instead of stacking unnecessarily. | 20 // possible, so that they mesh instead of stacking unnecessarily. |
| 21 test('instantiate', function() { | 21 test('instantiate', function() { |
| 22 var div = document.createElement('div'); | 22 var div = document.createElement('div'); |
| 23 var viewport = new tr.ui.TimelineViewport(div); | 23 var viewport = new tr.ui.TimelineViewport(div); |
| 24 var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport); | 24 var drawingContainer = new tr.ui.tracks.DrawingContainer(viewport); |
| 25 div.appendChild(drawingContainer); | 25 Polymer.dom(div).appendChild(drawingContainer); |
| 26 var track = new tr.ui.tracks.InteractionTrack(viewport); | 26 var track = new tr.ui.tracks.InteractionTrack(viewport); |
| 27 track.model = tr.c.TestUtils.newModel(function(model) { | 27 track.model = tr.c.TestUtils.newModel(function(model) { |
| 28 var process = model.getOrCreateProcess(1); | 28 var process = model.getOrCreateProcess(1); |
| 29 var thread = process.getOrCreateThread(1); | 29 var thread = process.getOrCreateThread(1); |
| 30 thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx( | 30 thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx( |
| 31 {start: 0, duration: 200})); | 31 {start: 0, duration: 200})); |
| 32 model.userModel.expectations.push(new tr.model.um.StubExpectation( | 32 model.userModel.expectations.push(new tr.model.um.StubExpectation( |
| 33 {parentModel: model, start: 100, duration: 100})); | 33 {parentModel: model, start: 100, duration: 100})); |
| 34 model.userModel.expectations.push(new tr.model.um.StubExpectation( | 34 model.userModel.expectations.push(new tr.model.um.StubExpectation( |
| 35 {parentModel: model, start: 0, duration: 100})); | 35 {parentModel: model, start: 0, duration: 100})); |
| 36 model.userModel.expectations.push(new tr.model.um.StubExpectation( | 36 model.userModel.expectations.push(new tr.model.um.StubExpectation( |
| 37 {parentModel: model, start: 150, duration: 50})); | 37 {parentModel: model, start: 150, duration: 50})); |
| 38 model.userModel.expectations.push(new tr.model.um.StubExpectation( | 38 model.userModel.expectations.push(new tr.model.um.StubExpectation( |
| 39 {parentModel: model, start: 50, duration: 100})); | 39 {parentModel: model, start: 50, duration: 100})); |
| 40 model.userModel.expectations.push(new tr.model.um.StubExpectation( | 40 model.userModel.expectations.push(new tr.model.um.StubExpectation( |
| 41 {parentModel: model, start: 0, duration: 50})); | 41 {parentModel: model, start: 0, duration: 50})); |
| 42 // Model.createImportTracesTask() automatically sorts IRs by start time. | 42 // Model.createImportTracesTask() automatically sorts IRs by start time. |
| 43 }); | 43 }); |
| 44 assert.equal(2, track.subRows_.length); | 44 assert.equal(2, track.subRows_.length); |
| 45 assert.equal(2, track.subRows_[0].length); | 45 assert.equal(2, track.subRows_[0].length); |
| 46 assert.equal(3, track.subRows_[1].length); | 46 assert.equal(3, track.subRows_[1].length); |
| 47 drawingContainer.appendChild(track); | 47 Polymer.dom(drawingContainer).appendChild(track); |
| 48 this.addHTMLOutput(div); | 48 this.addHTMLOutput(div); |
| 49 }); | 49 }); |
| 50 }); | 50 }); |
| 51 </script> | 51 </script> |
| OLD | NEW |