GeckoView junit tests pass when a delegateUntilTestEnd callback is called fewer times than its @AssertCalled count
Categories
(GeckoView :: General, defect)
Tracking
(firefox160 fixed)
| Tracking | Status | |
|---|---|---|
| firefox160 | --- | fixed |
People
(Reporter: RyanVM, Assigned: RyanVM)
Details
Attachments
(5 external files)
In GeckoView junit tests that extend BaseSessionTest, the end-of-test @AssertCalled count check on delegates registered with delegateUntilTestEnd never fails. A test that expects count = 1 passes when the callback is never called. For example, HistoryDelegateTest#flushSessionStateTriggersHistoryChange passed while onHistoryStateChange was not called before the test ended.
BaseSessionTest registers an ErrorCollector and hands it to GeckoSessionTestRule with setErrorCollector. The collector is a Verifier that runs inside the session rule's statement, so it checks its errors when the test method returns. GeckoSessionTestRule calls performTestEndCheck() after base.evaluate() returns, and assertMatchesCount records its mismatches through checkThat into the collector, which has already been verified. These failures are never reported. Checks that run while the test body is still executing, such as the "call count should be within limit" check and the counts checked by waitUntilCalled, still fail as expected.
| Assignee | ||
Comment 1•1 month ago
|
||
testExtensionProcessCrash never gets the onDisabledProcessSpawning call it counts in the junit runtime, so it
is disabled until bug 2080467.
A waitUntilCalled given a delegate interface and method names now treats a call to any overload as satisfying
its name, instead of waiting for every overload, so adding an overload to a delegate no longer makes those
waits time out.
| Assignee | ||
Comment 2•1 month ago
|
||
These tests passed only because the end-of-test counts were never checked. Several ended before the callback
could be delivered, and enableDisable and translateTest declared counts their flows do not produce in
automation.
| Assignee | ||
Comment 3•1 month ago
|
||
The rule already records every proxied delegate call, so waitUntilCalled on the registered interface replaces
a GeckoResult that only signalled the call, and the registration's @AssertCalled count still checks it. Action
delegates that were set directly on the extension or session are registered through
addExternalDelegateDuringNextWait so their calls are recorded. Flags completed from a Handler after a fixed
delay are replaced the same way. In the fetch tests that delay only kept the count = 1 scope open to catch a
second fetch, so their delegates are now registered until test end instead.
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
| Assignee | ||
Comment 4•1 month ago
|
||
The action delegates were set directly on the extension or session, so the rule never recorded their calls and
the tests completed a GeckoResult instead. Registering them through addExternalDelegateDuringNextWait records
the calls, so the tests wait with waitUntilCalled. A wait on several method names waits for every one of them,
so the tests that handle either action wait only on the one their id selects.
| Assignee | ||
Comment 5•1 month ago
|
||
In the fetch tests the delay kept the count = 1 scope open after the fetch, the only way they could see a
second one. Nothing marks the end of Gecko's fetching, so they now check that the fetch happened, with the
delegate registered until test end so an extra fetch recorded before then still fails the count.
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Updated•1 month ago
|
Comment 7•1 month ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/9a8349aafa35
https://hg.mozilla.org/mozilla-central/rev/95bc0cee2a60
https://hg.mozilla.org/mozilla-central/rev/fc1572b1f68a
https://hg.mozilla.org/mozilla-central/rev/147705b0d242
https://hg.mozilla.org/mozilla-central/rev/ab6f5126163e
Description
•