Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
| 3 | Copyright (c) 2013 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="/core/analysis/analysis_view.html"> |
| 9 | <link rel="import" href="/core/test_utils.html"> |
| 10 | <link rel="import" href="/core/selection.html"> |
Chris Craik | 24385db | 2015-06-11 11:16:26 -0700 | [diff] [blame] | 11 | <link rel="import" href="/model/model.html"> |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 12 | |
| 13 | <script> |
| 14 | 'use strict'; |
| 15 | |
Chris Craik | 24385db | 2015-06-11 11:16:26 -0700 | [diff] [blame] | 16 | tr.b.unittest.testSuite(function() { |
| 17 | var Model = tr.Model; |
| 18 | var Selection = tr.c.Selection; |
| 19 | var test_utils = tr.c.test_utils; |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 20 | |
| 21 | test('analyzeSelectionWithSingleEvent', function() { |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame] | 22 | 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 Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 42 | |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 43 | var selection = new Selection(); |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame] | 44 | selection.push(model.fe); |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 45 | assert.equal(selection.length, 1); |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 46 | |
Chris Craik | 24385db | 2015-06-11 11:16:26 -0700 | [diff] [blame] | 47 | var subView = document.createElement('tr-c-a-single-flow-event-sub-view'); |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 48 | subView.selection = selection; |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 49 | this.addHTMLOutput(subView); |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 50 | }); |
| 51 | }); |
| 52 | </script> |