OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <!-- | 2 <!-- |
3 Copyright (c) 2013 The Chromium Authors. All rights reserved. | 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 | 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/base/task.html"> | 8 <link rel="import" href="/tracing/base/task.html"> |
9 <link rel="import" href="/tracing/core/test_utils.html"> | 9 <link rel="import" href="/tracing/core/test_utils.html"> |
10 <link rel="import" href="/tracing/model/event_set.html"> | 10 <link rel="import" href="/tracing/model/event_set.html"> |
11 <link rel="import" href="/tracing/model/model.html"> | 11 <link rel="import" href="/tracing/model/model.html"> |
12 <link rel="import" href="/tracing/ui/timeline_view.html"> | 12 <link rel="import" href="/tracing/ui/timeline_view.html"> |
13 | 13 |
14 <script> | 14 <script> |
15 'use strict'; | 15 'use strict'; |
16 | 16 |
17 tr.b.unittest.testSuite(function() { | 17 tr.b.unittest.testSuite(function() { |
18 var Task = tr.b.Task; | 18 var Task = tr.b.Task; |
19 | 19 |
20 function setupTimeline() { | 20 function setupTimeline() { |
21 var container = document.createElement('track-view-container'); | 21 var container = document.createElement('track-view-container'); |
22 container.id = 'track_view_container'; | 22 container.id = 'track_view_container'; |
23 | 23 |
24 var view = document.createElement('tr-ui-timeline-view'); | 24 var view = document.createElement('tr-ui-timeline-view'); |
25 view.appendChild(container); | 25 Polymer.dom(view).appendChild(container); |
26 view.trackViewContainer_ = container; | 26 view.trackViewContainer_ = container; |
27 return view; | 27 return view; |
28 } | 28 } |
29 | 29 |
30 var createFullyPopulatedModel = function(opt_withError, opt_withMetadata) { | 30 var createFullyPopulatedModel = function(opt_withError, opt_withMetadata) { |
31 var withError = opt_withError !== undefined ? opt_withError : true; | 31 var withError = opt_withError !== undefined ? opt_withError : true; |
32 var withMetadata = opt_withMetadata !== undefined ? | 32 var withMetadata = opt_withMetadata !== undefined ? |
33 opt_withMetadata : true; | 33 opt_withMetadata : true; |
34 | 34 |
35 var num_tests = 50; | 35 var num_tests = 50; |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 test('instantiate', function() { | 105 test('instantiate', function() { |
106 var model11 = createFullyPopulatedModel(true, true); | 106 var model11 = createFullyPopulatedModel(true, true); |
107 | 107 |
108 var view = setupTimeline(); | 108 var view = setupTimeline(); |
109 view.style.height = '400px'; | 109 view.style.height = '400px'; |
110 view.style.border = '1px solid black'; | 110 view.style.border = '1px solid black'; |
111 view.model = model11; | 111 view.model = model11; |
112 | 112 |
113 var simpleButton1 = document.createElement('tr-ui-b-toolbar-button'); | 113 var simpleButton1 = document.createElement('tr-ui-b-toolbar-button'); |
114 simpleButton1.textContent = 'M'; | 114 simpleButton1.textContent = 'M'; |
115 view.leftControls.appendChild(simpleButton1); | 115 Polymer.dom(view.leftControls).appendChild(simpleButton1); |
116 | 116 |
117 var simpleButton2 = document.createElement('tr-ui-b-toolbar-button'); | 117 var simpleButton2 = document.createElement('tr-ui-b-toolbar-button'); |
118 simpleButton2.textContent = 'am button'; | 118 simpleButton2.textContent = 'am button'; |
119 view.leftControls.appendChild(simpleButton2); | 119 Polymer.dom(view.leftControls).appendChild(simpleButton2); |
120 | 120 |
121 this.addHTMLOutput(view); | 121 this.addHTMLOutput(view); |
122 }); | 122 }); |
123 | 123 |
124 test('changeModelToSomethingDifferent', function() { | 124 test('changeModelToSomethingDifferent', function() { |
125 var model00 = createFullyPopulatedModel(false, false); | 125 var model00 = createFullyPopulatedModel(false, false); |
126 var model11 = createFullyPopulatedModel(true, true); | 126 var model11 = createFullyPopulatedModel(true, true); |
127 | 127 |
128 var view = setupTimeline(); | 128 var view = setupTimeline(); |
129 view.style.height = '400px'; | 129 view.style.height = '400px'; |
(...skipping 22 matching lines...) Expand all Loading... |
152 var selection = new tr.model.EventSet(); | 152 var selection = new tr.model.EventSet(); |
153 var filter = new tr.c.TitleOrCategoryFilter('somethingUnusual'); | 153 var filter = new tr.c.TitleOrCategoryFilter('somethingUnusual'); |
154 var filterTask = sc.addAllEventsMatchingFilterToSelectionAsTask( | 154 var filterTask = sc.addAllEventsMatchingFilterToSelectionAsTask( |
155 filter, selection); | 155 filter, selection); |
156 Task.RunSynchronously(filterTask); | 156 Task.RunSynchronously(filterTask); |
157 assert.equal(selection.length, 1); | 157 assert.equal(selection.length, 1); |
158 }); | 158 }); |
159 }); | 159 }); |
160 </script> | 160 </script> |
161 | 161 |
OLD | NEW |