mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 16:22:00 +00:00
Bug 1647797 - Add geckoview-junit tests for onPaintStatusReset. r=agi,geckoview-reviewers
Add test paintStatusReset() to ContentDelegateTest, which asserts that onPaintStatusReset() is called after GeckoSession.setActive(false). Add test capturePixelsSessionDeactivatedActivated() to ScreenshotTest, which asserts that capturePixels() is successful if called when the session is deactivated then reactivated, after waiting for the onPaintStatusReset() and onFirstContentfulPaint() callbacks. Differential Revision: https://phabricator.services.mozilla.com/D87463
This commit is contained in:
parent
e3b924526e
commit
456abf2772
@ -229,6 +229,22 @@ class ContentDelegateTest : BaseSessionTest() {
|
||||
})
|
||||
}
|
||||
|
||||
@WithDisplay(width = 10, height = 10)
|
||||
@Test fun paintStatusReset() {
|
||||
mainSession.loadTestPath(HELLO_HTML_PATH)
|
||||
sessionRule.waitUntilCalled(object : Callbacks.ContentDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onFirstContentfulPaint(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
mainSession.setActive(false)
|
||||
sessionRule.waitUntilCalled(object : Callbacks.ContentDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onPaintStatusReset(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Test fun webAppManifestPref() {
|
||||
val initialState = sessionRule.runtime.settings.getWebManifestEnabled()
|
||||
val jsToRun = "document.querySelector('link[rel=manifest]').relList.supports('manifest');"
|
||||
|
@ -154,6 +154,37 @@ class ScreenshotTest : BaseSessionTest() {
|
||||
}
|
||||
}
|
||||
|
||||
@WithDisplay(height = SCREEN_HEIGHT, width = SCREEN_WIDTH)
|
||||
@Test
|
||||
fun capturePixelsSessionDeactivatedActivated() {
|
||||
val screenshotFile = getComparisonScreenshot(SCREEN_WIDTH, SCREEN_HEIGHT)
|
||||
|
||||
sessionRule.session.loadTestPath(COLORS_HTML_PATH)
|
||||
sessionRule.waitUntilCalled(object : Callbacks.ContentDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onFirstContentfulPaint(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
|
||||
sessionRule.session.setActive(false)
|
||||
sessionRule.waitUntilCalled(object : Callbacks.ContentDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onPaintStatusReset(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
|
||||
sessionRule.session.setActive(true)
|
||||
sessionRule.waitUntilCalled(object : Callbacks.ContentDelegate {
|
||||
@AssertCalled(count = 1)
|
||||
override fun onFirstContentfulPaint(session: GeckoSession) {
|
||||
}
|
||||
})
|
||||
|
||||
sessionRule.display?.let {
|
||||
assertScreenshotResult(it.capturePixels(), screenshotFile)
|
||||
}
|
||||
}
|
||||
|
||||
@WithDisplay(height = SCREEN_HEIGHT, width = SCREEN_WIDTH)
|
||||
@Test
|
||||
fun screenshotToBitmap() {
|
||||
|
Loading…
Reference in New Issue
Block a user