Closed Bug 1442243 Opened 6 years ago Closed 6 years ago

Add multi-session support for GeckoSessionTestRule

Categories

(GeckoView :: General, enhancement)

All
Android
enhancement
Not set
normal

Tracking

(firefox60 fixed)

RESOLVED FIXED
mozilla60
Tracking Status
firefox60 --- fixed

People

(Reporter: jchen, Assigned: jchen)

References

Details

Attachments

(7 files)

Add support for using multiple sessions within a test.
Comment on attachment 8955151 [details]
Bug 1442243 - 1. Add GeckoSessionTestRule.env;

https://reviewboard.mozilla.org/r/224314/#review231680

::: mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java:334
(Diff revision 1)
> +
> +    public class Environment {
> +        /* package */ Environment() {
> +        }
> +
> +        private String getEnvVar(final String name) {

Might be worth caching the key/value pairs in a Bundle for faster lookup later.

::: mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java:359
(Diff revision 1)
> +            return mSession.getSettings().getBoolean(
> +                    GeckoSessionSettings.USE_MULTIPROCESS);
> +        }
> +
> +        public boolean isDebugging() {
> +            return Debug.isDebuggerConnected();

Wow, this is really helpful!
Attachment #8955151 - Flags: review?(snorp) → review+
Comment on attachment 8955153 [details]
Bug 1442243 - 3. Add ClosedSessionAtStart test annotation;

https://reviewboard.mozilla.org/r/224318/#review231682
Attachment #8955153 - Flags: review?(snorp) → review+
Comment on attachment 8955154 [details]
Bug 1442243 - 4. Add calls for creating sessions;

https://reviewboard.mozilla.org/r/224320/#review231684

::: mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java:698
(Diff revision 1)
> +        if (!e10s) {
> +            return;
> +        }
>  
> -        if (settings.getBoolean(GeckoSessionSettings.USE_MULTIPROCESS)) {
> -            // Under e10s, we receive an initial about:blank load; don't expose that to the test.
> +        // Under e10s, we receive an initial about:blank load; don't expose that to the test.

This is a giant PITA. We really need to solve the root problem rather than work around it everywhere, but that can happen later.
Attachment #8955154 - Flags: review?(snorp) → review+
Comment on attachment 8955155 [details]
Bug 1442243 - 5. Add session-specific versions of test rule calls;

https://reviewboard.mozilla.org/r/224322/#review231686

::: mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java:868
(Diff revision 1)
>              }
>          }
>      }
>  
>      /**
>       * Wait until a page load has finished. The session must have started a page load since

Update docs here to indicat that it will wait on all sessions

::: mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/rule/GeckoSessionTestRule.java:886
(Diff revision 1)
> +    public void waitForPageStop(final GeckoSession session) {
> +        waitForPageStops(session, /* count */ 1);
>      }
>  
>      /**
>       * Wait until a page load has finished. The session must have started a page load since

Same here
Attachment #8955155 - Flags: review?(snorp) → review+
Comment on attachment 8955157 [details]
Bug 1442243 - 7. Add tests for new session-specific calls/extensions;

https://reviewboard.mozilla.org/r/224326/#review231690
Attachment #8955157 - Flags: review?(snorp) → review+
Comment on attachment 8955152 [details]
Bug 1442243 - 2. Allow Callbacks interfaces for waitUntilCalled(Class<?>);

https://reviewboard.mozilla.org/r/224316/#review231802
Attachment #8955152 - Flags: review+
Pushed by nchen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/72cd096b3ced
1. Add GeckoSessionTestRule.env; r=snorp
https://hg.mozilla.org/integration/autoland/rev/c271ebbb2461
2. Allow Callbacks interfaces for waitUntilCalled(Class<?>); r=jchen
https://hg.mozilla.org/integration/autoland/rev/c7d9be0e00a6
3. Add ClosedSessionAtStart test annotation; r=snorp
https://hg.mozilla.org/integration/autoland/rev/2205567d8b91
4. Add calls for creating sessions; r=snorp
https://hg.mozilla.org/integration/autoland/rev/396f4ce2ae48
5. Add session-specific versions of test rule calls; r=snorp
https://hg.mozilla.org/integration/autoland/rev/775219a5e8ca
6. Add BaseSessionTest; r=snorp
https://hg.mozilla.org/integration/autoland/rev/9703d2406c22
7. Add tests for new session-specific calls/extensions; r=snorp
Product: Firefox for Android → GeckoView
Target Milestone: Firefox 60 → mozilla60
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: