summaryrefslogtreecommitdiffstats
path: root/chromium/third_party/catapult/tracing/tracing/ui/analysis/alert_sub_view_test.html
blob: 0f639da15720f78a7bfe96820f06c814ca10d180 (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
<!DOCTYPE html>
<!--
Copyright (c) 2015 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.
-->

<link rel="import" href="/tracing/base/utils.html">
<link rel="import" href="/tracing/core/test_utils.html">
<link rel="import" href="/tracing/model/event_set.html">
<link rel="import" href="/tracing/model/model.html">
<link rel="import" href="/tracing/ui/analysis/analysis_view.html">
<link rel="import" href="/tracing/ui/base/deep_utils.html">

<script>
'use strict';

// See https://crbug.com/1143376.
tr.b.unittest.skippedTestSuite(function() {
  const newSliceEx = tr.c.TestUtils.newSliceEx;

  test('instantiate', function() {
    const slice = newSliceEx({title: 'b', start: 0, duration: 0.002});

    const alertInfo = new tr.model.EventInfo(
        'alertInfo', 'Critical alert',
        [{
          label: 'Project Page',
          textContent: 'Trace-Viewer Github Project',
          href: 'https://github.com/google/trace-viewer/'
        }]);

    const alert = new tr.model.Alert(alertInfo, 5, [slice]);
    assert.strictEqual(1, alert.associatedEvents.length);

    const subView = document.createElement('tr-ui-a-alert-sub-view');
    subView.selection = new tr.model.EventSet(alert);
    assert.isTrue(
        subView.relatedEventsToHighlight.equals(alert.associatedEvents));
    this.addHTMLOutput(subView);

    const table = tr.ui.b.findDeepElementMatching(
        subView, 'tr-ui-b-table');

    const rows = table.tableRows;
    const columns = table.tableColumns;
    assert.lengthOf(rows, 4);
    assert.lengthOf(columns, 2);
  });

  // See https://crbug.com/1143376.
  skipTest('instantiate_twoAlertsWithRelatedEvents', function() {
    const slice1 = newSliceEx({title: 'b', start: 0, duration: 0.002});
    const slice2 = newSliceEx({title: 'b', start: 1, duration: 0.002});

    const alertInfo1 = new tr.model.EventInfo(
        'alertInfo1', 'Critical alert',
        [{
          label: 'Project Page',
          textContent: 'Trace-Viewer Github Project',
          href: 'https://github.com/google/trace-viewer/'
        }]);

    const alertInfo2 = new tr.model.EventInfo(
        'alertInfo2', 'Critical alert',
        [{
          label: 'Google Homepage',
          textContent: 'Google Search Page',
          href: 'http://www.google.com'
        }]);

    const alert1 = new tr.model.Alert(alertInfo1, 5, [slice1]);
    const alert2 = new tr.model.Alert(alertInfo2, 5, [slice2]);

    const subView = document.createElement('tr-ui-a-alert-sub-view');
    subView.selection = new tr.model.EventSet([alert1, alert2]);
    assert.isTrue(subView.relatedEventsToHighlight.equals(
        new tr.model.EventSet([
          tr.b.getOnlyElement(alert1.associatedEvents),
          tr.b.getOnlyElement(alert2.associatedEvents)
        ])));
  });
});
</script>