Html程序  |  53行  |  1.24 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>TimelineTrack tests</title>
<style>
.timeline-container {
  border: 1px solid red;
}
</style>
<script src="/src/base.js"></script>
<script>
  base.require('unittest');
  base.require('test_utils');
  base.require('timeline');
  base.require('timeline_model');
</script>
</head>
<body>
<script>
  'use strict';

  var TimelineCpu = tracing.TimelineCpu;
  var TimelineCpuTrack = tracks.TimelineCpuTrack;
  var TimelineSlice = tracing.TimelineSlice;
  var TimelineViewport = tracing.TimelineViewport;

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

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

    var track = TimelineCpuTrack();
    testEl.appendChild(track);
    track.heading = 'CPU ' + cpu.cpuNumber;
    track.cpu = cpu;
    track.viewport = new TimelineViewport(testEl);
    track.viewport.xSetWorldRange(0, 11.1, track.clientWidth);
  }

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