diff --git a/lighthouse-core/gather/driver.js b/lighthouse-core/gather/driver.js index bb80ba984dc5..d33e73ec1501 100644 --- a/lighthouse-core/gather/driver.js +++ b/lighthouse-core/gather/driver.js @@ -947,7 +947,7 @@ class Driver { const milestone = (await this.getBrowserVersion()).milestone; if (milestone < 71) { const toplevelIndex = traceCategories.indexOf('disabled-by-default-lighthouse'); - traceCategories.splice(toplevelIndex, 1, 'toplevel'); + traceCategories[toplevelIndex] = 'toplevel'; } const uniqueCategories = Array.from(new Set(traceCategories)); diff --git a/lighthouse-core/test/create-test-trace.js b/lighthouse-core/test/create-test-trace.js index ccc5cd19e9fa..ece800f48cfd 100644 --- a/lighthouse-core/test/create-test-trace.js +++ b/lighthouse-core/test/create-test-trace.js @@ -16,13 +16,13 @@ const frame = '3EFC2700D7BC3F4734CAF2F726EFB78C'; */ function getTopLevelTask({ts, duration}) { return { - name: 'ThreadControllerImpl::RunTask', + name: 'RunTask', ts: ts * 1000, dur: duration * 1000, pid, tid, ph: 'X', - cat: 'toplevel', + cat: 'disabled-by-default-lighthouse', args: { src_file: '../../third_party/blink/renderer/core/fake_runner.cc', src_func: 'FakeRunnerFinished', diff --git a/lighthouse-core/test/gather/driver-test.js b/lighthouse-core/test/gather/driver-test.js index a8af8272f31c..dbbefe448e9d 100644 --- a/lighthouse-core/test/gather/driver-test.js +++ b/lighthouse-core/test/gather/driver-test.js @@ -6,7 +6,7 @@ 'use strict'; let sendCommandParams = []; -let sendCommandMockResponses = {}; +const sendCommandMockResponses = new Map(); const Driver = require('../../gather/driver.js'); const Connection = require('../../gather/connections/connection.js'); @@ -49,16 +49,16 @@ function createActiveWorker(id, url, controlledClients, status = 'activated') { } function createOnceMethodResponse(method, response) { - assert.deepEqual(!!sendCommandMockResponses[method], false, 'stub response already defined'); - sendCommandMockResponses[method] = response; + assert.equal(sendCommandMockResponses.has(method), false, 'stub response already defined'); + sendCommandMockResponses.set(method, response); } connection.sendCommand = function(command, params) { sendCommandParams.push({command, params}); - const mockResponse = sendCommandMockResponses[command]; - if (mockResponse) { - delete sendCommandMockResponses[command]; + if (sendCommandMockResponses.has(command)) { + const mockResponse = sendCommandMockResponses.get(command); + sendCommandMockResponses.delete(command); return Promise.resolve(mockResponse); } @@ -115,7 +115,7 @@ connection.sendCommand = function(command, params) { describe('Browser Driver', () => { beforeEach(() => { sendCommandParams = []; - sendCommandMockResponses = {}; + sendCommandMockResponses.clear(); }); it('returns null when DOM.querySelector finds no node', () => {