-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
misc: remove residual references to legacy #15292
Merged
Merged
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,16 +30,8 @@ import {fnAny} from '../test-utils.js'; | |
* returns the protocol message argument. | ||
* | ||
* To mock an error response, use `send.mockResponse('Command', () => Promise.reject(error))`. | ||
* | ||
* There are two variants of sendCommand, one that expects a sessionId as the second positional | ||
* argument (legacy Lighthouse `Connection.sendCommand`) and one that does not (Fraggle Rock | ||
* `ProtocolSession.sendCommand`). | ||
* | ||
* @param {{useSessionId: boolean}} [options] | ||
*/ | ||
function createMockSendCommandFn(options) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
const {useSessionId = true} = options || {}; | ||
|
||
function createMockSendCommandFn() { | ||
/** | ||
* Typescript fails to equate template type `C` here with `C` when pushing to this array. | ||
* Instead of sprinkling a couple ts-ignores, make `command` be any, but leave `C` for just | ||
|
@@ -52,18 +44,11 @@ function createMockSendCommandFn(options) { | |
/** | ||
* @template {keyof LH.CrdpCommands} C | ||
* @param {C} command | ||
* @param {string|undefined=} sessionId | ||
* @param {LH.CrdpCommands[C]['paramsType']} args | ||
*/ | ||
async (command, sessionId, ...args) => { | ||
if (!useSessionId) { | ||
// @ts-expect-error - If sessionId isn't used, it *is* args. | ||
args = [sessionId, ...args]; | ||
sessionId = undefined; | ||
} | ||
|
||
async (command, ...args) => { | ||
const indexOfResponse = mockResponses | ||
.findIndex(entry => entry.command === command && entry.sessionId === sessionId); | ||
.findIndex(entry => entry.command === command && entry.sessionId === undefined); | ||
if (indexOfResponse === -1) throw new Error(`${command} unimplemented`); | ||
const {response, delay} = mockResponses[indexOfResponse]; | ||
mockResponses.splice(indexOfResponse, 1); | ||
|
@@ -96,25 +81,20 @@ function createMockSendCommandFn(options) { | |
}, | ||
/** | ||
* @param {keyof LH.CrdpCommands} command | ||
* @param {string=} sessionId | ||
*/ | ||
findInvocation(command, sessionId) { | ||
const expectedArgs = useSessionId ? | ||
[command, sessionId, expect.anything()] : | ||
[command, expect.anything()]; | ||
expect(mockFn).toHaveBeenCalledWith(...expectedArgs); | ||
findInvocation(command) { | ||
expect(mockFn).toHaveBeenCalledWith(command, expect.anything()); | ||
return mockFn.mock.calls.find( | ||
call => call[0] === command && (!useSessionId || call[1] === sessionId) | ||
)[useSessionId ? 2 : 1]; | ||
call => call[0] === command | ||
)[1]; | ||
}, | ||
/** | ||
* @param {keyof LH.CrdpCommands} command | ||
* @param {string=} sessionId | ||
*/ | ||
findAllInvocations(command, sessionId) { | ||
findAllInvocations(command) { | ||
return mockFn.mock.calls.filter( | ||
call => call[0] === command && (!useSessionId || call[1] === sessionId) | ||
).map(invocation => useSessionId ? invocation[2] : invocation[1]); | ||
call => call[0] === command | ||
).map(invocation => invocation[1]); | ||
}, | ||
}); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive-by:
webkitStorageInfo
was removed (no longer just a deprecation) which was causing an extra error to appear inerrors-in-console
. We were not catching this before because we were not asserting a specific length for the number of errors before, but we are in this PR.We had a note to remove when M110 hit stable as well.