summaryrefslogtreecommitdiff
path: root/chromium/third_party/trace-viewer/examples/stream_trace_viewer.html
blob: 329a34b41a892ecc2b2b30498115b43b85fffbed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<!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>
  <title>StreamImporter tests</title>
  <script src="/src/base.js"></script>
  <style>
    .view {
      border: 1px solid black;
      margin: 10px;
      height: 350px;
    }

    .find-dialog {
      border: 1px solid black;
      margin: 10px;
    }
  </style>
</head>
<body>
<script>
  base.require('base.unittest');
  base.require('tracing.test_utils');
  base.require('tracing.timeline_view');
  base.require('tracing.importer.timeline_stream_importer');
</script>
<script>
  'use strict';

  window.onload = function() {
    var num_tests = 1;
    var testIndex = 0;
    var startTime = 0;

    var model = new tracing.TraceModel();

    var view = new tracing.TimelineView();
    view.style.height = '800px';
    view.model = model;
    view.tabIndex = 0;
    view.focusElement = view;

    var streamer = new tracing.importer.TimelineStreamImporter(model);
    streamer.addEventListener('connect', function () {
      console.log('connected');
    });
    streamer.addEventListener('disconnect', function () {
      console.log('disconnected.');
    });
    streamer.addEventListener('modelchange', function (event) {
      view.model = event.model;
    });
    streamer.connect(new WebSocket('ws://localhost:8001/stream'));
    document.body.appendChild(view);
  }
</script>
</body>
</html>