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