Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core(driver): address bckenny feedback on #6117 #6285

Merged
merged 2 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lighthouse-core/gather/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
4 changes: 2 additions & 2 deletions lighthouse-core/test/create-test-trace.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
14 changes: 7 additions & 7 deletions lighthouse-core/test/gather/driver-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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', () => {
Expand Down