Html程序  |  53行  |  1.15 KB

<!DOCTYPE HTML>
<html>
<!--
Copyright (c) 2012 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.
-->
<head i18n-values="dir:textdirection;">
<title>Track tests</title>
<style>
.container {
  border: 1px solid red;
}
</style>
<script src="/src/base.js"></script>
<script>
  base.require('unittest');
  base.require('test_utils');
  base.require('timeline_track_view');
  base.require('model');
</script>
</head>
<body>
<script>
  'use strict';

  var Cpu = tracing.model.Cpu;
  var CpuTrack = tracing.tracks.CpuTrack;
  var Slice = tracing.model.Slice;
  var Viewport = tracing.TimelineViewport;

  function testBasicCpu() {
    var testEl = this.addHTMLOutput();

    var cpu = new Cpu(7);
    cpu.slices = [
      new Slice('', 'a', 0, 1, {}, 1),
      new Slice('', 'b', 1, 2.1, {}, 4.8)
    ];
    cpu.updateBounds();

    var track = CpuTrack();
    testEl.appendChild(track);
    track.heading = 'CPU ' + cpu.cpuNumber;
    track.cpu = cpu;
    track.viewport = new Viewport(testEl);
    track.viewport.xSetWorldBounds(0, 11.1, track.clientWidth);
  }

</script>
</body>
</html>