blob: df3179a73f1db49672ee515301edd6f4b349cca5 [file] [log] [blame]
Chris Craik93216d02015-03-05 13:58:42 -08001<!DOCTYPE html>
2<!--
3Copyright (c) 2013 The Chromium Authors. All rights reserved.
4Use of this source code is governed by a BSD-style license that can be
5found in the LICENSE file.
6-->
7
8<link rel="import" href="/core/analysis/analysis_view.html">
9<link rel="import" href="/core/test_utils.html">
10<link rel="import" href="/core/selection.html">
Chris Craik24385db2015-06-11 11:16:26 -070011<link rel="import" href="/model/model.html">
Chris Craik93216d02015-03-05 13:58:42 -080012
13<script>
14'use strict';
15
Chris Craik24385db2015-06-11 11:16:26 -070016tr.b.unittest.testSuite(function() {
17 var Model = tr.Model;
18 var Selection = tr.c.Selection;
19 var test_utils = tr.c.test_utils;
Chris Craik93216d02015-03-05 13:58:42 -080020
21 test('analyzeSelectionWithSingleEvent', function() {
Chris Craik44c28202015-05-12 17:25:16 -070022 var model = test_utils.newModel(function(model) {
23 model.p1 = model.getOrCreateProcess(1);
24 model.t2 = model.p1.getOrCreateThread(model.p1);
25 model.sA = model.t2.sliceGroup.pushSlice(test_utils.newSliceEx({
26 title: 'a', start: 0, end: 2
27 }));
28 model.sB = model.t2.sliceGroup.pushSlice(test_utils.newSliceEx({
29 title: 'b', start: 9, end: 11
30 }));
31 model.fe = test_utils.newFlowEventEx({
32 cat: 'cat',
33 id: 1234,
34 title: 'MyFlow',
35 start: 1,
36 end: 10,
37 startSlice: model.sA,
38 endSlice: model.sB
39 });
40 model.flowEvents.push(model.fe);
41 });
Chris Craik93216d02015-03-05 13:58:42 -080042
Chris Craik93216d02015-03-05 13:58:42 -080043 var selection = new Selection();
Chris Craik44c28202015-05-12 17:25:16 -070044 selection.push(model.fe);
Chris Craikf516a622015-04-01 17:52:39 -070045 assert.equal(selection.length, 1);
Chris Craik93216d02015-03-05 13:58:42 -080046
Chris Craik24385db2015-06-11 11:16:26 -070047 var subView = document.createElement('tr-c-a-single-flow-event-sub-view');
Chris Craik93216d02015-03-05 13:58:42 -080048 subView.selection = selection;
Chris Craik93216d02015-03-05 13:58:42 -080049 this.addHTMLOutput(subView);
Chris Craik93216d02015-03-05 13:58:42 -080050 });
51});
52</script>