fix(benchpress): chrome - prevent trace buffer overflow

This commit is contained in:
Tobias Bosch
2017-04-17 09:18:35 -07:00
committed by Miško Hevery
parent 11e6f45387
commit 20ffb4196d
2 changed files with 26 additions and 4 deletions

View File

@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/
import {AsyncTestCompleter, describe, expect, inject, it} from '@angular/core/testing/src/testing_internal';
import {AsyncTestCompleter, describe, expect, iit, inject, it} from '@angular/core/testing/src/testing_internal';
import {ChromeDriverExtension, Options, ReflectiveInjector, WebDriverAdapter, WebDriverExtension} from '../../index';
import {TraceEventFactory} from '../trace_event_factory';
@ -61,14 +61,29 @@ export function main() {
});
}));
it('should mark the timeline via console.time()',
it('should clear the perf logs and mark the timeline via console.time() on the first call',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
createExtension().timeBegin('someName').then((_) => {
expect(log).toEqual([['executeScript', `console.time('someName');`]]);
createExtension().timeBegin('someName').then(() => {
expect(log).toEqual(
[['logs', 'performance'], ['executeScript', `console.time('someName');`]]);
async.done();
});
}));
it('should mark the timeline via console.time() on the second call',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
const ext = createExtension();
ext.timeBegin('someName')
.then((_) => {
log.splice(0, log.length);
ext.timeBegin('someName');
})
.then(() => {
expect(log).toEqual([['executeScript', `console.time('someName');`]]);
async.done();
});
}));
it('should mark the timeline via console.timeEnd()',
inject([AsyncTestCompleter], (async: AsyncTestCompleter) => {
createExtension().timeEnd('someName', null).then((_) => {