Home | History | Annotate | Download | only in examples
      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 Copyright (c) 2012 The Chromium Authors. All rights reserved.
      5 Use of this source code is governed by a BSD-style license that can be
      6 found in the LICENSE file.
      7 -->
      8 <head>
      9   <title>StreamImporter tests</title>
     10   <script src="/src/base.js"></script>
     11   <style>
     12     .view {
     13       border: 1px solid black;
     14       margin: 10px;
     15       height: 350px;
     16     }
     17 
     18     .find-dialog {
     19       border: 1px solid black;
     20       margin: 10px;
     21     }
     22   </style>
     23 </head>
     24 <body>
     25 <script>
     26   base.require('base.unittest');
     27   base.require('tracing.test_utils');
     28   base.require('tracing.timeline_view');
     29   base.require('tracing.importer.timeline_stream_importer');
     30 </script>
     31 <script>
     32   'use strict';
     33 
     34   window.onload = function() {
     35     var num_tests = 1;
     36     var testIndex = 0;
     37     var startTime = 0;
     38 
     39     var model = new tracing.TraceModel();
     40 
     41     var view = new tracing.TimelineView();
     42     view.style.height = '800px';
     43     view.model = model;
     44     view.tabIndex = 0;
     45     view.focusElement = view;
     46 
     47     var streamer = new tracing.importer.TimelineStreamImporter(model);
     48     streamer.addEventListener('connect', function () {
     49       console.log('connected');
     50     });
     51     streamer.addEventListener('disconnect', function () {
     52       console.log('disconnected.');
     53     });
     54     streamer.addEventListener('modelchange', function (event) {
     55       view.model = event.model;
     56     });
     57     streamer.connect(new WebSocket('ws://localhost:8001/stream'));
     58     document.body.appendChild(view);
     59   }
     60 </script>
     61 </body>
     62 </html>
     63