Home | History | Annotate | Download | only in analysis
      1 <!DOCTYPE html>
      2 <!--
      3 Copyright (c) 2015 The Chromium Authors. All rights reserved.
      4 Use of this source code is governed by a BSD-style license that can be
      5 found in the LICENSE file.
      6 -->
      7 
      8 <link rel="import" href="/tracing/core/test_utils.html">
      9 <link rel="import" href="/tracing/model/event_set.html">
     10 <link rel="import" href="/tracing/model/model.html">
     11 <link rel="import" href="/tracing/ui/analysis/analysis_view.html">
     12 <link rel="import" href="/tracing/ui/base/deep_utils.html">
     13 
     14 <script>
     15 'use strict';
     16 
     17 tr.b.unittest.testSuite(function() {
     18   var newSliceEx = tr.c.TestUtils.newSliceEx;
     19 
     20   test('instantiate', function() {
     21     var slice = newSliceEx({title: 'b', start: 0, duration: 0.002});
     22 
     23     var ALERT_INFO_1 = new tr.model.EventInfo(
     24         'Alert 1', 'Critical alert',
     25         [{
     26           label: 'Project Page',
     27           textContent: 'Trace-Viewer Github Project',
     28           href: 'https://github.com/google/trace-viewer/'
     29         }]);
     30 
     31     var alert = new tr.model.Alert(ALERT_INFO_1, 5, [slice]);
     32     assert.equal(1, alert.associatedEvents.length);
     33 
     34     var selection = new tr.model.EventSet();
     35     selection.push(alert);
     36 
     37     var subView = document.createElement('tr-ui-a-alert-sub-view');
     38     subView.selection = selection;
     39     assert.strictEqual(subView.relatedEventsToHighlight,
     40                        alert.associatedEvents);
     41     this.addHTMLOutput(subView);
     42 
     43     var table = tr.b.findDeepElementMatching(
     44         subView, 'tr-ui-b-table');
     45 
     46     var rows = table.tableRows;
     47     var columns = table.tableColumns;
     48     assert.lengthOf(rows, 4);
     49     assert.lengthOf(columns, 2);
     50   });
     51 });
     52 </script>
     53