Closed Bug 1671578 Opened 1 month ago Closed 1 month ago

Implement GeckoSession.Loader.equals()

Categories

(GeckoView :: General, enhancement)

All
Android
enhancement

Tracking

(firefox84 fixed)

RESOLVED FIXED
84 Branch
Tracking Status
firefox84 --- fixed

People

(Reporter: sebastian, Assigned: agi)

References

Details

Attachments

(1 file)

In AC we have a bunch of tests that verify that we forward the correct data to GeckoView.

A simplified example is:

engineSession.loadUrl("http://mozilla.org")

verify(geckoSession).loadUri(
    "http://mozilla.org",
    null as GeckoSession?,
    GeckoSession.LOAD_FLAGS_NONE,
    null as Map<String, String>?
)

If I translate this to using GeckoSession.Loader:

 verify(geckoSession).load(
    GeckoSession.Loader()
        .uri("https://www.mozilla.org")
)

... then this fails because since GeckoSession.Loader doesn't implement equals it falls back to comparing references. Implementing equals() (and then probably also hashCode()) would help us write test and would make GeckoSession.Loader more like a data class in Kotlin or a Record in Java 14+.

Since all fields are private I also can't work around this by capturing the arguments and comparing myself.

Assignee: nobody → agi
Pushed by csabou@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/59fd9fd259e0
Backed out changeset 55a5da81f312 for linting opt failures.
https://hg.mozilla.org/integration/autoland/rev/f20537ff856c
Overload Loader.equals.
Status: NEW → RESOLVED
Closed: 1 month ago
Resolution: --- → FIXED
Target Milestone: --- → 84 Branch
You need to log in before you can comment on or make changes to this bug.