TestComponents.kt 1.39 KB
Newer Older
1
2
3
4
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

5
6
7
8
package org.mozilla.fenix.components

import android.content.Context
import io.mockk.mockk
9
import org.mozilla.fenix.helpers.perf.TestStrictModeManager
10
import org.mozilla.fenix.utils.ClipboardHandler
11
import org.mozilla.fenix.utils.Settings
12
13
14
15
16

class TestComponents(private val context: Context) : Components(context) {
    override val backgroundServices by lazy {
        mockk<BackgroundServices>(relaxed = true)
    }
Grisha Kruglov's avatar
Grisha Kruglov committed
17
    override val services by lazy { Services(context, backgroundServices.accountManager) }
18
    override val core by lazy { TestCore(context, analytics.crashReporter) }
19
    @Suppress("Deprecation")
20
21
22
    override val useCases by lazy {
        UseCases(
            context,
23
            core.engine,
24
            core.sessionManager,
25
            core.store,
26
            core.webAppShortcutManager,
27
            core.topSitesStorage
28
29
        )
    }
Tiger Oakes's avatar
Tiger Oakes committed
30
    override val intentProcessors by lazy { mockk<IntentProcessors>(relaxed = true) }
31
    override val analytics by lazy { Analytics(context) }
32
33

    override val clipboardHandler by lazy { ClipboardHandler(context) }
34
35

    override val settings by lazy { mockk<Settings>(relaxed = true) }
36
37

    override val strictMode by lazy { TestStrictModeManager() }
38
}