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/math/range.html"> | 8 <link rel="import" href="/tracing/base/math/range.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/model.html"> | 10 <link rel="import" href="/tracing/model/model.html"> |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 ]; | 173 ]; |
174 var range = tr.b.math.Range.fromExplicitRange(1, 26); | 174 var range = tr.b.math.Range.fromExplicitRange(1, 26); |
175 var stats = thread.getCpuStatsForRange(range); | 175 var stats = thread.getCpuStatsForRange(range); |
176 assert.deepEqual(stats, { | 176 assert.deepEqual(stats, { |
177 0: 7, | 177 0: 7, |
178 1: 5, | 178 1: 5, |
179 total: 12 | 179 total: 12 |
180 }); | 180 }); |
181 }); | 181 }); |
182 }); | 182 }); |
| 183 |
| 184 test('typeGetterReturnsCorrectType', function() { |
| 185 const model = tr.c.TestUtils.newModel(function(model) { |
| 186 const process = model.getOrCreateProcess(1); |
| 187 const thread1 = process.getOrCreateThread(1); |
| 188 const thread2 = process.getOrCreateThread(2); |
| 189 const thread3 = process.getOrCreateThread(3); |
| 190 const thread4 = process.getOrCreateThread(4); |
| 191 |
| 192 thread1.name = 'ThreadName12'; |
| 193 thread2.name = 'ThreadName/34123'; |
| 194 thread3.name = 'ThreadName1/34123'; |
| 195 thread4.name = 'ThreadName'; |
| 196 |
| 197 assert.strictEqual(thread1.type, 'ThreadName'); |
| 198 assert.strictEqual(thread2.type, 'ThreadName'); |
| 199 assert.strictEqual(thread3.type, 'ThreadName'); |
| 200 assert.strictEqual(thread4.type, 'ThreadName'); |
| 201 }); |
| 202 }); |
| 203 |
| 204 test('typeGetterThrowsIfThreadNameStartsWithNumberOrSlash', function() { |
| 205 const model = tr.c.TestUtils.newModel(function(model) { |
| 206 const process = model.getOrCreateProcess(1); |
| 207 const thread1 = process.getOrCreateThread(1); |
| 208 const thread2 = process.getOrCreateThread(2); |
| 209 const thread3 = process.getOrCreateThread(3); |
| 210 |
| 211 thread1.name = '123'; |
| 212 thread2.name = '42GPU'; |
| 213 thread3.name = '/123'; |
| 214 |
| 215 assert.throws(() => thread1.type); |
| 216 assert.throws(() => thread2.type); |
| 217 assert.throws(() => thread3.type); |
| 218 }); |
| 219 }); |
183 }); | 220 }); |
184 </script> | 221 </script> |
185 | 222 |
OLD | NEW |