blob: 9e2df299ebc10be51d2eeef045bd2e7d175db5de [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="/core/test_utils.html">
<link rel="import" href="/core/trace_model/trace_model.html">
<script>
'use strict';
tv.b.unittest.testSuite(function() { // @suppress longLineCheck
var Process = tv.c.trace_model.Process;
var Thread = tv.c.trace_model.Thread;
var AsyncSlice = tv.c.trace_model.AsyncSlice;
var AsyncSliceGroup = tv.c.trace_model.AsyncSliceGroup;
var newAsyncSlice = tv.c.test_utils.newAsyncSlice;
test('asyncSliceGroupBounds_Empty', function() {
var thread = {};
var g = new AsyncSliceGroup(thread);
g.updateBounds();
assert.isTrue(g.bounds.isEmpty);
});
test('asyncSliceGroupBounds_Basic', function() {
var model = new tv.c.TraceModel();
var p1 = new Process(model, 1);
var t1 = new Thread(p1, 1);
var g = new AsyncSliceGroup(t1);
g.push(newAsyncSlice(0, 1, t1, t1));
g.push(newAsyncSlice(1, 1.5, t1, t1));
assert.equal(g.length, 2);
g.updateBounds();
assert.equal(g.bounds.min, 0);
assert.equal(g.bounds.max, 2.5);
});
test('asyncSliceGroupStableId', function() {
var model = new tv.c.TraceModel();
var process = model.getOrCreateProcess(123);
var thread = process.getOrCreateThread(456);
var group = new AsyncSliceGroup(thread);
assert.equal(process.stableId, 123);
assert.equal(thread.stableId, '123.456');
assert.equal(group.stableId, '123.456.AsyncSliceGroup');
});
});
</script>