| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <!-- | 2 <!-- |
| 3 Copyright (c) 2014 The Chromium Authors. All rights reserved. | 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 | 4 Use of this source code is governed by a BSD-style license that can be |
| 5 found in the LICENSE file. | 5 found in the LICENSE file. |
| 6 --> | 6 --> |
| 7 | 7 |
| 8 <link rel="import" href="/tracing/core/test_utils.html"> | 8 <link rel="import" href="/tracing/core/test_utils.html"> |
| 9 <link rel="import" href="/tracing/model/event_set.html"> | 9 <link rel="import" href="/tracing/model/event_set.html"> |
| 10 <link rel="import" href="/tracing/model/model.html"> | 10 <link rel="import" href="/tracing/model/model.html"> |
| 11 <link rel="import" href="/tracing/ui/base/deep_utils.html"> |
| 11 <link rel="import" href="/tracing/ui/side_panel/side_panel.html"> | 12 <link rel="import" href="/tracing/ui/side_panel/side_panel.html"> |
| 12 <link rel="import" href="/tracing/ui/side_panel/side_panel_container.html"> | 13 <link rel="import" href="/tracing/ui/side_panel/side_panel_container.html"> |
| 13 | 14 |
| 15 <dom-module id="tr-ui-sp-disabled-side-panel"></dom-module> |
| 16 <dom-module id="tr-ui-sp-enabled-side-panel"></dom-module> |
| 17 |
| 14 <script> | 18 <script> |
| 15 'use strict'; | 19 'use strict'; |
| 16 | 20 |
| 17 tr.b.unittest.testSuite(function() { | 21 tr.b.unittest.testSuite(function() { |
| 18 function FakeBrushingStateController() { | 22 function FakeBrushingStateController() { |
| 19 this.addAllEventsMatchingFilterToSelectionReturnValue = []; | 23 this.addAllEventsMatchingFilterToSelectionReturnValue = []; |
| 20 | 24 |
| 21 this.viewport = undefined; | 25 this.viewport = undefined; |
| 22 this.model = undefined; | 26 this.model = undefined; |
| 23 this.selection = new tr.model.EventSet(); | 27 this.selection = new tr.model.EventSet(); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 38 const browserMain = browserProcess.getOrCreateThread(2); | 42 const browserMain = browserProcess.getOrCreateThread(2); |
| 39 browserMain.sliceGroup.beginSlice('cat', 'Task', 0); | 43 browserMain.sliceGroup.beginSlice('cat', 'Task', 0); |
| 40 browserMain.sliceGroup.endSlice(10); | 44 browserMain.sliceGroup.endSlice(10); |
| 41 browserMain.sliceGroup.beginSlice('cat', 'Task', 20); | 45 browserMain.sliceGroup.beginSlice('cat', 'Task', 20); |
| 42 browserMain.sliceGroup.endSlice(30); | 46 browserMain.sliceGroup.endSlice(30); |
| 43 } | 47 } |
| 44 }); | 48 }); |
| 45 return m; | 49 return m; |
| 46 } | 50 } |
| 47 | 51 |
| 52 Polymer({ |
| 53 is: 'tr-ui-sp-disabled-test-panel', |
| 54 behaviors: [tr.ui.behaviors.SidePanel], |
| 55 supportsModel(m) { |
| 56 return {supported: false}; |
| 57 }, |
| 58 get textLabel() { |
| 59 return 'Disabled'; |
| 60 } |
| 61 }); |
| 62 |
| 63 tr.ui.side_panel.SidePanelRegistry.register(function disabled() { |
| 64 return document.createElement('tr-ui-sp-disabled-test-panel'); |
| 65 }); |
| 66 |
| 67 Polymer({ |
| 68 is: 'tr-ui-sp-enabled-test-panel', |
| 69 behaviors: [tr.ui.behaviors.SidePanel], |
| 70 supportsModel(m) { |
| 71 return {supported: true}; |
| 72 }, |
| 73 get textLabel() { |
| 74 return 'Enabled'; |
| 75 }, |
| 76 }); |
| 77 |
| 78 tr.ui.side_panel.SidePanelRegistry.register(function enabled() { |
| 79 return document.createElement('tr-ui-sp-enabled-test-panel'); |
| 80 }); |
| 81 |
| 48 test('instantiateCollapsed', function() { | 82 test('instantiateCollapsed', function() { |
| 49 const brushingStateController = new FakeBrushingStateController(); | 83 const brushingStateController = new FakeBrushingStateController(); |
| 50 brushingStateController.model = createModel(); | 84 brushingStateController.model = createModel(); |
| 51 | 85 |
| 52 const container = document.createElement('tr-ui-side-panel-container'); | 86 const container = document.createElement('tr-ui-side-panel-container'); |
| 53 container.brushingStateController = brushingStateController; | 87 container.brushingStateController = brushingStateController; |
| 54 this.addHTMLOutput(container); | 88 this.addHTMLOutput(container); |
| 89 |
| 90 // The Enabled tab should appear first in the tab strip even though the |
| 91 // disabled side panel was registered first. |
| 92 // There may be other side panels. |
| 93 const labels = tr.ui.b.findDeepElementsMatching(container, |
| 94 'TAB-STRIP-LABEL').map(e => e.textContent); |
| 95 assert.isBelow(labels.indexOf('Enabled'), labels.indexOf('Disabled')); |
| 55 }); | 96 }); |
| 56 }); | 97 }); |
| 57 </script> | 98 </script> |
| OLD | NEW |