Closed Bug 1497917 Opened Last year Closed 11 months ago

Add tests for USB runtime components

Categories

(DevTools :: about:debugging, enhancement, P1)

enhancement

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: ladybenko, Assigned: jdescottes)

References

(Blocks 1 open bug)

Details

Attachments

(6 files, 2 obsolete files)

We have to add mochitests for USB runtimes.

We would need some solution to provide fake USB runtimes (mocks / fake adb server https://searchfox.org/mozilla-central/source/devtools/shared/adb/test/adb.py / other).
Priority: -- → P2
As discussed on slack, this bug will be about selecting the technical solution for USB runtimes tests as well as adding at least one test as a proof of concept.
Assignee: nobody → jdescottes
Status: NEW → ASSIGNED
Priority: P2 → P1
Attachment #9020043 - Attachment is obsolete: true
Attachment #9019825 - Attachment is obsolete: true
I want to go through a first round of review before moving forward. If we agree
on the basic approach in this patch two things:
- I want to complexify things by adding a test that connects to a runtime and shows
  the runtime page (to exercise more than this very simple use case)
- I will probably separate the loader modification in a separate bug, will open a RFC to
  discuss it and will use a workaround for now in our code so that we are not blocked

Overall I don't want to start adding too many features to this mocking solution, I would 
rather wait until the tests help us understand what fits best our needs.
Depends on D9801

This a preparatory work that ensures that all the calls to DevTools client are made 
through a wrapper called ClientWrapper. I initially tried having a static "client" helper
but the test code was really hard to follow. Keeping a "client-like" object makes this
easier.
Depends on D10095

The initial intent was to extract the logic to create the USB clients
so that it could be mocked in our tests. However since USB clients
share most of their logic with network clients, it did not make sense
to extract USB without network. And once you have USB and network, there
is no good reason to keep local client out.

I don't think "runtime-helper.js" is a good module name here. The role
of this module is to build clients for runtimes, but at the same time
it is just a static helper. Could not find a good name, and we already
have inconsistent module names in our modules/ folder so I did not want
to introduce something like RuntimeClientBuilder of RuntimeClientProvider
etc...

One of the consequences is that once we start mocking this helper (in the
next patch) we will also have to mock the this-firefox runtime. It has 
advantages and disadvantages but I think we can live with this for now.
Depends on D10096

Adds a first test that simply connects to a USB runtime (but also has to
mock this-firefox runtime).
Blocks: 1503908
Blocks: 1503911
Blocks: 1503913
Blocks: 1503914
Attachment #9021857 - Attachment description: Bug 1497917 - Wait for stores to settle instead of assuming they will have > 0 items;r=daisuke → Bug 1497917 - Wait until REQUEST_*_SUCCESS to be dispatched in about:debugging tests;r=daisuke
Keywords: leave-open
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/989163347094
Wait until REQUEST_*_SUCCESS to be dispatched in about:debugging tests;r=daisuke
Blocks: 1506054
Blocks: 1506056
Pushed by jdescottes@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/d67038338e2f
Add test helper to new aboutdebugging to mock require calls;r=ladybenko,daisuke
https://hg.mozilla.org/integration/autoland/rev/88ef91cd3bd6
Add USB runtime mock and sidebar test for USB runtimes;r=ladybenko,daisuke
https://hg.mozilla.org/integration/autoland/rev/0620a6320abf
Add ClientWrapper to interact with DevTools client in aboutdebugging;r=ladybenko,daisuke
https://hg.mozilla.org/integration/autoland/rev/dfd527956c4b
Extract client creation to RuntimeHelper module;r=ladybenko,daisuke
https://hg.mozilla.org/integration/autoland/rev/1543fc07760a
Mock runtimes and client for USB tests;r=ladybenko,daisuke
Keywords: leave-open
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.