var newAsyncSlice = tracing.test_utils.newAsyncSlice;
test('asyncSliceGroupBounds_Empty', function() {
- var g = new AsyncSliceGroup();
+ var thread = {};
+ var g = new AsyncSliceGroup(thread);
g.updateBounds();
assertTrue(g.bounds.isEmpty);
});
var model = new tracing.TraceModel();
var p1 = new Process(model, 1);
var t1 = new Thread(p1, 1);
- var g = new AsyncSliceGroup();
+ var g = new AsyncSliceGroup(t1);
g.push(newAsyncSlice(0, 1, t1, t1));
g.push(newAsyncSlice(1, 1.5, t1, t1));
assertEquals(2, g.length);
assertEquals(0, g.bounds.min);
assertEquals(2.5, g.bounds.max);
});
-
- test('asyncSlice_toJSON', function() {
- var js = [
- '{',
- ' "guid_" : __S_GUID__,',
- ' "selectionState": 0,',
- ' "start" : 0,',
- ' "duration" : 1,',
- ' "category" : "",',
- ' "title" : "a",',
- ' "colorId" : 0,',
- ' "didNotFinish" : false,',
- ' "startThread" : __T1_GUID__,',
- ' "endThread" : __T1_GUID__,',
- ' "subSlices" : [ {',
- ' "guid_" : __SUB_S_GUID__,',
- ' "selectionState": 0,',
- ' "start" : 0,',
- ' "duration" : 1,',
- ' "category" : "",',
- ' "title" : "a",',
- ' "colorId" : 0,',
- ' "didNotFinish" : false,',
- ' "startThread" : __T1_GUID__,',
- ' "endThread" : __T1_GUID__',
- ' } ]',
- '}'].join('\n');
-
- var model = new tracing.TraceModel();
- var p1 = new Process(model, 1);
- var t1 = new Thread(p1, 1);
- var s = newAsyncSlice(0, 1, t1, t1);
-
- // Replace placeholders with GUIDs
- js = js.replace(/__T1_GUID__/g, t1.guid)
- .replace(/__S_GUID__/g, s.guid)
- .replace(/__SUB_S_GUID__/g, s.subSlices[0].guid);
-
- // Modify whitespace of "js" so that string compare with another
- // JSON.stringified version can succeed.
- js = JSON.stringify(JSON.parse(js));
-
- assertEquals(js, JSON.stringify(s));
- });
});
</script>