• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5'use strict';
6
7base.require('tracing.test_utils');
8base.require('tracing.timeline_track_view');
9base.require('tracing.trace_model');
10
11base.unittest.testSuite('tracing.tracks.cpu_track', function() {
12  var Cpu = tracing.trace_model.Cpu;
13  var CpuTrack = tracing.tracks.CpuTrack;
14  var Slice = tracing.trace_model.Slice;
15  var Viewport = tracing.TimelineViewport;
16
17  test('basicCpu', function() {
18    var testEl = document.createElement('div');
19
20    var cpu = new Cpu(7);
21    cpu.slices = [
22      new Slice('', 'a', 0, 1, {}, 1),
23      new Slice('', 'b', 1, 2.1, {}, 4.8)
24    ];
25    cpu.updateBounds();
26
27    var viewport = new Viewport(testEl);
28
29    var drawingContainer = new tracing.tracks.DrawingContainer(viewport);
30
31    var track = CpuTrack(viewport);
32    drawingContainer.appendChild(track);
33
34    track.heading = 'CPU ' + cpu.cpuNumber;
35    track.cpu = cpu;
36    track.viewport.xSetWorldBounds(0, 11.1, track.clientWidth);
37  });
38});
39