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

Commit 418eb70e authored by Jeff Chen's avatar Jeff Chen Committed by Android (Google) Code Review
Browse files

Merge "Migrate UserSwitcherScreenshotTest to Kosmos." into main

parents 952dc1a5 a3566162
Loading
Loading
Loading
Loading
+34 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.broadcast

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

val Kosmos.broadcastDispatcher by
    Kosmos.Fixture {
        FakeBroadcastDispatcher(
            context = mock(),
            mainExecutor = mock(),
            broadcastRunningLooper = mock(),
            broadcastRunningExecutor = mock(),
            dumpManager = mock(),
            logger = mock(),
            userTracker = mock(),
            shouldFailOnLeakedReceiver = false
        )
    }
+21 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.flags

import com.android.systemui.kosmos.Kosmos

val Kosmos.featureFlags by Kosmos.Fixture { FakeFeatureFlagsClassic() }
+10 −2
Original line number Diff line number Diff line
package com.android.systemui.kosmos

import android.content.Context
import android.os.UserManager
import com.android.systemui.kosmos.Kosmos.Fixture
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.test.StandardTestDispatcher
import kotlinx.coroutines.test.TestScope
import org.mockito.Mockito

val Kosmos.testDispatcher by Fixture { StandardTestDispatcher() }
val Kosmos.testScope by Fixture { TestScope(testDispatcher) }
var Kosmos.testDispatcher by Fixture { StandardTestDispatcher() }
var Kosmos.testScope by Fixture { TestScope(testDispatcher) }
var Kosmos.context by Fixture<Context>()
var Kosmos.lifecycleScope by Fixture<CoroutineScope>()

val Kosmos.userManager by Fixture { Mockito.mock(UserManager::class.java) }
+21 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.user.data.repository

import com.android.systemui.kosmos.Kosmos

val Kosmos.userRepository by Kosmos.Fixture { FakeUserRepository() }
+43 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2023 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.user.domain.interactor

import com.android.systemui.kosmos.Kosmos
import com.android.systemui.kosmos.context
import com.android.systemui.kosmos.lifecycleScope
import com.android.systemui.kosmos.testDispatcher
import com.android.systemui.kosmos.userManager
import com.android.systemui.user.data.repository.userRepository
import com.android.systemui.util.mockito.mock

val Kosmos.guestUserInteractor by
    Kosmos.Fixture {
        GuestUserInteractor(
            applicationContext = context,
            applicationScope = lifecycleScope,
            mainDispatcher = testDispatcher,
            backgroundDispatcher = testDispatcher,
            manager = userManager,
            deviceProvisionedController = mock(),
            repository = userRepository,
            devicePolicyManager = mock(),
            refreshUsersScheduler = refreshUsersScheduler,
            uiEventLogger = mock(),
            resumeSessionReceiver = mock(),
            resetOrExitSessionReceiver = mock(),
        )
    }
Loading