From c86668c19c18388fd58c16bbf045814ae45037dc Mon Sep 17 00:00:00 2001 From: Makoto Kato Date: Thu, 19 Jan 2023 04:20:48 +0000 Subject: [PATCH] Bug 1810392 - Upgrde spotless to 6.12.1 to use ktlint 0.47.1. r=geckoview-reviewers,ohall Differential Revision: https://phabricator.services.mozilla.com/D166891 --- build.gradle | 4 +- .../geckoview/test/AccessibilityTest.kt | 46 ++++++++++++------- .../mozilla/geckoview/test/BaseSessionTest.kt | 7 ++- .../test/GeckoSessionTestRuleTest.kt | 2 +- 4 files changed, 38 insertions(+), 21 deletions(-) diff --git a/build.gradle b/build.gradle index b355937f6d70..9c6a31c4e39a 100644 --- a/build.gradle +++ b/build.gradle @@ -116,7 +116,7 @@ buildscript { classpath 'org.mozilla.apilint:apilint:0.5.2' classpath 'com.android.tools.build:gradle:7.2.2' classpath 'org.apache.commons:commons-exec:1.3' - classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.10.0' + classpath 'com.diffplug.spotless:spotless-plugin-gradle:6.12.1' classpath 'org.tomlj:tomlj:1.0.0' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" } @@ -367,7 +367,7 @@ subprojects { include '**/*.kt' exclude '**/thirdparty/**' } - ktlint('0.46.1') + ktlint('0.47.1') } } } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt index 3d5089729155..09d6ac83cb56 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/AccessibilityTest.kt @@ -1305,16 +1305,19 @@ class AccessibilityTest : BaseSessionTest() { "#user2" to "bar", "#pass2" to "baz" ) + - if (Build.VERSION.SDK_INT >= 19) mapOf( - "#email1" to "a@b.c", - "#number1" to "24", - "#tel1" to "42" - ) - else mapOf( - "#email1" to "bar", - "#number1" to "", - "#tel1" to "bar" - ) + if (Build.VERSION.SDK_INT >= 19) { + mapOf( + "#email1" to "a@b.c", + "#number1" to "24", + "#tel1" to "42" + ) + } else { + mapOf( + "#email1" to "bar", + "#number1" to "", + "#tel1" to "bar" + ) + } // Set up promises to monitor the values changing. val promises = autoFills.flatMap { entry -> @@ -1359,8 +1362,12 @@ class AccessibilityTest : BaseSessionTest() { } val args = Bundle(1) - val value = if (child.isPassword) "baz" else { - if (Build.VERSION.SDK_INT < 19) "bar" else { + val value = if (child.isPassword) { + "baz" + } else { + if (Build.VERSION.SDK_INT < 19) { + "bar" + } else { when (child.inputType) { InputType.TYPE_CLASS_TEXT or InputType.TYPE_TEXT_VARIATION_WEB_EMAIL_ADDRESS -> "a@b.c" @@ -1378,7 +1385,9 @@ class AccessibilityTest : BaseSessionTest() { } val ACTION_SET_TEXT = if (Build.VERSION.SDK_INT >= 21) { AccessibilityNodeInfo.ACTION_SET_TEXT - } else 0x200000 + } else { + 0x200000 + } args.putCharSequence(ACTION_ARGUMENT_SET_TEXT_CHARSEQUENCE, value) assertThat( @@ -1415,14 +1424,19 @@ class AccessibilityTest : BaseSessionTest() { ): Int { val info = createNodeInfo(id) return ( - if (cond(info) && info.className != "android.webkit.WebView") 1 - else 0 + if (cond(info) && info.className != "android.webkit.WebView") { + 1 + } else { + 0 + } ) + ( if (info.childCount > 0) { (0 until info.childCount).sumOf { countAutoFillNodes(cond, info.getChildId(it)) } - } else 0 + } else { + 0 + } ) } diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseSessionTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseSessionTest.kt index 30012d94bc84..d8ddebe1ef02 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseSessionTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/BaseSessionTest.kt @@ -141,8 +141,11 @@ open class BaseSessionTest(noErrorCollector: Boolean = false) { fun assertThat(reason: String, v: T, m: Matcher) = sessionRule.checkThat(reason, v, m) fun assertInAutomationThat(reason: String, v: T, m: Matcher) = - if (sessionRule.env.isAutomation) assertThat(reason, v, m) - else assumeThat(reason, v, m) + if (sessionRule.env.isAutomation) { + assertThat(reason, v, m) + } else { + assumeThat(reason, v, m) + } init { if (!noErrorCollector) { diff --git a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt index 2a7553571992..1a704b5d6698 100644 --- a/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt +++ b/mobile/android/geckoview/src/androidTest/java/org/mozilla/geckoview/test/GeckoSessionTestRuleTest.kt @@ -1955,7 +1955,7 @@ class GeckoSessionTestRuleTest : BaseSessionTest(noErrorCollector = true) { mainSession.reload() mainSession.waitForPageStop() - mainSession.forCallbacksDuringWait(Runnable @AssertCalled(count = 1) {}) + mainSession.forCallbacksDuringWait(Runnable @AssertCalled(count = 1) {}) // ktlint-disable annotation assertThat("Delegate should be unregistered after wait", delegate, nullValue()) }