Closed Bug 1797785 Opened 3 years ago Closed 3 years ago

Add test for NetworkObserver

Categories

(DevTools :: General, task, P1)

task
Points:
1

Tracking

(firefox109 fixed)

RESOLVED FIXED
109 Branch
Tracking Status
firefox109 --- fixed

People

(Reporter: jdescottes, Assigned: jdescottes)

References

(Blocks 2 open bugs)

Details

(Whiteboard: [webdriver:m5])

Attachments

(2 files)

We are moving the network observer to a dedicated folder in Bug 1788777, let's write a test for it to help with upcoming refactors.

Component: WebDriver BiDi → General
Product: Remote Protocol → DevTools
Points: --- → 1
Priority: P3 → P1
Whiteboard: [webdriver:m5]
See Also: → 1800705
Blocks: 1800858

While writing a test, I forgot that the filter function was an "ignore" function. Using named arguments should avoid this. Maybe we should
consider using a regular filter approach (ie return true if we want to keep the request)?

Depends on D162193

This adds only very basic tests for the observer, but I would like to discuss about switching the API to a fully event-based solution.
I initially decided against it because I didn't want to create unnecessary changes for DevTools, but in the end, the owner pattern is quite verbose if
we want to use it for testing. Having events instead would make it more flexible, we could test only what we are interested in, with minimal overhead.

If we agree on this, we can land those very simple tests and I can move on to change the API to use events and update the tests, before we add more
tests.

Blocks: 1800831
Pushed by jdescottes@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/6fe1a36f4c06 [devtools] Switch NetworkObserver constructor to named arguments r=bomsy https://hg.mozilla.org/integration/autoland/rev/a7400b45e2e4 [devtools] Add tests for Network Observer r=bomsy
Status: ASSIGNED → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → 109 Branch
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: