Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 1 | <!DOCTYPE html> |
| 2 | <!-- |
| 3 | Copyright (c) 2014 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/side_panel/side_panel.html"> |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 9 | <link rel="import" href="/extras/side_panel/time_summary.html"> |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 10 | <link rel="import" href="/core/side_panel/side_panel_container.html"> |
| 11 | <link rel="import" href="/core/trace_model/trace_model.html"> |
| 12 | |
| 13 | <script> |
| 14 | 'use strict'; |
| 15 | |
| 16 | tv.b.unittest.testSuite(function() { |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 17 | function FakeSelectionController() { |
| 18 | this.addAllEventsMatchingFilterToSelectionReturnValue = []; |
| 19 | |
| 20 | this.viewport = undefined; |
| 21 | this.model = undefined; |
| 22 | this.selection = new tv.c.Selection(); |
| 23 | this.highlight = new tv.c.Selection(); |
| 24 | } |
| 25 | |
| 26 | FakeSelectionController.prototype = { |
| 27 | addEventListener: function(name, cb) { |
| 28 | } |
| 29 | }; |
| 30 | |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 31 | function createModel() { |
| 32 | var m = new tv.c.TraceModel(); |
| 33 | m.importTraces([], false, false, function() { |
| 34 | var browserProcess = m.getOrCreateProcess(1); |
| 35 | var browserMain = browserProcess.getOrCreateThread(2); |
| 36 | browserMain.sliceGroup.beginSlice('cat', 'Task', 0); |
| 37 | browserMain.sliceGroup.endSlice(10); |
| 38 | browserMain.sliceGroup.beginSlice('cat', 'Task', 20); |
| 39 | browserMain.sliceGroup.endSlice(30); |
| 40 | }); |
| 41 | return m; |
| 42 | } |
| 43 | |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 44 | test('instantiateCollapsed', function() { |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 45 | var selectionController = new FakeSelectionController(); |
| 46 | selectionController.model = createModel(); |
| 47 | |
Chris Craik | f516a62 | 2015-04-01 17:52:39 -0700 | [diff] [blame] | 48 | var container = document.createElement('tv-c-side-panel-container'); |
Chris Craik | 44c2820 | 2015-05-12 17:25:16 -0700 | [diff] [blame^] | 49 | container.selectionController = selectionController; |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 50 | this.addHTMLOutput(container); |
| 51 | }); |
Chris Craik | 93216d0 | 2015-03-05 13:58:42 -0800 | [diff] [blame] | 52 | }); |
| 53 | </script> |