From 38d5e424418547f204df038e322e5737539fcbf3 Mon Sep 17 00:00:00 2001 From: Jiaming Liu Date: Mon, 28 Nov 2022 19:53:32 +0000 Subject: [PATCH] Fix DeviceStateProviderImplTest create_invalidSensor After ag/20514286, the DeviceStateProvider no longer reports state if the sensor values do not match the declared states. For the invalid sensor config test, the onStateChanged() will not be called because the sensor config is invalid. (I thought presubmit would run all the tests, so I didn't run them locally when submitting ag/20514286.) Fix: 260572046 Test: atest FrameworksServicesTests:com.android.server.policy.DeviceStateProviderImplTest Change-Id: Ic7aa004747fa940aa3445ed537dd76ee00c72553 --- .../android/server/policy/DeviceStateProviderImplTest.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/services/tests/servicestests/src/com/android/server/policy/DeviceStateProviderImplTest.java b/services/tests/servicestests/src/com/android/server/policy/DeviceStateProviderImplTest.java index 6d2631ac3ad44..f28986629c1c4 100644 --- a/services/tests/servicestests/src/com/android/server/policy/DeviceStateProviderImplTest.java +++ b/services/tests/servicestests/src/com/android/server/policy/DeviceStateProviderImplTest.java @@ -456,9 +456,8 @@ public final class DeviceStateProviderImplTest { new DeviceState(1, "CLOSED", 0 /* flags */), new DeviceState(2, "HALF_OPENED", 0 /* flags */) }, mDeviceStateArrayCaptor.getValue()); - // onStateChanged() should be called because the provider could not find the sensor. - verify(listener).onStateChanged(mIntegerCaptor.capture()); - assertEquals(1, mIntegerCaptor.getValue().intValue()); + // onStateChanged() should not be called because the provider could not find the sensor. + verify(listener, never()).onStateChanged(mIntegerCaptor.capture()); } private static Sensor newSensor(String name, String type) throws Exception {