Commit 8eaf1334 authored by Makoto Kato's avatar Makoto Kato
Browse files

Bug 1819494 - Add functional test for GeckoSessionSettings.setDisplayMode....

Bug 1819494 - Add functional test for GeckoSessionSettings.setDisplayMode. r=geckoview-reviewers,owlish

There is no tests for display mode with web content. So we should add
it.

Differential Revision: https://phabricator.services.mozilla.com/D171298
parent 8f4015c3
Loading
Loading
Loading
Loading
+20 −0
Original line number Diff line number Diff line
@@ -555,4 +555,24 @@ class ContentDelegateTest : BaseSessionTest() {
        mainSession.loadTestPath(HUNG_SCRIPT)
        sessionRule.waitForPageStop(mainSession)
    }

    /**
     * Test that the display mode is applied to CSS media query
     */
    @Test fun displayMode() {
        val pwaSession = sessionRule.createOpenSession(
            GeckoSessionSettings.Builder(mainSession.settings)
                .displayMode(GeckoSessionSettings.DISPLAY_MODE_FULLSCREEN)
                .build()
        )
        pwaSession.loadTestPath(HELLO_HTML_PATH)
        pwaSession.waitForPageStop()

        val matches = pwaSession.evaluateJS("window.matchMedia('(display-mode: fullscreen)').matches") as Boolean
        assertThat(
            "display-mode should be fullscreen",
            matches,
            equalTo(true)
        )
    }
}