Skip to content

Commit

Permalink
Pass along crash reporter instance to PlacesHistoryStorage
Browse files Browse the repository at this point in the history
  • Loading branch information
Grisha Kruglov authored and ekager committed Aug 26, 2020
1 parent 75c496f commit f694861
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class Components(private val context: Context) {
)
}
val services by lazy { Services(context, backgroundServices.accountManager) }
val core by lazy { Core(context) }
val core by lazy { Core(context, analytics.crashReporter) }
val search by lazy { Search(context) }
val useCases by lazy {
UseCases(
Expand Down
5 changes: 3 additions & 2 deletions app/src/main/java/org/mozilla/fenix/components/Core.kt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ import mozilla.components.service.digitalassetlinks.RelationChecker
import mozilla.components.service.digitalassetlinks.local.StatementApi
import mozilla.components.service.digitalassetlinks.local.StatementRelationChecker
import mozilla.components.service.sync.logins.SyncableLoginsStorage
import mozilla.components.support.base.crash.CrashReporting
import org.mozilla.fenix.AppRequestInterceptor
import org.mozilla.fenix.Config
import org.mozilla.fenix.HomeActivity
Expand All @@ -63,7 +64,7 @@ import java.util.concurrent.TimeUnit
* Component group for all core browser functionality.
*/
@Mockable
class Core(private val context: Context) {
class Core(private val context: Context, private val crashReporter: CrashReporting) {
/**
* The browser engine component initialized based on the build
* configuration (see build variants).
Expand Down Expand Up @@ -228,7 +229,7 @@ class Core(private val context: Context) {
// Use these for startup-path code, where we don't want to do any work that's not strictly necessary.
// For example, this is how the GeckoEngine delegates (history, logins) are configured.
// We can fully initialize GeckoEngine without initialized our storage.
val lazyHistoryStorage = lazy { PlacesHistoryStorage(context) }
val lazyHistoryStorage = lazy { PlacesHistoryStorage(context, crashReporter) }
val lazyBookmarksStorage = lazy { PlacesBookmarksStorage(context) }
val lazyPasswordsStorage = lazy { SyncableLoginsStorage(context, passwordsEncryptionKey) }

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class TestComponents(private val context: Context) : Components(context) {
mockk<BackgroundServices>(relaxed = true)
}
override val services by lazy { Services(context, backgroundServices.accountManager) }
override val core by lazy { TestCore(context) }
override val core by lazy { TestCore(context, analytics.crashReporter) }
override val search by lazy { Search(context) }
override val useCases by lazy {
UseCases(
Expand Down
3 changes: 2 additions & 1 deletion app/src/test/java/org/mozilla/fenix/components/TestCore.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ import mozilla.components.concept.engine.Engine
import mozilla.components.concept.engine.Settings
import mozilla.components.concept.fetch.Client
import mozilla.components.feature.pwa.WebAppShortcutManager
import mozilla.components.support.base.crash.CrashReporting

class TestCore(context: Context) : Core(context) {
class TestCore(context: Context, crashReporter: CrashReporting) : Core(context, crashReporter) {

override val engine = mockk<Engine>(relaxed = true) {
every { this@mockk getProperty "settings" } returns mockk<Settings>(relaxed = true)
Expand Down

0 comments on commit f694861

Please sign in to comment.