For #22722 - Rename CrashReporterFragment to CrashContentView

Rename in a separate patch for git to not merge this to previous changes and in
such think that the the old file was deleted and a new one was created.
upstream-sync
Mugurell 2 years ago committed by mergify[bot]
parent bc59ede073
commit efc57762f6

@ -31,7 +31,7 @@ import org.mozilla.fenix.utils.Settings
* @param toolbar [BrowserToolbar] that will be expanded when showing the in-app crash reporter.
* @param isToolbarPlacedAtTop [Boolean] based allowing the in-app crash reporter to be shown as
* immediately below or above the toolbar.
* @param crashReporterView [CrashReporterFragment] which will be shown if the current tab is marked as crashed.
* @param crashReporterView [CrashContentView] which will be shown if the current tab is marked as crashed.
* @param components [Components] allowing interactions with other app features.
* @param settings [Settings] allowing to check whether crash reporting is enabled or not.
* @param navController [NavController] used to navigate to other parts of the app.
@ -43,7 +43,7 @@ class CrashContentIntegration(
private val appStore: AppStore,
private val toolbar: BrowserToolbar,
private val isToolbarPlacedAtTop: Boolean,
private val crashReporterView: CrashReporterFragment,
private val crashReporterView: CrashContentView,
private val components: Components,
private val settings: Settings,
private val navController: NavController,

@ -14,9 +14,11 @@ import org.mozilla.fenix.databinding.FragmentCrashReporterBinding
import org.mozilla.fenix.ext.increaseTapArea
/**
* Fragment shown when a tab crashes.
* View shown when a tab crashes. Intended to entirely overlay an EngineView.
* This will allow users to close or restore the current tab while optionally
* send all reports for non-fatal crashes or dismiss them.
*/
class CrashReporterFragment @JvmOverloads constructor(
class CrashContentView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0

@ -60,7 +60,7 @@
android:elevation="24dp"
android:visibility="gone" />
<org.mozilla.fenix.crashes.CrashReporterFragment
<org.mozilla.fenix.crashes.CrashContentView
android:id="@+id/crash_reporter_view"
android:layout_width="match_parent"
android:layout_height="match_parent"

@ -48,7 +48,7 @@ class CrashContentIntegrationTest {
@Test
fun `GIVEN a tab WHEN its content crashes THEN expand the toolbar and show the in-content crash reporter`() {
val crashReporterLayoutParams: MarginLayoutParams = mockk(relaxed = true)
val crashReporterView: CrashReporterFragment = mockk(relaxed = true) {
val crashReporterView: CrashContentView = mockk(relaxed = true) {
every { layoutParams } returns crashReporterLayoutParams
}
val toolbar: BrowserToolbar = mockk(relaxed = true) {
@ -86,7 +86,7 @@ class CrashContentIntegrationTest {
@Test
fun `GIVEN a tab is marked as crashed WHEN the crashed state changes THEN hide the in-content crash reporter`() {
val crashReporterView: CrashReporterFragment = mockk(relaxed = true)
val crashReporterView: CrashContentView = mockk(relaxed = true)
val integration = CrashContentIntegration(
browserStore = browserStore,
appStore = mockk(),

@ -17,15 +17,15 @@ import org.junit.Assert.assertTrue
import org.junit.Test
import org.junit.runner.RunWith
import org.mozilla.fenix.R
import org.mozilla.fenix.crashes.CrashReporterFragment.Companion.TAP_INCREASE_DP
import org.mozilla.fenix.crashes.CrashContentView.Companion.TAP_INCREASE_DP
import org.mozilla.fenix.ext.increaseTapArea
import org.mozilla.fenix.helpers.FenixRobolectricTestRunner
@RunWith(FenixRobolectricTestRunner::class)
class CrashReporterFragmentTest {
class CrashContentViewTest {
@Test
fun `WHEN show is called THEN remember the controller, inflate and display the View`() {
val view = spyk(CrashReporterFragment(testContext))
val view = spyk(CrashContentView(testContext))
val controller: CrashReporterController = mockk()
view.show(controller)
@ -39,7 +39,7 @@ class CrashReporterFragmentTest {
@Test
fun `WHEN hide is called THEN remove the View from layout`() {
val view = spyk(CrashReporterFragment(testContext))
val view = spyk(CrashContentView(testContext))
view.hide()
@ -49,7 +49,7 @@ class CrashReporterFragmentTest {
@Test
fun `GIVEN the View is not shown WHEN needing to be shown THEN inflate the layout and bind all widgets`() {
val controller: CrashReporterController = mockk(relaxed = true)
val view = CrashReporterFragment(testContext)
val view = CrashContentView(testContext)
view.controller = controller
assertFalse(view.isBindingInitialized)
@ -78,7 +78,7 @@ class CrashReporterFragmentTest {
@Test
fun `GIVEN the View is not shown WHEN needing to be shown THEN delegate the process to helper methods`() {
val view = spyk(CrashReporterFragment(testContext))
val view = spyk(CrashContentView(testContext))
view.inflateViewIfNecessary()
@ -90,7 +90,7 @@ class CrashReporterFragmentTest {
@Test
fun `GIVEN the View is to already shown WHEN needing to be shown again THEN return early and avoid duplicating the widgets setup`() {
val view = spyk(CrashReporterFragment(testContext))
val view = spyk(CrashContentView(testContext))
view.inflate() // mock that the View is already inflated
view.inflateViewIfNecessary() // try inflating it again
Loading…
Cancel
Save