Home | History | Annotate | Download | only in src
      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 i18n-values="dir:textdirection;">
      9 <title>Interactive Timeline Tests</title>
     10 <script src="base.js"></script>
     11 </head>
     12 <body>
     13   <div class="timeline-test" src="../test_data/trivial_trace.json" create-detached=1>
     14   </div>
     15 
     16   <div class="timeline-test" src="../test_data/trivial_trace.json">
     17   </div>
     18 
     19   <div class="timeline-test" src="../test_data/simple_trace.json">
     20   </div>
     21 
     22   <div class="timeline-test" src="../test_data/instance_counters.json">
     23   </div>
     24 
     25   <div class="timeline-test" src="../test_data/tall_trace.json">
     26   </div>
     27 
     28   <div class="timeline-test" src="../test_data/big_trace.json">
     29   </div>
     30 
     31   <div class="timeline-test" src="../test_data/huge_trace.json">
     32   </div>
     33 
     34   <div class="timeline-test" src="../test_data/main_thread_has_unclosed_slices.json">
     35   </div>
     36 
     37   <div class="timeline-test" src="../test_data/async_begin_end.json">
     38   </div>
     39 
     40   <script>
     41   base.require('timeline_view');
     42   base.require('test_utils');
     43 
     44   function load(parentEl) {
     45     var src = parentEl.getAttribute('src');
     46     if (document.location.hash && document.location.hash.substring(1) != src) {
     47       parentEl.hidden = true;
     48       return;
     49     }
     50     parentEl.hidden = false;
     51     parentEl.textContent = '';
     52     var titleEl = document.createElement('h3');
     53     var linkEl = document.createElement('a');
     54     linkEl.textContent = src;
     55     linkEl.href = '#' + src;
     56     titleEl.appendChild(linkEl);
     57 
     58     var containerEl = document.createElement('div');
     59     containerEl.tabIndex = 0;
     60     containerEl.style.border = '1px solid red';
     61     containerEl.style.display = '-webkit-box';
     62     containerEl.style.maxHeight = '800px';
     63 
     64     var timelineViewEl = document.createElement('div');
     65     base.ui.decorate(timelineViewEl, tracing.TimelineView);
     66     timelineViewEl.focusElement = containerEl;
     67 
     68     parentEl.appendChild(titleEl);
     69     parentEl.appendChild(containerEl);
     70 
     71     // Creating attached vs detached stress tests the canvas- and viewport-
     72     // setup code.
     73     var create_detached = parentEl.getAttribute('create-attached') == 1;
     74     function createModel(data) {
     75       timelineViewEl.model = new tracing.TimelineModel(data);
     76       if (!create_detached)
     77         containerEl.appendChild(timelineViewEl);
     78     }
     79     if (create_detached)
     80       containerEl.appendChild(timelineViewEl);
     81     test_utils.getAsync(src, createModel);
     82   }
     83 
     84   function onLoad() {
     85     Array.prototype.forEach.call(document.querySelectorAll('.timeline-test'),
     86                                  load);
     87   }
     88   document.addEventListener('DOMContentLoaded', onLoad);
     89 
     90   window.addEventListener('hashchange', onLoad);
     91   </script>
     92 </body>
     93 </html>
     94