| <!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="/core/analysis/related_events.html"> |
| <link rel="import" href="/core/test_utils.html"> |
| <link rel="import" href="/core/selection.html"> |
| <link rel="import" href="/model/model.html"> |
| <link rel="import" href="/model/thread_slice.html"> |
| |
| <script> |
| 'use strict'; |
| |
| tr.b.unittest.testSuite(function() { |
| var newSliceEx = tr.c.test_utils.newSliceEx; |
| var newFlowEventEx = tr.c.test_utils.newFlowEventEx; |
| |
| test('instantiate', function() { |
| var m = tr.c.test_utils.newModel(function(m) { |
| m.p1 = m.getOrCreateProcess(1); |
| |
| m.t2 = m.p1.getOrCreateThread(2); |
| m.t3 = m.p1.getOrCreateThread(3); |
| m.t4 = m.p1.getOrCreateThread(4); |
| |
| m.sA = m.t2.sliceGroup.pushSlice( |
| newSliceEx({title: 'a', start: 0, end: 5, |
| type: tr.model.ThreadSlice})); |
| m.sB = m.t3.sliceGroup.pushSlice( |
| newSliceEx({title: 'b', start: 10, end: 15, |
| type: tr.model.ThreadSlice})); |
| m.sC = m.t4.sliceGroup.pushSlice( |
| newSliceEx({title: 'c', start: 20, end: 20, |
| type: tr.model.ThreadSlice})); |
| |
| m.t2.createSubSlices(); |
| m.t3.createSubSlices(); |
| m.t4.createSubSlices(); |
| |
| m.f1 = newFlowEventEx({ |
| 'title': 'flowish', start: 0, end: 10, |
| startSlice: m.sA, |
| endSlice: m.sB |
| }); |
| m.f2 = newFlowEventEx({ |
| 'title': 'flowish', start: 15, end: 21, |
| startSlice: m.sB, |
| endSlice: m.sC |
| }); |
| }); |
| |
| var viewEl = document.createElement('tr-c-a-related-events'); |
| viewEl.addRelatedEvents(new tr.c.Selection([m.sA, m.f1, m.sB, m.f2, m.sC])); |
| this.addHTMLOutput(viewEl); |
| }); |
| |
| }); |
| </script> |