Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 38a64a29 authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "[Kosmos]: Move brightnessWarningToast mock to proper Kosmos class" into main

parents 8e107757 25ec1c64
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -30,11 +30,11 @@ import com.android.systemui.common.shared.model.Icon
import com.android.systemui.common.shared.model.Text
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.haptics.slider.sliderHapticsViewModelFactory
import com.android.systemui.kosmos.brightnessWarningToast
import com.android.systemui.kosmos.testScope
import com.android.systemui.lifecycle.activateIn
import com.android.systemui.res.R
import com.android.systemui.settings.brightness.domain.interactor.brightnessMirrorShowingInteractor
import com.android.systemui.settings.brightness.ui.brightnessWarningToast
import com.android.systemui.testKosmos
import com.google.common.truth.Truth.assertThat
import kotlinx.coroutines.ExperimentalCoroutinesApi
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@ import com.android.systemui.brightness.domain.interactor.screenBrightnessInterac
import com.android.systemui.haptics.slider.sliderHapticsViewModelFactory
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.settings.brightness.domain.interactor.brightnessMirrorShowingInteractor
import com.android.systemui.kosmos.brightnessWarningToast
import com.android.systemui.settings.brightness.ui.brightnessWarningToast

val Kosmos.brightnessSliderViewModelFactory: BrightnessSliderViewModel.Factory by
    Kosmos.Fixture {
+0 −6
Original line number Diff line number Diff line
@@ -3,9 +3,6 @@ package com.android.systemui.kosmos
import com.android.systemui.SysuiTestCase
import com.android.systemui.coroutines.collectLastValue
import com.android.systemui.kosmos.Kosmos.Fixture
import com.android.systemui.settings.brightness.ui.BrightnessWarningToast

import com.android.systemui.util.mockito.mock
import kotlin.coroutines.CoroutineContext
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.test.StandardTestDispatcher
@@ -41,9 +38,6 @@ var Kosmos.backgroundCoroutineContext: CoroutineContext by Fixture {
    testScope.backgroundScope.coroutineContext
}
var Kosmos.mainCoroutineContext: CoroutineContext by Fixture { testScope.coroutineContext }
var Kosmos.brightnessWarningToast: BrightnessWarningToast by Kosmos.Fixture {
    mock<BrightnessWarningToast>()
}

/**
 * Run this test body with a [Kosmos] as receiver, and using the [testScope] currently installed in
+1 −1
Original line number Diff line number Diff line
@@ -21,9 +21,9 @@ import com.android.systemui.classifier.falsingManager
import com.android.systemui.haptics.msdl.msdlPlayer
import com.android.systemui.haptics.vibratorHelper
import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.brightnessWarningToast
import com.android.systemui.plugins.activityStarter
import com.android.systemui.settings.brightness.BrightnessSliderController
import com.android.systemui.settings.brightness.ui.brightnessWarningToast
import com.android.systemui.util.time.systemClock

/** This factory creates empty mocks. */
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2024 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.settings.brightness.ui

import com.android.systemui.kosmos.Kosmos
import com.android.systemui.util.mockito.mock

var Kosmos.brightnessWarningToast: BrightnessWarningToast by
    Kosmos.Fixture { mock<BrightnessWarningToast>() }