Bug 1838903 - Fix Fenix formatting issues and update baseline

fenix/116.0
Ryan VanderMeulen 11 months ago committed by mergify[bot]
parent a5cefbfb1b
commit 437b188fe8

@ -39,8 +39,6 @@ import org.mozilla.fenix.ui.robots.searchScreen
* Tests for verifying basic functionality of bookmarks * Tests for verifying basic functionality of bookmarks
*/ */
class BookmarksTest { class BookmarksTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private val bookmarksFolderName = "New Folder" private val bookmarksFolderName = "New Folder"

@ -154,7 +154,7 @@ class DownloadTest {
/* Verifies downloads in the Downloads Menu: /* Verifies downloads in the Downloads Menu:
- downloads appear in the list - downloads appear in the list
- deleting a download from device storage, removes it from the Downloads Menu too - deleting a download from device storage, removes it from the Downloads Menu too
*/ */
@SmokeTest @SmokeTest
@Test @Test
fun manageDownloadsInDownloadsMenuTest() { fun manageDownloadsInDownloadsMenuTest() {

@ -38,7 +38,6 @@ import org.mozilla.fenix.ui.robots.searchScreen
* *
*/ */
class HistoryTest { class HistoryTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
@ -159,7 +158,6 @@ class HistoryTest {
RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list), 1), RecyclerViewIdlingResource(activityTestRule.activity.findViewById(R.id.history_list), 1),
) { ) {
clickDeleteAllHistoryButton() clickDeleteAllHistoryButton()
} }
verifyDeleteConfirmationMessage() verifyDeleteConfirmationMessage()
selectEverythingOption() selectEverythingOption()

@ -28,8 +28,6 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
*/ */
class HomeScreenTest { class HomeScreenTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
private lateinit var firstPocketStoryPublisher: String private lateinit var firstPocketStoryPublisher: String

@ -33,8 +33,6 @@ import org.mozilla.fenix.ui.robots.notificationShade
* Note: this test only verifies media notifications, not media itself * Note: this test only verifies media notifications, not media itself
*/ */
class MediaNotificationTest { class MediaNotificationTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice

@ -37,7 +37,6 @@ class NavigationToolbarTest {
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
@get:Rule @get:Rule
val activityTestRule = HomeActivityTestRule.withDefaultSettingsOverrides() val activityTestRule = HomeActivityTestRule.withDefaultSettingsOverrides()

@ -25,8 +25,6 @@ import org.mozilla.fenix.ui.robots.homeScreen
*/ */
class SettingsAboutTest { class SettingsAboutTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer

@ -30,8 +30,6 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
*/ */
class SettingsAdvancedTest { class SettingsAdvancedTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer

@ -35,7 +35,6 @@ import org.mozilla.fenix.ui.robots.navigationToolbar
* *
*/ */
class SettingsDeleteBrowsingDataOnQuitTest { class SettingsDeleteBrowsingDataOnQuitTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
@get:Rule @get:Rule

@ -33,7 +33,6 @@ import org.mozilla.fenix.ui.robots.settingsScreen
*/ */
class SettingsDeleteBrowsingDataTest { class SettingsDeleteBrowsingDataTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
@get:Rule @get:Rule

@ -22,8 +22,6 @@ import org.mozilla.fenix.ui.robots.homeScreen
*/ */
class SettingsDeveloperToolsTest { class SettingsDeveloperToolsTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer

@ -35,7 +35,6 @@ import java.util.Locale
* *
*/ */
class SettingsGeneralTest { class SettingsGeneralTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
@get:Rule @get:Rule

@ -24,8 +24,6 @@ import org.mozilla.fenix.ui.robots.notificationShade
*/ */
class SettingsPrivacyTest { class SettingsPrivacyTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer

@ -21,8 +21,6 @@ import org.mozilla.fenix.helpers.HomeActivityTestRule
*/ */
class SettingsSyncTest { class SettingsSyncTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer

@ -93,7 +93,7 @@ class SmokeTest {
- editing the url bar - editing the url bar
- the tab drawer button - the tab drawer button
- opening a new search and dismissing the nav bar - opening a new search and dismissing the nav bar
*/ */
@Test @Test
fun verifyBasicNavigationToolbarFunctionality() { fun verifyBasicNavigationToolbarFunctionality() {
val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1) val defaultWebPage = TestAssetHelper.getGenericAsset(mockWebServer, 1)

@ -42,7 +42,6 @@ class TabbedBrowsingTest {
private lateinit var mDevice: UiDevice private lateinit var mDevice: UiDevice
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
@get:Rule @get:Rule
val activityTestRule = HomeActivityTestRule.withDefaultSettingsOverrides() val activityTestRule = HomeActivityTestRule.withDefaultSettingsOverrides()

@ -26,8 +26,6 @@ import org.mozilla.fenix.ui.robots.longClickPageObject
*/ */
class ThreeDotMenuMainTest { class ThreeDotMenuMainTest {
/* ktlint-disable no-blank-line-before-rbrace */ // This imposes unreadable grouping.
private lateinit var mockWebServer: MockWebServer private lateinit var mockWebServer: MockWebServer
@get:Rule @get:Rule

@ -99,9 +99,9 @@ class BrowserRobot {
} }
/* Asserts that the text within DOM element with ID="testContent" has the given text, i.e. /* Asserts that the text within DOM element with ID="testContent" has the given text, i.e.
* document.querySelector('#testContent').innerText == expectedText * document.querySelector('#testContent').innerText == expectedText
* *
*/ */
fun verifyPageContent(expectedText: String) { fun verifyPageContent(expectedText: String) {
sessionLoadedIdlingResource = SessionLoadedIdlingResource() sessionLoadedIdlingResource = SessionLoadedIdlingResource()

@ -217,15 +217,13 @@ class SettingsRobot {
return BrowserRobot.Transition() return BrowserRobot.Transition()
} }
fun openAboutFirefoxPreview(interact: SettingsSubMenuAboutRobot.() -> Unit): fun openAboutFirefoxPreview(interact: SettingsSubMenuAboutRobot.() -> Unit): SettingsSubMenuAboutRobot.Transition {
SettingsSubMenuAboutRobot.Transition {
aboutFirefoxHeading().click() aboutFirefoxHeading().click()
SettingsSubMenuAboutRobot().interact() SettingsSubMenuAboutRobot().interact()
return SettingsSubMenuAboutRobot.Transition() return SettingsSubMenuAboutRobot.Transition()
} }
fun openSearchSubMenu(interact: SettingsSubMenuSearchRobot.() -> Unit): fun openSearchSubMenu(interact: SettingsSubMenuSearchRobot.() -> Unit): SettingsSubMenuSearchRobot.Transition {
SettingsSubMenuSearchRobot.Transition {
itemWithText(getStringResource(R.string.preferences_search)) itemWithText(getStringResource(R.string.preferences_search))
.also { .also {
it.waitForExists(waitingTimeShort) it.waitForExists(waitingTimeShort)

@ -408,8 +408,7 @@ class TabDrawerRobot {
return Transition() return Transition()
} }
fun openRecentlyClosedTabs(interact: RecentlyClosedTabsRobot.() -> Unit): fun openRecentlyClosedTabs(interact: RecentlyClosedTabsRobot.() -> Unit): RecentlyClosedTabsRobot.Transition {
RecentlyClosedTabsRobot.Transition {
threeDotMenu().click() threeDotMenu().click()
mDevice.waitNotNull( mDevice.waitNotNull(
@ -424,8 +423,7 @@ class TabDrawerRobot {
return RecentlyClosedTabsRobot.Transition() return RecentlyClosedTabsRobot.Transition()
} }
fun clickSaveCollection(interact: CollectionRobot.() -> Unit): fun clickSaveCollection(interact: CollectionRobot.() -> Unit): CollectionRobot.Transition {
CollectionRobot.Transition {
saveTabsToCollectionButton().click() saveTabsToCollectionButton().click()
CollectionRobot().interact() CollectionRobot().interact()

@ -72,7 +72,7 @@ class CollectionCreationView(
interactor.onNewCollectionNameSaved(selectedTabs.toList(), text) interactor.onNewCollectionNameSaved(selectedTabs.toList(), text)
SaveCollectionStep.RenameCollection -> SaveCollectionStep.RenameCollection ->
selectedCollection?.let { interactor.onCollectionRenamed(it, text) } selectedCollection?.let { interactor.onCollectionRenamed(it, text) }
else -> { /* noop */ else -> { // noop
} }
} }
} }
@ -243,7 +243,7 @@ class CollectionCreationView(
} }
transition.addListener( transition.addListener(
object : Transition.TransitionListener { object : Transition.TransitionListener {
override fun onTransitionStart(transition: Transition) { /* noop */ override fun onTransitionStart(transition: Transition) { // noop
} }
override fun onTransitionEnd(transition: Transition) { override fun onTransitionEnd(transition: Transition) {
@ -251,13 +251,13 @@ class CollectionCreationView(
transition.removeListener(this) transition.removeListener(this)
} }
override fun onTransitionCancel(transition: Transition) { /* noop */ override fun onTransitionCancel(transition: Transition) { // noop
} }
override fun onTransitionPause(transition: Transition) { /* noop */ override fun onTransitionPause(transition: Transition) { // noop
} }
override fun onTransitionResume(transition: Transition) { /* noop */ override fun onTransitionResume(transition: Transition) { // noop
} }
}, },
) )

@ -76,7 +76,7 @@ class FenixSnackbar private constructor(
companion object { companion object {
const val LENGTH_LONG = Snackbar.LENGTH_LONG const val LENGTH_LONG = Snackbar.LENGTH_LONG
const val LENGTH_SHORT = Snackbar.LENGTH_SHORT const val LENGTH_SHORT = Snackbar.LENGTH_SHORT
private const val LENGTH_ACCESSIBLE = 15000 /* 15 seconds in ms */ private const val LENGTH_ACCESSIBLE = 15000 // 15 seconds in ms
const val LENGTH_INDEFINITE = Snackbar.LENGTH_INDEFINITE const val LENGTH_INDEFINITE = Snackbar.LENGTH_INDEFINITE
private const val minTextSize = 12 private const val minTextSize = 12

@ -106,9 +106,9 @@ class TrackingProtectionPolicyFactory(
} }
} }
@Suppress("MaxLineLength")
@VisibleForTesting @VisibleForTesting
internal fun TrackingProtectionPolicyForSessionTypes.applyTCPIfNeeded(settings: Settings): internal fun TrackingProtectionPolicyForSessionTypes.applyTCPIfNeeded(settings: Settings): TrackingProtectionPolicyForSessionTypes {
TrackingProtectionPolicyForSessionTypes {
val updatedCookiePolicy = if (settings.enabledTotalCookieProtection) { val updatedCookiePolicy = if (settings.enabledTotalCookieProtection) {
CookiePolicy.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS CookiePolicy.ACCEPT_FIRST_PARTY_AND_ISOLATE_OTHERS
} else { } else {

@ -15,7 +15,7 @@ import org.mozilla.fenix.library.history.History
import org.mozilla.fenix.library.history.HistoryItemTimeGroup import org.mozilla.fenix.library.history.HistoryItemTimeGroup
import org.mozilla.fenix.utils.Settings.Companion.SEARCH_GROUP_MINIMUM_SITES import org.mozilla.fenix.utils.Settings.Companion.SEARCH_GROUP_MINIMUM_SITES
private const val BUFFER_TIME = 15000 /* 15 seconds in ms */ private const val BUFFER_TIME = 15000 // 15 seconds in ms
/** /**
* Class representing a history entry. * Class representing a history entry.

@ -83,8 +83,8 @@ fun ClickableSubstringLink(
annotatedText annotatedText
.getStringAnnotations("link", it, it) .getStringAnnotations("link", it, it)
.firstOrNull()?.let { .firstOrNull()?.let {
onClick() onClick()
} }
}, },
) )
} }

@ -69,7 +69,7 @@ class AppStartReasonProvider {
// this Runnable should execute before the first Activity is created. // this Runnable should execute before the first Activity is created.
reason = when (reason) { reason = when (reason) {
StartReason.TO_BE_DETERMINED -> StartReason.NON_ACTIVITY StartReason.TO_BE_DETERMINED -> StartReason.NON_ACTIVITY
StartReason.ACTIVITY -> reason /* the start reason is already known: do nothing. */ StartReason.ACTIVITY -> reason // the start reason is already known: do nothing.
StartReason.NON_ACTIVITY -> { StartReason.NON_ACTIVITY -> {
Metrics.startReasonProcessError.set(true) Metrics.startReasonProcessError.set(true)
logger.error("AppStartReasonProvider.Process...onCreate unexpectedly called twice") logger.error("AppStartReasonProvider.Process...onCreate unexpectedly called twice")
@ -87,7 +87,7 @@ class AppStartReasonProvider {
// See ProcessLifecycleObserver.onCreate for details. // See ProcessLifecycleObserver.onCreate for details.
reason = when (reason) { reason = when (reason) {
StartReason.TO_BE_DETERMINED -> StartReason.ACTIVITY StartReason.TO_BE_DETERMINED -> StartReason.ACTIVITY
StartReason.NON_ACTIVITY -> reason /* the start reason is already known: do nothing. */ StartReason.NON_ACTIVITY -> reason // the start reason is already known: do nothing.
StartReason.ACTIVITY -> { StartReason.ACTIVITY -> {
Metrics.startReasonActivityError.set(true) Metrics.startReasonActivityError.set(true)
logger.error("AppStartReasonProvider.Activity...onCreate unexpectedly called twice") logger.error("AppStartReasonProvider.Activity...onCreate unexpectedly called twice")

@ -77,7 +77,7 @@ class AboutLibrariesFragment : Fragment(R.layout.fragment_about_libraries) {
[name] : either the name of the library, or its artifact name. [name] : either the name of the library, or its artifact name.
See https://github.com/google/play-services-plugins/tree/master/oss-licenses-plugin See https://github.com/google/play-services-plugins/tree/master/oss-licenses-plugin
*/ */
val licensesData = resources val licensesData = resources
.openRawResource(R.raw.third_party_licenses) .openRawResource(R.raw.third_party_licenses)
.readBytes() .readBytes()

@ -107,6 +107,6 @@ class CookieBannerReEngagementDialog : DialogFragment() {
} }
companion object { companion object {
private const val LENGTH_SNACKBAR_DURATION = 4000 /* 4 seconds in ms */ private const val LENGTH_SNACKBAR_DURATION = 4000 // 4 seconds in ms
} }
} }

@ -78,7 +78,7 @@ class SaveToPDFMiddleware(
* @param exception - A given exception that will be properly labeled for telemetry posting. * @param exception - A given exception that will be properly labeled for telemetry posting.
* @return processed failure reason to send in telemetry. * @return processed failure reason to send in telemetry.
*/ */
/* package */ @VisibleForTesting @VisibleForTesting // package
fun telemetryErrorReason(exception: Exception): String { fun telemetryErrorReason(exception: Exception): String {
var failureMsg = "unknown" var failureMsg = "unknown"
// Requiring information from GeckoView isn't a good practice, // Requiring information from GeckoView isn't a good practice,
@ -105,7 +105,7 @@ class SaveToPDFMiddleware(
* @param isPdfViewer - If the page has a PDF viewer or not. * @param isPdfViewer - If the page has a PDF viewer or not.
* @return processed page source type to send in telemetry. * @return processed page source type to send in telemetry.
*/ */
/* package */ @VisibleForTesting @VisibleForTesting // package
fun telemetrySource(isPdfViewer: Boolean?): String { fun telemetrySource(isPdfViewer: Boolean?): String {
val source = when (isPdfViewer) { val source = when (isPdfViewer) {
null -> "unknown" null -> "unknown"

@ -60,11 +60,11 @@ data class Wallpaper(
const val defaultName = "default" const val defaultName = "default"
/* /*
Note: this collection could get out of sync with the version of it generated when fetching * Note: this collection could get out of sync with the version of it generated when fetching
remote metadata. It is included mostly for convenience, but use with utmost care until * remote metadata. It is included mostly for convenience, but use with utmost care until
we find a better way of handling the edge cases around this collection. It is generally * we find a better way of handling the edge cases around this collection. It is generally
safer to do comparison directly with the collection name. * safer to do comparison directly with the collection name.
*/ */
const val classicFirefoxCollectionName = "classic-firefox" const val classicFirefoxCollectionName = "classic-firefox"
val ClassicFirefoxCollection = Collection( val ClassicFirefoxCollection = Collection(
name = classicFirefoxCollectionName, name = classicFirefoxCollectionName,

@ -31,7 +31,7 @@ class NimbusSystemTest {
// By default this comes from the generated Nimbus features. // By default this comes from the generated Nimbus features.
val config = NimbusSystem( val config = NimbusSystem(
refreshIntervalForeground = 60, /* minutes */ refreshIntervalForeground = 60, // minutes
) )
class NimbusUnderTest(override val context: Context) : NimbusInterface { class NimbusUnderTest(override val context: Context) : NimbusInterface {

@ -4,7 +4,7 @@
- file, You can obtain one at http://mozilla.org/MPL/2.0/. --> - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
<baseline version="1.0"> <baseline version="1.0">
<file name="app/src/main/java/org/mozilla/fenix/home/topsites/TopSiteItemViewHolder.kt"> <file name="app/src/test/java/org/mozilla/fenix/home/recentvisits/view/RecentBookmarksViewHolderTest.kt">
<error line="65" column="35" source="annotation" /> <error line="36" column="6" source="standard:block-comment-initial-star-alignment" />
</file> </file>
</baseline> </baseline>

Loading…
Cancel
Save