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
This commit is contained in:
Makoto Kato 2023-03-02 04:22:56 +00:00
Родитель 8f4015c3ee
Коммит 8eaf133428
1 изменённых файлов: 20 добавлений и 0 удалений

Просмотреть файл

@ -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)
)
}
}