Merge "Destroy tiles after tests" into tm-qpr-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
d8a0055524
@@ -38,6 +38,7 @@ import com.android.systemui.settings.UserTracker
|
|||||||
import com.android.systemui.util.settings.GlobalSettings
|
import com.android.systemui.util.settings.GlobalSettings
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.Lazy
|
import dagger.Lazy
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -94,6 +95,12 @@ class AirplaneModeTileTest : SysuiTestCase() {
|
|||||||
mUserTracker)
|
mUserTracker)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
mTile.destroy()
|
||||||
|
mTestableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIcon_whenDisabled_showsOffState() {
|
fun testIcon_whenDisabled_showsOffState() {
|
||||||
val state = QSTile.BooleanState()
|
val state = QSTile.BooleanState()
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ import com.android.systemui.statusbar.policy.NextAlarmController
|
|||||||
import com.android.systemui.util.mockito.capture
|
import com.android.systemui.util.mockito.capture
|
||||||
import com.android.systemui.util.mockito.eq
|
import com.android.systemui.util.mockito.eq
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -88,6 +89,12 @@ class AlarmTileTest : SysuiTestCase() {
|
|||||||
testableLooper.processAllMessages()
|
testableLooper.processAllMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testAvailable() {
|
fun testAvailable() {
|
||||||
assertThat(tile.isAvailable).isTrue()
|
assertThat(tile.isAvailable).isTrue()
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.android.systemui.statusbar.policy.BatteryController
|
|||||||
import com.android.systemui.util.settings.FakeSettings
|
import com.android.systemui.util.settings.FakeSettings
|
||||||
import com.android.systemui.util.settings.SecureSettings
|
import com.android.systemui.util.settings.SecureSettings
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Assert.assertEquals
|
import org.junit.Assert.assertEquals
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
@@ -103,6 +104,12 @@ class BatterySaverTileTest : SysuiTestCase() {
|
|||||||
testableLooper.processAllMessages()
|
testableLooper.processAllMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testSettingWithCorrectUser() {
|
fun testSettingWithCorrectUser() {
|
||||||
assertEquals(USER, tile.mSetting.currentUser)
|
assertEquals(USER, tile.mSetting.currentUser)
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ import com.android.systemui.qs.logging.QSLogger
|
|||||||
import com.android.systemui.qs.tileimpl.QSTileImpl
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
import com.android.systemui.statusbar.policy.BluetoothController
|
import com.android.systemui.statusbar.policy.BluetoothController
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -79,6 +80,12 @@ class BluetoothTileTest : SysuiTestCase() {
|
|||||||
testableLooper.processAllMessages()
|
testableLooper.processAllMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRestrictionChecked() {
|
fun testRestrictionChecked() {
|
||||||
tile.refreshState()
|
tile.refreshState()
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.android.systemui.qs.tileimpl.QSTileImpl
|
|||||||
import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController
|
import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -90,6 +91,12 @@ class CameraToggleTileTest : SysuiTestCase() {
|
|||||||
keyguardStateController)
|
keyguardStateController)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIcon_whenCameraAccessEnabled_isOnState() {
|
fun testIcon_whenCameraAccessEnabled_isOnState() {
|
||||||
val state = QSTile.BooleanState()
|
val state = QSTile.BooleanState()
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ import com.android.systemui.statusbar.policy.CastController.CastDevice;
|
|||||||
import com.android.systemui.statusbar.policy.HotspotController;
|
import com.android.systemui.statusbar.policy.HotspotController;
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -141,6 +142,12 @@ public class CastTileTest extends SysuiTestCase {
|
|||||||
mHotspotCallback = hotspotCallbackArgumentCaptor.getValue();
|
mHotspotCallback = hotspotCallbackArgumentCaptor.getValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mCastTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
// -------------------------------------------------
|
// -------------------------------------------------
|
||||||
// All these tests for enabled/disabled wifi have hotspot not enabled
|
// All these tests for enabled/disabled wifi have hotspot not enabled
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.android.systemui.settings.UserTracker;
|
|||||||
import com.android.systemui.util.settings.FakeSettings;
|
import com.android.systemui.util.settings.FakeSettings;
|
||||||
import com.android.systemui.util.settings.SecureSettings;
|
import com.android.systemui.util.settings.SecureSettings;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -101,6 +102,12 @@ public class ColorCorrectionTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void longClick_expectedAction() {
|
public void longClick_expectedAction() {
|
||||||
final ArgumentCaptor<Intent> IntentCaptor = ArgumentCaptor.forClass(Intent.class);
|
final ArgumentCaptor<Intent> IntentCaptor = ArgumentCaptor.forClass(Intent.class);
|
||||||
|
|||||||
@@ -46,6 +46,7 @@ import com.android.systemui.settings.UserTracker;
|
|||||||
import com.android.systemui.util.settings.FakeSettings;
|
import com.android.systemui.util.settings.FakeSettings;
|
||||||
import com.android.systemui.util.settings.SecureSettings;
|
import com.android.systemui.util.settings.SecureSettings;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -106,6 +107,12 @@ public class ColorInversionTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void longClick_expectedAction() {
|
public void longClick_expectedAction() {
|
||||||
final ArgumentCaptor<Intent> IntentCaptor = ArgumentCaptor.forClass(Intent.class);
|
final ArgumentCaptor<Intent> IntentCaptor = ArgumentCaptor.forClass(Intent.class);
|
||||||
|
|||||||
@@ -34,6 +34,7 @@ import com.android.systemui.qs.logging.QSLogger
|
|||||||
import com.android.systemui.qs.tileimpl.QSTileImpl
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
import com.android.systemui.statusbar.policy.DataSaverController
|
import com.android.systemui.statusbar.policy.DataSaverController
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -84,6 +85,12 @@ class DataSaverTileTest : SysuiTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIcon_whenDataSaverEnabled_isOnState() {
|
fun testIcon_whenDataSaverEnabled_isOnState() {
|
||||||
val state = QSTile.BooleanState()
|
val state = QSTile.BooleanState()
|
||||||
|
|||||||
@@ -67,6 +67,7 @@ import org.mockito.Mockito.spy
|
|||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.Mockito.verifyZeroInteractions
|
import org.mockito.Mockito.verifyZeroInteractions
|
||||||
import java.util.Optional
|
import java.util.Optional
|
||||||
|
import org.junit.After
|
||||||
|
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@RunWith(AndroidTestingRunner::class)
|
@RunWith(AndroidTestingRunner::class)
|
||||||
@@ -129,6 +130,12 @@ class DeviceControlsTileTest : SysuiTestCase() {
|
|||||||
tile = createTile()
|
tile = createTile()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
private fun setupControlsComponent() {
|
private fun setupControlsComponent() {
|
||||||
`when`(controlsComponent.getControlsController()).thenAnswer {
|
`when`(controlsComponent.getControlsController()).thenAnswer {
|
||||||
if (featureEnabled) {
|
if (featureEnabled) {
|
||||||
|
|||||||
@@ -136,7 +136,8 @@ class DndTileTest : SysuiTestCase() {
|
|||||||
|
|
||||||
@After
|
@After
|
||||||
fun tearDown() {
|
fun tearDown() {
|
||||||
tile.handleSetListening(false)
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ import com.android.systemui.settings.UserTracker;
|
|||||||
import com.android.systemui.util.settings.FakeSettings;
|
import com.android.systemui.util.settings.FakeSettings;
|
||||||
import com.android.systemui.util.settings.SecureSettings;
|
import com.android.systemui.util.settings.SecureSettings;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -112,6 +113,12 @@ public class DreamTileTest extends SysuiTestCase {
|
|||||||
mTile.initialize();
|
mTile.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotAvailable() throws RemoteException {
|
public void testNotAvailable() throws RemoteException {
|
||||||
// Should not be available if screensaver is disabled
|
// Should not be available if screensaver is disabled
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ import com.android.systemui.qs.logging.QSLogger
|
|||||||
import com.android.systemui.qs.tileimpl.QSTileImpl
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
import com.android.systemui.statusbar.policy.FlashlightController
|
import com.android.systemui.statusbar.policy.FlashlightController
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -71,6 +72,12 @@ class FlashlightTileTest : SysuiTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIcon_whenFlashlightEnabled_isOnState() {
|
fun testIcon_whenFlashlightEnabled_isOnState() {
|
||||||
Mockito.`when`(flashlightController.isAvailable).thenReturn(true)
|
Mockito.`when`(flashlightController.isAvailable).thenReturn(true)
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ import com.android.systemui.util.mockito.eq
|
|||||||
import com.android.systemui.util.mockito.nullable
|
import com.android.systemui.util.mockito.nullable
|
||||||
import com.android.systemui.util.settings.FakeSettings
|
import com.android.systemui.util.settings.FakeSettings
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -87,6 +88,12 @@ class FontScalingTileTest : SysuiTestCase() {
|
|||||||
testableLooper.processAllMessages()
|
testableLooper.processAllMessages()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
fontScalingTile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun isAvailable_whenFlagIsFalse_returnsFalse() {
|
fun isAvailable_whenFlagIsFalse_returnsFalse() {
|
||||||
featureFlags.set(Flags.ENABLE_FONT_SCALING_TILE, false)
|
featureFlags.set(Flags.ENABLE_FONT_SCALING_TILE, false)
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.android.systemui.qs.tileimpl.QSTileImpl;
|
|||||||
import com.android.systemui.statusbar.policy.DataSaverController;
|
import com.android.systemui.statusbar.policy.DataSaverController;
|
||||||
import com.android.systemui.statusbar.policy.HotspotController;
|
import com.android.systemui.statusbar.policy.HotspotController;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Rule;
|
import org.junit.Rule;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
@@ -94,6 +95,12 @@ public class HotspotTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void handleUpdateState_wifiTetheringIsAllowed_stateIsNotUnavailable() {
|
public void handleUpdateState_wifiTetheringIsAllowed_stateIsNotUnavailable() {
|
||||||
MockitoSession mockitoSession = ExtendedMockito.mockitoSession()
|
MockitoSession mockitoSession = ExtendedMockito.mockitoSession()
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.android.systemui.statusbar.connectivity.IconState;
|
|||||||
import com.android.systemui.statusbar.connectivity.NetworkController;
|
import com.android.systemui.statusbar.connectivity.NetworkController;
|
||||||
import com.android.systemui.statusbar.connectivity.WifiIndicators;
|
import com.android.systemui.statusbar.connectivity.WifiIndicators;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -91,6 +92,12 @@ public class InternetTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void setConnectivityStatus_defaultNetworkNotExists_updateTile() {
|
public void setConnectivityStatus_defaultNetworkNotExists_updateTile() {
|
||||||
mTile.mSignalCallback.setConnectivityStatus(
|
mTile.mSignalCallback.setConnectivityStatus(
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.android.systemui.qs.tileimpl.QSTileImpl
|
|||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
import com.android.systemui.statusbar.policy.LocationController
|
import com.android.systemui.statusbar.policy.LocationController
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -88,6 +89,12 @@ class LocationTileTest : SysuiTestCase() {
|
|||||||
keyguardStateController)
|
keyguardStateController)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIcon_whenDisabled_isOffState() {
|
fun testIcon_whenDisabled_isOffState() {
|
||||||
val state = QSTile.BooleanState()
|
val state = QSTile.BooleanState()
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ import com.android.systemui.qs.tileimpl.QSTileImpl
|
|||||||
import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController
|
import com.android.systemui.statusbar.policy.IndividualSensorPrivacyController
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController
|
import com.android.systemui.statusbar.policy.KeyguardStateController
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -90,6 +91,12 @@ class MicrophoneToggleTileTest : SysuiTestCase() {
|
|||||||
keyguardStateController)
|
keyguardStateController)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIcon_whenMicrophoneAccessEnabled_isOnState() {
|
fun testIcon_whenMicrophoneAccessEnabled_isOnState() {
|
||||||
val state = QSTile.BooleanState()
|
val state = QSTile.BooleanState()
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import com.android.systemui.plugins.statusbar.StatusBarStateController;
|
|||||||
import com.android.systemui.qs.QSHost;
|
import com.android.systemui.qs.QSHost;
|
||||||
import com.android.systemui.qs.logging.QSLogger;
|
import com.android.systemui.qs.logging.QSLogger;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -97,6 +98,12 @@ public class NfcTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mNfcTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsAvailable_stockWithoutNfc_returnsFalse() {
|
public void testIsAvailable_stockWithoutNfc_returnsFalse() {
|
||||||
when(mMockContext.getString(R.string.quick_settings_tiles_stock)).thenReturn(
|
when(mMockContext.getString(R.string.quick_settings_tiles_stock)).thenReturn(
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.android.systemui.qs.logging.QSLogger
|
|||||||
import com.android.systemui.qs.tileimpl.QSTileImpl
|
import com.android.systemui.qs.tileimpl.QSTileImpl
|
||||||
import com.android.systemui.statusbar.policy.LocationController
|
import com.android.systemui.statusbar.policy.LocationController
|
||||||
import com.google.common.truth.Truth
|
import com.google.common.truth.Truth
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -49,32 +50,23 @@ import org.mockito.MockitoAnnotations
|
|||||||
@TestableLooper.RunWithLooper(setAsMainLooper = true)
|
@TestableLooper.RunWithLooper(setAsMainLooper = true)
|
||||||
@SmallTest
|
@SmallTest
|
||||||
class NightDisplayTileTest : SysuiTestCase() {
|
class NightDisplayTileTest : SysuiTestCase() {
|
||||||
@Mock
|
@Mock private lateinit var mHost: QSHost
|
||||||
private lateinit var mHost: QSHost
|
|
||||||
|
|
||||||
@Mock
|
@Mock private lateinit var mMetricsLogger: MetricsLogger
|
||||||
private lateinit var mMetricsLogger: MetricsLogger
|
|
||||||
|
|
||||||
@Mock
|
@Mock private lateinit var mStatusBarStateController: StatusBarStateController
|
||||||
private lateinit var mStatusBarStateController: StatusBarStateController
|
|
||||||
|
|
||||||
@Mock
|
@Mock private lateinit var mActivityStarter: ActivityStarter
|
||||||
private lateinit var mActivityStarter: ActivityStarter
|
|
||||||
|
|
||||||
@Mock
|
@Mock private lateinit var mQsLogger: QSLogger
|
||||||
private lateinit var mQsLogger: QSLogger
|
|
||||||
|
|
||||||
@Mock
|
@Mock private lateinit var mLocationController: LocationController
|
||||||
private lateinit var mLocationController: LocationController
|
|
||||||
|
|
||||||
@Mock
|
@Mock private lateinit var mColorDisplayManager: ColorDisplayManager
|
||||||
private lateinit var mColorDisplayManager: ColorDisplayManager
|
|
||||||
|
|
||||||
@Mock
|
@Mock private lateinit var mNightDisplayListenerBuilder: NightDisplayListenerModule.Builder
|
||||||
private lateinit var mNightDisplayListenerBuilder: NightDisplayListenerModule.Builder
|
|
||||||
|
|
||||||
@Mock
|
@Mock private lateinit var mNightDisplayListener: NightDisplayListener
|
||||||
private lateinit var mNightDisplayListener: NightDisplayListener
|
|
||||||
|
|
||||||
private lateinit var mTestableLooper: TestableLooper
|
private lateinit var mTestableLooper: TestableLooper
|
||||||
private lateinit var mTile: NightDisplayTile
|
private lateinit var mTile: NightDisplayTile
|
||||||
@@ -88,12 +80,12 @@ class NightDisplayTileTest : SysuiTestCase() {
|
|||||||
whenever(mHost.context).thenReturn(mContext)
|
whenever(mHost.context).thenReturn(mContext)
|
||||||
whenever(mHost.uiEventLogger).thenReturn(mUiEventLogger)
|
whenever(mHost.uiEventLogger).thenReturn(mUiEventLogger)
|
||||||
whenever(mHost.userContext).thenReturn(mContext)
|
whenever(mHost.userContext).thenReturn(mContext)
|
||||||
whenever(mNightDisplayListenerBuilder.setUser(anyInt())).thenReturn(
|
whenever(mNightDisplayListenerBuilder.setUser(anyInt()))
|
||||||
mNightDisplayListenerBuilder
|
.thenReturn(mNightDisplayListenerBuilder)
|
||||||
)
|
|
||||||
whenever(mNightDisplayListenerBuilder.build()).thenReturn(mNightDisplayListener)
|
whenever(mNightDisplayListenerBuilder.build()).thenReturn(mNightDisplayListener)
|
||||||
|
|
||||||
mTile = NightDisplayTile(
|
mTile =
|
||||||
|
NightDisplayTile(
|
||||||
mHost,
|
mHost,
|
||||||
mTestableLooper.looper,
|
mTestableLooper.looper,
|
||||||
Handler(mTestableLooper.looper),
|
Handler(mTestableLooper.looper),
|
||||||
@@ -108,6 +100,12 @@ class NightDisplayTileTest : SysuiTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
mTile.destroy()
|
||||||
|
mTestableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIcon_whenDisabled_showsOffState() {
|
fun testIcon_whenDisabled_showsOffState() {
|
||||||
whenever(mColorDisplayManager.isNightDisplayActivated).thenReturn(false)
|
whenever(mColorDisplayManager.isNightDisplayActivated).thenReturn(false)
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ import com.android.systemui.qs.logging.QSLogger;
|
|||||||
import com.android.systemui.settings.UserTracker;
|
import com.android.systemui.settings.UserTracker;
|
||||||
import com.android.systemui.util.settings.SecureSettings;
|
import com.android.systemui.util.settings.SecureSettings;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -91,6 +92,12 @@ public class OneHandedModeTileTest extends SysuiTestCase {
|
|||||||
mTile.initialize();
|
mTile.initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testIsAvailable_unsupportOneHandedProperty_shouldReturnsFalse() {
|
public void testIsAvailable_unsupportOneHandedProperty_shouldReturnsFalse() {
|
||||||
when(mTile.isSupportOneHandedMode()).thenReturn(false);
|
when(mTile.isSupportOneHandedMode()).thenReturn(false);
|
||||||
|
|||||||
@@ -43,6 +43,7 @@ import com.android.systemui.qs.QSHost;
|
|||||||
import com.android.systemui.qs.logging.QSLogger;
|
import com.android.systemui.qs.logging.QSLogger;
|
||||||
import com.android.systemui.qs.tileimpl.QSTileImpl;
|
import com.android.systemui.qs.tileimpl.QSTileImpl;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -91,6 +92,12 @@ public class QRCodeScannerTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNewTile() {
|
public void testNewTile() {
|
||||||
assertFalse(mTile.newTileState().handlesLongClick);
|
assertFalse(mTile.newTileState().handlesLongClick);
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ import com.android.systemui.statusbar.policy.KeyguardStateController;
|
|||||||
import com.android.systemui.util.settings.SecureSettings;
|
import com.android.systemui.util.settings.SecureSettings;
|
||||||
import com.android.systemui.wallet.controller.QuickAccessWalletController;
|
import com.android.systemui.wallet.controller.QuickAccessWalletController;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -161,6 +162,12 @@ public class QuickAccessWalletTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNewTile() {
|
public void testNewTile() {
|
||||||
assertFalse(mTile.newTileState().handlesLongClick);
|
assertFalse(mTile.newTileState().handlesLongClick);
|
||||||
|
|||||||
@@ -44,8 +44,8 @@ import com.android.systemui.qs.logging.QSLogger;
|
|||||||
import com.android.systemui.qs.tileimpl.QSTileImpl;
|
import com.android.systemui.qs.tileimpl.QSTileImpl;
|
||||||
import com.android.systemui.settings.UserTracker;
|
import com.android.systemui.settings.UserTracker;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Ignore;
|
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.mockito.Mock;
|
import org.mockito.Mock;
|
||||||
@@ -54,7 +54,6 @@ import org.mockito.MockitoAnnotations;
|
|||||||
@RunWith(AndroidTestingRunner.class)
|
@RunWith(AndroidTestingRunner.class)
|
||||||
@TestableLooper.RunWithLooper(setAsMainLooper = true)
|
@TestableLooper.RunWithLooper(setAsMainLooper = true)
|
||||||
@SmallTest
|
@SmallTest
|
||||||
@Ignore("b/269171747")
|
|
||||||
public class ReduceBrightColorsTileTest extends SysuiTestCase {
|
public class ReduceBrightColorsTileTest extends SysuiTestCase {
|
||||||
@Mock
|
@Mock
|
||||||
private QSHost mHost;
|
private QSHost mHost;
|
||||||
@@ -99,6 +98,12 @@ public class ReduceBrightColorsTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testNotActive() {
|
public void testNotActive() {
|
||||||
when(mReduceBrightColorsController.isReduceBrightColorsActivated()).thenReturn(false);
|
when(mReduceBrightColorsController.isReduceBrightColorsActivated()).thenReturn(false);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ import com.android.systemui.statusbar.policy.RotationLockControllerImpl;
|
|||||||
import com.android.systemui.util.settings.FakeSettings;
|
import com.android.systemui.util.settings.FakeSettings;
|
||||||
import com.android.systemui.util.wrapper.RotationPolicyWrapper;
|
import com.android.systemui.util.wrapper.RotationPolicyWrapper;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -139,6 +140,12 @@ public class RotationLockTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mLockTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testSecondaryString_cameraRotateOn_returnsFaceBased() {
|
public void testSecondaryString_cameraRotateOn_returnsFaceBased() {
|
||||||
assertEquals(mContext.getString(R.string.rotation_lock_camera_rotation_on),
|
assertEquals(mContext.getString(R.string.rotation_lock_camera_rotation_on),
|
||||||
|
|||||||
@@ -50,6 +50,7 @@ import com.android.systemui.screenrecord.RecordingController;
|
|||||||
import com.android.systemui.statusbar.phone.KeyguardDismissUtil;
|
import com.android.systemui.statusbar.phone.KeyguardDismissUtil;
|
||||||
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
import com.android.systemui.statusbar.policy.KeyguardStateController;
|
||||||
|
|
||||||
|
import org.junit.After;
|
||||||
import org.junit.Before;
|
import org.junit.Before;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
@@ -114,6 +115,12 @@ public class ScreenRecordTileTest extends SysuiTestCase {
|
|||||||
mTestableLooper.processAllMessages();
|
mTestableLooper.processAllMessages();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
public void tearDown() {
|
||||||
|
mTile.destroy();
|
||||||
|
mTestableLooper.processAllMessages();
|
||||||
|
}
|
||||||
|
|
||||||
// Test that the tile is inactive and labeled correctly when the controller is neither starting
|
// Test that the tile is inactive and labeled correctly when the controller is neither starting
|
||||||
// or recording, and that clicking on the tile in this state brings up the record prompt
|
// or recording, and that clicking on the tile in this state brings up the record prompt
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ import com.android.systemui.statusbar.policy.BatteryController
|
|||||||
import com.android.systemui.statusbar.policy.ConfigurationController
|
import com.android.systemui.statusbar.policy.ConfigurationController
|
||||||
import com.android.systemui.statusbar.policy.LocationController
|
import com.android.systemui.statusbar.policy.LocationController
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
|
import org.junit.After
|
||||||
import org.junit.Before
|
import org.junit.Before
|
||||||
import org.junit.Test
|
import org.junit.Test
|
||||||
import org.junit.runner.RunWith
|
import org.junit.runner.RunWith
|
||||||
@@ -98,6 +99,12 @@ class UiModeNightTileTest : SysuiTestCase() {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@After
|
||||||
|
fun tearDown() {
|
||||||
|
tile.destroy()
|
||||||
|
testableLooper.processAllMessages()
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testIcon_whenNightModeOn_isOnState() {
|
fun testIcon_whenNightModeOn_isOnState() {
|
||||||
val state = QSTile.BooleanState()
|
val state = QSTile.BooleanState()
|
||||||
|
|||||||
Reference in New Issue
Block a user