fix(benchpress): support measuring scriptTime and other metrics of page reload.

E.g. for benchmarks that measure page start time
This commit is contained in:
Tobias Bosch
2016-09-15 08:51:55 -07:00
committed by Alex Eagle
parent c4114c2f66
commit 838d4bbf6c
6 changed files with 124 additions and 87 deletions

View File

@ -171,6 +171,22 @@ export function main() {
});
}));
it('should mark and aggregate events since navigationStart',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var events = [[
eventFactory.markStart('benchpress0', 0), eventFactory.start('script', 4),
eventFactory.end('script', 6), eventFactory.instant('navigationStart', 7),
eventFactory.start('script', 8), eventFactory.end('script', 9),
eventFactory.markEnd('benchpress0', 10)
]];
var metric = createMetric(events, null);
metric.beginMeasure().then((_) => metric.endMeasure(false)).then((data) => {
expect(data['scriptTime']).toBe(1);
async.done();
});
}));
it('should restart timing', inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
var events = [
[