blob: 5ff3f314655ca492ccb46d926ffee3e17738d3df [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="/tracing/core/test_utils.html">
<link rel="import" href="/tracing/model/comment_box_annotation.html">
<link rel="import" href="/tracing/model/location.html">
<link rel="import" href="/tracing/model/model.html">
<link rel="import" href="/tracing/model/rect_annotation.html">
<link rel="import" href="/tracing/model/x_marker_annotation.html">
<link rel="import" href="/tracing/ui/timeline_track_view.html">
<link rel="import" href="/tracing/ui/timeline_viewport.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
function createPopulatedTimeline() {
var model = new tr.Model();
var process = model.getOrCreateProcess(1);
var thread = process.getOrCreateThread(2);
thread.sliceGroup.pushSlice(tr.c.TestUtils.newSliceEx(
{title: 'a', start: 80, duration: 50}));
var timeline = document.createElement('tr-ui-timeline-track-view');
var vp = new tr.ui.TimelineViewport(timeline);
timeline.model = model;
timeline.style.maxHeight = '600px';
return timeline;
}
test('rectAnnotation', function() {
var fakeYComponents1 = [{stableId: '1.2', yPercentOffset: 0.3}];
var fakeYComponents2 = [{stableId: '1.2', yPercentOffset: 0.9}];
var start = new tr.model.Location(50, fakeYComponents1);
var end = new tr.model.Location(100, fakeYComponents2);
var rectAnnotation = new tr.model.RectAnnotation(start, end);
var timeline = createPopulatedTimeline();
timeline.model.addAnnotation(rectAnnotation);
this.addHTMLOutput(timeline);
});
test('xMarkerAnnotation', function() {
var xMarkerAnnotation = new tr.model.XMarkerAnnotation(90);
var timeline = createPopulatedTimeline();
var model = timeline.model;
timeline.model.addAnnotation(xMarkerAnnotation);
this.addHTMLOutput(timeline);
});
test('commentBoxAnnotation', function() {
var fakeYComponents = [{stableId: '1.2', yPercentOffset: 0.5}];
var location = new tr.model.Location(120, fakeYComponents);
var text = 'abc';
var commentBoxAnnotation =
new tr.model.CommentBoxAnnotation(location, text);
var timeline = createPopulatedTimeline();
timeline.model.addAnnotation(commentBoxAnnotation);
this.addHTMLOutput(timeline);
});
});
</script>