blob: 802bc99aa3425730a812a0aa0def956cfa34d409 [file] [log] [blame]
<!DOCTYPE html>
<!--
Copyright (c) 2013 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/base/unit.html">
<link rel="import" href="/tracing/core/test_utils.html">
<link rel="import" href="/tracing/model/event_set.html">
<link rel="import" href="/tracing/model/model.html">
<link rel="import" href="/tracing/ui/analysis/single_sample_sub_view.html">
<link rel="import" href="/tracing/ui/base/deep_utils.html">
<script>
'use strict';
tr.b.unittest.testSuite(function() {
var Model = tr.Model;
var EventSet = tr.model.EventSet;
var newSampleNamed = tr.c.TestUtils.newSampleNamed;
test('instantiate_withSingleSample', function() {
var t53;
var model = tr.c.TestUtils.newModelWithEvents([], {
shiftWorldToZero: false,
pruneContainers: false,
customizeModelCallback: function(model) {
t53 = model.getOrCreateProcess(52).getOrCreateThread(53);
model.samples.push(newSampleNamed(t53, 'X', 'my-category',
['a', 'b', 'c'], 0.184));
}
});
var t53track = {};
t53track.thread = t53;
var selection = new EventSet();
assert.equal(selection.length, 0);
selection.push(t53.samples[0]);
assert.equal(selection.length, 1);
var view = document.createElement('tr-ui-a-single-sample-sub-view');
view.selection = selection;
this.addHTMLOutput(view);
var table = tr.b.findDeepElementMatching(
view, 'tr-ui-b-table');
var rows = table.tableRows;
assert.equal(rows.length, 3);
assert.equal(rows[0].value, 'X');
assert.equal(rows[1].value.value, 0.184);
assert.strictEqual(rows[1].value.unit, tr.b.Unit.byName.timeStampInMs);
assert.equal(rows[2].value.stackFrame, t53.samples[0].leafStackFrame);
});
});
</script>