Bug 1876740 - Update spotless/ktlin to 6.25.0/0.49.1. r=geckoview-reviewers,calu

ktlint version is matched with Fenix.

Differential Revision: https://phabricator.services.mozilla.com/D203247
This commit is contained in:
Makoto Kato 2024-03-04 01:45:22 +00:00
parent de714a36bc
commit 5cc73043ee
10 changed files with 79 additions and 103 deletions

View file

@ -20,7 +20,7 @@ buildscript {
classpath 'org.mozilla.apilint:apilint:0.5.2' classpath 'org.mozilla.apilint:apilint:0.5.2'
classpath 'com.android.tools.build:gradle:8.0.2' classpath 'com.android.tools.build:gradle:8.0.2'
classpath 'org.apache.commons:commons-exec:1.3' classpath 'org.apache.commons:commons-exec:1.3'
classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.18.0' classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.25.0'
classpath 'org.tomlj:tomlj:1.1.0' classpath 'org.tomlj:tomlj:1.1.0'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
} }
@ -401,7 +401,7 @@ subprojects {
include '**/*.kt' include '**/*.kt'
exclude '**/thirdparty/**' exclude '**/thirdparty/**'
} }
ktlint('0.48.2') ktlint('0.49.1')
} }
} }
} }

View file

@ -2407,7 +2407,7 @@ class AutocompleteTest : BaseSessionTest() {
"Hint should match", "Hint should match",
option.hint, option.hint,
equalTo(LoginSaveOption.Hint.GENERATED)) equalTo(LoginSaveOption.Hint.GENERATED))
*/ */
assertThat( assertThat(
"Password should not be empty", "Password should not be empty",

View file

@ -72,8 +72,7 @@ class GeolocationTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: GeckoSession.PermissionDelegate.ContentPermission, perm: GeckoSession.PermissionDelegate.ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
return GeckoResult.fromValue(GeckoSession.PermissionDelegate.ContentPermission.VALUE_ALLOW) return GeckoResult.fromValue(GeckoSession.PermissionDelegate.ContentPermission.VALUE_ALLOW)
} }
override fun onAndroidPermissionsRequest( override fun onAndroidPermissionsRequest(

View file

@ -67,8 +67,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"URI should be " + testLoader.getUri(), "URI should be " + testLoader.getUri(),
request.uri, request.uri,
@ -493,8 +492,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("The URLs must match", request.uri, equalTo(forEachCall(uri, httpsUri))) assertThat("The URLs must match", request.uri, equalTo(forEachCall(uri, httpsUri)))
return null return null
} }
@ -553,8 +551,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("The URLs must match", request.uri, equalTo(forEachCall(uri, httpsUri))) assertThat("The URLs must match", request.uri, equalTo(forEachCall(uri, httpsUri)))
return null return null
} }
@ -613,8 +610,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("The URLs must match", request.uri, equalTo(forEachCall(uri, httpsUri))) assertThat("The URLs must match", request.uri, equalTo(forEachCall(uri, httpsUri)))
return null return null
} }
@ -668,8 +664,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
// We set http scheme only in case it's not iFrame // We set http scheme only in case it's not iFrame
assertThat("The URLs must match", request.uri, equalTo(uri)) assertThat("The URLs must match", request.uri, equalTo(uri))
return null return null
@ -720,8 +715,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"URI should be HTTP then redirected to HTTPS", "URI should be HTTP then redirected to HTTPS",
request.uri, request.uri,
@ -777,8 +771,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onSubframeLoadRequest( override fun onSubframeLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("URI should not be null", request.uri, notNullValue()) assertThat("URI should not be null", request.uri, notNullValue())
assertThat("URI should match", request.uri, endsWith(iframeUri)) assertThat("URI should match", request.uri, endsWith(iframeUri))
return null return null
@ -865,8 +858,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("Session should not be null", session, notNullValue()) assertThat("Session should not be null", session, notNullValue())
assertThat("URI should not be null", request.uri, notNullValue()) assertThat("URI should not be null", request.uri, notNullValue())
assertThat( assertThat(
@ -916,8 +908,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("Session should not be null", session, notNullValue()) assertThat("Session should not be null", session, notNullValue())
assertThat("App requested this load", request.isDirectNavigation, equalTo(true)) assertThat("App requested this load", request.isDirectNavigation, equalTo(true))
assertThat("URI should not be null", request.uri, notNullValue()) assertThat("URI should not be null", request.uri, notNullValue())
@ -930,8 +921,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onSubframeLoadRequest( override fun onSubframeLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("Session should not be null", session, notNullValue()) assertThat("Session should not be null", session, notNullValue())
assertThat("App did not request this load", request.isDirectNavigation, equalTo(false)) assertThat("App did not request this load", request.isDirectNavigation, equalTo(false))
assertThat("URI should not be null", request.uri, notNullValue()) assertThat("URI should not be null", request.uri, notNullValue())
@ -963,8 +953,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("Session should not be null", session, notNullValue()) assertThat("Session should not be null", session, notNullValue())
assertThat("URI should not be null", request.uri, notNullValue()) assertThat("URI should not be null", request.uri, notNullValue())
assertThat( assertThat(
@ -1026,8 +1015,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("URL should match", request.uri, equalTo(forEachCall(uri, redirectUri))) assertThat("URL should match", request.uri, equalTo(forEachCall(uri, redirectUri)))
assertThat( assertThat(
"From app should be correct", "From app should be correct",
@ -1450,8 +1438,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("Session should not be null", session, notNullValue()) assertThat("Session should not be null", session, notNullValue())
assertThat("URI should not be null", request.uri, notNullValue()) assertThat("URI should not be null", request.uri, notNullValue())
assertThat("URI should match", request.uri, endsWith(HELLO_HTML_PATH)) assertThat("URI should match", request.uri, endsWith(HELLO_HTML_PATH))
@ -1730,8 +1717,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("URI should match", request.uri, endsWith(HELLO_HTML_PATH)) assertThat("URI should match", request.uri, endsWith(HELLO_HTML_PATH))
assertThat( assertThat(
"Trigger URL should be null", "Trigger URL should be null",
@ -1807,8 +1793,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"Load should not be direct", "Load should not be direct",
request.isDirectNavigation, request.isDirectNavigation,
@ -1852,8 +1837,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"Load should not be direct", "Load should not be direct",
request.isDirectNavigation, request.isDirectNavigation,
@ -1896,8 +1880,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
if (request.uri.endsWith(HELLO_HTML_PATH)) { if (request.uri.endsWith(HELLO_HTML_PATH)) {
return GeckoResult.deny() return GeckoResult.deny()
} else { } else {
@ -1937,8 +1920,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("URI should be correct", request.uri, endsWith(NEW_SESSION_CHILD_HTML_PATH)) assertThat("URI should be correct", request.uri, endsWith(NEW_SESSION_CHILD_HTML_PATH))
assertThat( assertThat(
"Trigger URL should match", "Trigger URL should match",
@ -1993,8 +1975,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat("URI should be correct", request.uri, endsWith(NEW_SESSION_CHILD_HTML_PATH)) assertThat("URI should be correct", request.uri, endsWith(NEW_SESSION_CHILD_HTML_PATH))
assertThat( assertThat(
"Trigger URL should be null", "Trigger URL should be null",
@ -2104,8 +2085,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
// Pretend we handled the target="_blank" link click. // Pretend we handled the target="_blank" link click.
if (request.uri.endsWith(NEW_SESSION_CHILD_HTML_PATH)) { if (request.uri.endsWith(NEW_SESSION_CHILD_HTML_PATH)) {
return GeckoResult.deny() return GeckoResult.deny()
@ -2126,8 +2106,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"URI must match", "URI must match",
request.uri, request.uri,
@ -2175,8 +2154,7 @@ class NavigationDelegateTest : BaseSessionTest() {
mainSession.waitUntilCalled(object : NavigationDelegate { mainSession.waitUntilCalled(object : NavigationDelegate {
@AssertCalled(count = 1, order = [1]) @AssertCalled(count = 1, order = [1])
override fun onLoadRequest(session: GeckoSession, request: LoadRequest): override fun onLoadRequest(session: GeckoSession, request: LoadRequest): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"URL should be correct", "URL should be correct",
request.uri, request.uri,
@ -2196,8 +2174,7 @@ class NavigationDelegateTest : BaseSessionTest() {
} }
@AssertCalled(count = 1, order = [2]) @AssertCalled(count = 1, order = [2])
override fun onNewSession(session: GeckoSession, uri: String): override fun onNewSession(session: GeckoSession, uri: String): GeckoResult<GeckoSession>? {
GeckoResult<GeckoSession>? {
assertThat("URL should be correct", uri, endsWith("form_blank.html?")) assertThat("URL should be correct", uri, endsWith("form_blank.html?"))
return null return null
} }
@ -2727,8 +2704,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"Load should not be direct", "Load should not be direct",
request.isDirectNavigation, request.isDirectNavigation,
@ -2756,8 +2732,7 @@ class NavigationDelegateTest : BaseSessionTest() {
override fun onLoadRequest( override fun onLoadRequest(
session: GeckoSession, session: GeckoSession,
request: LoadRequest, request: LoadRequest,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
return null return null
} }

View file

@ -214,8 +214,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
assertThat("URI should match", perm.uri, endsWith(url)) assertThat("URI should match", perm.uri, endsWith(url))
assertThat( assertThat(
"Type should match", "Type should match",
@ -302,8 +301,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
return GeckoResult.fromValue(ContentPermission.VALUE_DENY) return GeckoResult.fromValue(ContentPermission.VALUE_DENY)
} }
@ -517,8 +515,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
assertThat("URI should match", perm.uri, endsWith(url)) assertThat("URI should match", perm.uri, endsWith(url))
assertThat( assertThat(
"Type should match", "Type should match",
@ -589,8 +586,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
return GeckoResult.fromValue(ContentPermission.VALUE_DENY) return GeckoResult.fromValue(ContentPermission.VALUE_DENY)
} }
}) })
@ -651,8 +647,7 @@ class PermissionDelegateTest : BaseSessionTest() {
mainSession.waitUntilCalled(object : PermissionDelegate { mainSession.waitUntilCalled(object : PermissionDelegate {
@AssertCalled(count = 2) @AssertCalled(count = 2)
override fun onContentPermissionRequest(session: GeckoSession, perm: ContentPermission): override fun onContentPermissionRequest(session: GeckoSession, perm: ContentPermission): GeckoResult<Int> {
GeckoResult<Int> {
val expectedType = if (sessionRule.currentCall.counter == 1) PermissionDelegate.PERMISSION_AUTOPLAY_AUDIBLE else PermissionDelegate.PERMISSION_AUTOPLAY_INAUDIBLE val expectedType = if (sessionRule.currentCall.counter == 1) PermissionDelegate.PERMISSION_AUTOPLAY_AUDIBLE else PermissionDelegate.PERMISSION_AUTOPLAY_INAUDIBLE
assertThat("Type should match", perm.permission, equalTo(expectedType)) assertThat("Type should match", perm.permission, equalTo(expectedType))
return GeckoResult.fromValue(ContentPermission.VALUE_DENY) return GeckoResult.fromValue(ContentPermission.VALUE_DENY)
@ -672,8 +667,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
assertThat("URI should match", perm.uri, endsWith(url)) assertThat("URI should match", perm.uri, endsWith(url))
assertThat( assertThat(
"Type should match", "Type should match",
@ -738,8 +732,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
assertThat("URI should match", perm.uri, endsWith(url)) assertThat("URI should match", perm.uri, endsWith(url))
assertThat( assertThat(
"Type should match", "Type should match",
@ -807,8 +800,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
assertThat("URI should match", perm.uri, endsWith(url)) assertThat("URI should match", perm.uri, endsWith(url))
assertThat( assertThat(
"Type should match", "Type should match",
@ -878,8 +870,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
assertThat("URI should match", perm.uri, endsWith(url)) assertThat("URI should match", perm.uri, endsWith(url))
assertThat( assertThat(
"Type should match", "Type should match",
@ -956,8 +947,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
assertThat("URI should match", perm.uri, endsWith(url)) assertThat("URI should match", perm.uri, endsWith(url))
assertThat( assertThat(
"Type should match", "Type should match",
@ -1002,8 +992,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
return GeckoResult.fromValue(ContentPermission.VALUE_PROMPT) return GeckoResult.fromValue(ContentPermission.VALUE_PROMPT)
} }
}) })
@ -1028,8 +1017,7 @@ class PermissionDelegateTest : BaseSessionTest() {
override fun onContentPermissionRequest( override fun onContentPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ContentPermission, perm: ContentPermission,
): ): GeckoResult<Int> {
GeckoResult<Int> {
assertThat("URI should match", perm.uri, endsWith(url)) assertThat("URI should match", perm.uri, endsWith(url))
assertThat( assertThat(
"Type should match", "Type should match",

View file

@ -277,8 +277,7 @@ class RuntimeSettingsTest : BaseSessionTest() {
mainSession.loadUri("about:config") mainSession.loadUri("about:config")
mainSession.waitUntilCalled(object : NavigationDelegate { mainSession.waitUntilCalled(object : NavigationDelegate {
@AssertCalled @AssertCalled
override fun onLoadError(session: GeckoSession, uri: String?, error: WebRequestError): override fun onLoadError(session: GeckoSession, uri: String?, error: WebRequestError): GeckoResult<String>? {
GeckoResult<String>? {
assertThat("about:config should not load.", uri, equalTo("about:config")) assertThat("about:config should not load.", uri, equalTo("about:config"))
return null return null
} }

View file

@ -393,8 +393,7 @@ class SelectionActionDelegateTest : BaseSessionTest() {
override fun onShowClipboardPermissionRequest( override fun onShowClipboardPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ClipboardPermission, perm: ClipboardPermission,
): ): GeckoResult<AllowOrDeny> {
GeckoResult<AllowOrDeny> {
assertThat( assertThat(
"Type should match", "Type should match",
perm.type, perm.type,
@ -408,8 +407,7 @@ class SelectionActionDelegateTest : BaseSessionTest() {
override fun onAlertPrompt( override fun onAlertPrompt(
session: GeckoSession, session: GeckoSession,
prompt: PromptDelegate.AlertPrompt, prompt: PromptDelegate.AlertPrompt,
): ): GeckoResult<PromptDelegate.PromptResponse> {
GeckoResult<PromptDelegate.PromptResponse> {
assertThat("Message should match", "allow", equalTo(prompt.message)) assertThat("Message should match", "allow", equalTo(prompt.message))
result.complete(null) result.complete(null)
return GeckoResult.fromValue(prompt.dismiss()) return GeckoResult.fromValue(prompt.dismiss())
@ -440,8 +438,7 @@ class SelectionActionDelegateTest : BaseSessionTest() {
override fun onShowClipboardPermissionRequest( override fun onShowClipboardPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ClipboardPermission, perm: ClipboardPermission,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"Type should match", "Type should match",
perm.type, perm.type,
@ -454,8 +451,7 @@ class SelectionActionDelegateTest : BaseSessionTest() {
override fun onAlertPrompt( override fun onAlertPrompt(
session: GeckoSession, session: GeckoSession,
prompt: PromptDelegate.AlertPrompt, prompt: PromptDelegate.AlertPrompt,
): ): GeckoResult<PromptDelegate.PromptResponse> {
GeckoResult<PromptDelegate.PromptResponse> {
assertThat("Message should match", "deny", equalTo(prompt.message)) assertThat("Message should match", "deny", equalTo(prompt.message))
result.complete(null) result.complete(null)
return GeckoResult.fromValue(prompt.dismiss()) return GeckoResult.fromValue(prompt.dismiss())
@ -486,8 +482,7 @@ class SelectionActionDelegateTest : BaseSessionTest() {
override fun onShowClipboardPermissionRequest( override fun onShowClipboardPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ClipboardPermission, perm: ClipboardPermission,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"Type should match", "Type should match",
perm.type, perm.type,
@ -533,8 +528,7 @@ class SelectionActionDelegateTest : BaseSessionTest() {
override fun onShowClipboardPermissionRequest( override fun onShowClipboardPermissionRequest(
session: GeckoSession, session: GeckoSession,
perm: ClipboardPermission, perm: ClipboardPermission,
): ): GeckoResult<AllowOrDeny>? {
GeckoResult<AllowOrDeny>? {
assertThat( assertThat(
"Type should match", "Type should match",
perm.type, perm.type,

View file

@ -537,7 +537,8 @@ class TextInputDelegateTest : BaseSessionTest() {
"Can commit text (select before)", "Can commit text (select before)",
ic, ic,
"foobarfoo", "foobarfoo",
5, /* checkGecko */ 5,
/* checkGecko */
false, false,
) )
} }
@ -641,7 +642,8 @@ class TextInputDelegateTest : BaseSessionTest() {
"Can set new composing region text", "Can set new composing region text",
ic, ic,
"frabar", "frabar",
6, /* checkGecko */ 6,
/* checkGecko */
false, false,
) )
@ -826,7 +828,13 @@ class TextInputDelegateTest : BaseSessionTest() {
}.joinToString("") }.joinToString("")
setupContent(content) setupContent(content)
val ic = mainSession.textInput.onCreateInputConnection(EditorInfo())!! val ic = mainSession.textInput.onCreateInputConnection(EditorInfo())!!
assertText("Can set large initial text", ic, content, /* checkGecko */ false) assertText(
"Can set large initial text",
ic,
content,
/* checkGecko */
false,
)
} }
@SdkSuppress(minSdkVersion = Build.VERSION_CODES.N_MR1) @SdkSuppress(minSdkVersion = Build.VERSION_CODES.N_MR1)
@ -1294,7 +1302,14 @@ class TextInputDelegateTest : BaseSessionTest() {
pressKey(ic, KeyEvent.KEYCODE_DPAD_LEFT) pressKey(ic, KeyEvent.KEYCODE_DPAD_LEFT)
pressKey(ic, KeyEvent.KEYCODE_DPAD_LEFT) pressKey(ic, KeyEvent.KEYCODE_DPAD_LEFT)
pressKey(ic, KeyEvent.KEYCODE_DPAD_LEFT) pressKey(ic, KeyEvent.KEYCODE_DPAD_LEFT)
assertSelection("IME caret is moved to top", ic, 0, 0, /* checkGecko */ false) assertSelection(
"IME caret is moved to top",
ic,
0,
0,
/* checkGecko */
false,
)
setComposingText(ic, "bar", 1) setComposingText(ic, "bar", 1)
finishComposingText(ic) finishComposingText(ic)

View file

@ -31,8 +31,7 @@ class WebNotificationTest : BaseSessionTest() {
// Grant "desktop notification" permission // Grant "desktop notification" permission
mainSession.delegateUntilTestEnd(object : PermissionDelegate { mainSession.delegateUntilTestEnd(object : PermissionDelegate {
override fun onContentPermissionRequest(session: GeckoSession, perm: PermissionDelegate.ContentPermission): override fun onContentPermissionRequest(session: GeckoSession, perm: PermissionDelegate.ContentPermission): GeckoResult<Int>? {
GeckoResult<Int>? {
assertThat("Should grant DESKTOP_NOTIFICATIONS permission", perm.permission, equalTo(PermissionDelegate.PERMISSION_DESKTOP_NOTIFICATION)) assertThat("Should grant DESKTOP_NOTIFICATIONS permission", perm.permission, equalTo(PermissionDelegate.PERMISSION_DESKTOP_NOTIFICATION))
return GeckoResult.fromValue(PermissionDelegate.ContentPermission.VALUE_ALLOW) return GeckoResult.fromValue(PermissionDelegate.ContentPermission.VALUE_ALLOW)
} }
@ -336,7 +335,11 @@ class WebNotificationTest : BaseSessionTest() {
// Test that we can serialize a notification // Test that we can serialize a notification
val parcel = Parcel.obtain() val parcel = Parcel.obtain()
notification.writeToParcel(parcel, /* ignored */ -1) notification.writeToParcel(
parcel,
/* ignored */
-1,
)
assertThat("Promise should have been resolved.", promiseResult.value as Double, equalTo(1.0)) assertThat("Promise should have been resolved.", promiseResult.value as Double, equalTo(1.0))
} }
@ -375,7 +378,11 @@ class WebNotificationTest : BaseSessionTest() {
// Test that we can serialize a notification with an imageUrl.length >= 150 // Test that we can serialize a notification with an imageUrl.length >= 150
val parcel = Parcel.obtain() val parcel = Parcel.obtain()
notification.writeToParcel(parcel, /* ignored */ -1) notification.writeToParcel(
parcel,
/* ignored */
-1,
)
parcel.setDataPosition(0) parcel.setDataPosition(0)
val serializedNotification = WebNotification.CREATOR.createFromParcel(parcel) val serializedNotification = WebNotification.CREATOR.createFromParcel(parcel)

View file

@ -60,8 +60,7 @@ class WebPushTest : BaseSessionTest() {
sessionRule.setPrefsUntilTestEnd(mapOf("dom.webnotifications.requireuserinteraction" to false)) sessionRule.setPrefsUntilTestEnd(mapOf("dom.webnotifications.requireuserinteraction" to false))
// Grant "desktop notification" permission // Grant "desktop notification" permission
mainSession.delegateUntilTestEnd(object : PermissionDelegate { mainSession.delegateUntilTestEnd(object : PermissionDelegate {
override fun onContentPermissionRequest(session: GeckoSession, perm: GeckoSession.PermissionDelegate.ContentPermission): override fun onContentPermissionRequest(session: GeckoSession, perm: GeckoSession.PermissionDelegate.ContentPermission): GeckoResult<Int>? {
GeckoResult<Int>? {
assertThat("Should grant DESKTOP_NOTIFICATIONS permission", perm.permission, equalTo(GeckoSession.PermissionDelegate.PERMISSION_DESKTOP_NOTIFICATION)) assertThat("Should grant DESKTOP_NOTIFICATIONS permission", perm.permission, equalTo(GeckoSession.PermissionDelegate.PERMISSION_DESKTOP_NOTIFICATION))
return GeckoResult.fromValue(GeckoSession.PermissionDelegate.ContentPermission.VALUE_ALLOW) return GeckoResult.fromValue(GeckoSession.PermissionDelegate.ContentPermission.VALUE_ALLOW)
} }