| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview Helper functions for use in tracing tests. | 6 * @fileoverview Helper functions for use in tracing tests. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 | 9 |
| 10 /** | 10 /** |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 if (req.status == 200) { | 31 if (req.status == 200) { |
| 32 cb(req.responseText); | 32 cb(req.responseText); |
| 33 } else { | 33 } else { |
| 34 console.log('Failed to load ' + url); | 34 console.log('Failed to load ' + url); |
| 35 } | 35 } |
| 36 }, 0); | 36 }, 0); |
| 37 } | 37 } |
| 38 }; | 38 }; |
| 39 req.send(null); | 39 req.send(null); |
| 40 } | 40 } |
| 41 |
| 42 function newAsyncSlice(start, duration, startThread, endThread) { |
| 43 return newAsyncSliceNamed('a', start, duration, startThread, endThread); |
| 44 } |
| 45 |
| 46 function newAsyncSliceNamed(name, start, duration, startThread, endThread) { |
| 47 var s = new tracing.TimelineAsyncSlice(name, 0, start); |
| 48 s.duration = duration; |
| 49 s.startThread = startThread; |
| 50 s.endThread = endThread; |
| 51 var subSlice = new tracing.TimelineAsyncSlice(name, 0, start); |
| 52 subSlice.duration = duration; |
| 53 subSlice.startThread = startThread; |
| 54 subSlice.endThread = endThread; |
| 55 s.subSlices = [subSlice]; |
| 56 return s; |
| 57 } |
| 58 |
| 41 return { | 59 return { |
| 42 getAsync: getAsync | 60 getAsync: getAsync, |
| 61 newAsyncSlice: newAsyncSlice, |
| 62 newAsyncSliceNamed: newAsyncSliceNamed |
| 43 }; | 63 }; |
| 44 }); | 64 }); |
| OLD | NEW |