Merge "Move SystemUI test utils to SystemUI/tests/utils/ (1/2)" into tm-qpr-dev

This commit is contained in:
Jordan Demeulenaere
2022-08-02 13:34:47 +00:00
committed by Android (Google) Code Review
51 changed files with 88 additions and 20 deletions

View File

@@ -145,25 +145,10 @@ filegroup {
filegroup {
name: "SystemUI-tests-utils",
srcs: [
"tests/src/com/android/systemui/SysuiBaseFragmentTest.java",
"tests/src/com/android/systemui/SysuiTestCase.java",
"tests/src/com/android/systemui/TestableDependency.java",
"tests/src/com/android/systemui/classifier/FalsingManagerFake.java",
"tests/src/com/android/systemui/statusbar/notification/collection/NotificationEntryBuilder.java",
"tests/src/com/android/systemui/statusbar/RankingBuilder.java",
"tests/src/com/android/systemui/statusbar/SbnBuilder.java",
"tests/src/com/android/systemui/SysuiTestableContext.java",
"tests/src/com/android/systemui/util/**/*Fake.java",
"tests/src/com/android/systemui/utils/leaks/BaseLeakChecker.java",
"tests/src/com/android/systemui/utils/leaks/LeakCheckedTest.java",
"tests/src/com/android/systemui/**/Fake*.java",
"tests/src/com/android/systemui/**/Fake*.kt",
"tests/utils/src/**/*.java",
"tests/utils/src/**/*.kt",
],
exclude_srcs: [
"tests/src/com/android/systemui/**/*Test.java",
"tests/src/com/android/systemui/**/*Test.kt",
],
path: "tests/src",
path: "tests/utils/src",
}
java_library {
@@ -171,8 +156,8 @@ java_library {
srcs: [
"src/com/android/systemui/util/concurrency/DelayableExecutor.java",
"src/com/android/systemui/util/time/SystemClock.java",
"tests/src/com/android/systemui/util/concurrency/FakeExecutor.java",
"tests/src/com/android/systemui/util/time/FakeSystemClock.java",
"tests/utils/src/com/android/systemui/util/concurrency/FakeExecutor.java",
"tests/utils/src/com/android/systemui/util/time/FakeSystemClock.java",
],
jarjar_rules: ":jarjar-rules-shared",
}
@@ -195,6 +180,7 @@ android_library {
"src/**/*.java",
"src/**/I*.aidl",
":ReleaseJavaFiles",
":SystemUI-tests-utils",
],
static_libs: [
"WifiTrackerLib",

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2022 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.
-->
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.android.systemui.tests.utils">
</manifest>

View File

@@ -0,0 +1,30 @@
/*
* Copyright (C) 2022 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.people
import com.android.systemui.people.data.model.PeopleTileModel
import com.android.systemui.people.data.repository.PeopleTileRepository
/** A fake [PeopleTileRepository] to be used in tests. */
class FakePeopleTileRepository(
private val priorityTiles: List<PeopleTileModel>,
private val recentTiles: List<PeopleTileModel>,
) : PeopleTileRepository {
override fun priorityTiles(): List<PeopleTileModel> = priorityTiles
override fun recentTiles(): List<PeopleTileModel> = recentTiles
}

View File

@@ -0,0 +1,29 @@
/*
* Copyright (C) 2022 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.people
import com.android.systemui.people.data.repository.PeopleWidgetRepository
import com.android.systemui.people.widget.PeopleTileKey
/** A fake [PeopleWidgetRepository] to be used in tests. */
class FakePeopleWidgetRepository(
private val onSetWidgetTile: (widgetId: Int, tileKey: PeopleTileKey) -> Unit = { _, _ -> },
) : PeopleWidgetRepository {
override fun setWidgetTile(widgetId: Int, tileKey: PeopleTileKey) {
onSetWidgetTile(widgetId, tileKey)
}
}