blob: dda5149a28dc3c3fef2d4f0ffe7566fb48f78398 [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="/core/analysis/single_thread_slice_sub_view.html">
<link rel="import" href="/core/test_utils.html">
<link rel="import" href="/core/selection.html">
<link rel="import" href="/model/model.html">
<link rel="import" href="/model/thread_slice.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
var newSliceEx = tr.c.test_utils.newSliceEx;
var newFlowEventEx = tr.c.test_utils.newFlowEventEx;
test('instantiate', function() {
var model = new tr.Model();
var t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
t53.sliceGroup.pushSlice(
newSliceEx({title: 'a', start: 0.0, duration: 0.5}));
t53.sliceGroup.createSubSlices();
var selection = new tr.c.Selection();
selection.push(t53.sliceGroup.slices[0]);
var viewEl = document.createElement('tr-c-a-single-thread-slice-sub-view');
viewEl.selection = selection;
this.addHTMLOutput(viewEl);
});
test('instantiateWithFlowEvent', function() {
var m = tr.c.test_utils.newModel(function(m) {
m.p1 = m.getOrCreateProcess(1);
m.t2 = m.p1.getOrCreateThread(2);
m.t3 = m.p1.getOrCreateThread(3);
m.t4 = m.p1.getOrCreateThread(4);
m.sA = m.t2.sliceGroup.pushSlice(
newSliceEx({title: 'a', start: 0, end: 5,
type: tr.model.ThreadSlice}));
m.sB = m.t3.sliceGroup.pushSlice(
newSliceEx({title: 'b', start: 10, end: 15,
type: tr.model.ThreadSlice}));
m.sC = m.t4.sliceGroup.pushSlice(
newSliceEx({title: 'c', start: 20, end: 20,
type: tr.model.ThreadSlice}));
m.t2.createSubSlices();
m.t3.createSubSlices();
m.t4.createSubSlices();
m.f1 = newFlowEventEx({
'title': 'flowish', start: 0, end: 10,
startSlice: m.sA,
endSlice: m.sB
});
m.f2 = newFlowEventEx({
'title': 'flowish', start: 15, end: 21,
startSlice: m.sB,
endSlice: m.sC
});
});
var selection = new tr.c.Selection();
selection.push(m.sA);
var viewEl = document.createElement('tr-c-a-single-thread-slice-sub-view');
viewEl.selection = selection;
this.addHTMLOutput(viewEl);
});
});
</script>