From 25e8b7fcca3c86e857ac8ac3e054f4f2a67714ab Mon Sep 17 00:00:00 2001 From: Riddle Hsu Date: Thu, 3 Oct 2019 21:41:00 +0800 Subject: [PATCH] Clear fake settings provider after the last test The SettingsProvider may keep the testing values in cache that may affect other tests. Bug: 142046583 Test: atest DisplayRotationTests Change-Id: Iebc77bcac9a2e48b80209fd1e8f559bac483fb3d --- .../src/com/android/server/wm/DisplayRotationTests.java | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java b/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java index bd17bf26d70d1..480c4681de0c1 100644 --- a/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java +++ b/services/tests/wmtests/src/com/android/server/wm/DisplayRotationTests.java @@ -68,6 +68,7 @@ import com.android.server.statusbar.StatusBarManagerInternal; import com.android.server.wm.utils.WmDisplayCutout; import org.junit.After; +import org.junit.AfterClass; import org.junit.Before; import org.junit.BeforeClass; import org.junit.Test; @@ -122,6 +123,12 @@ public class DisplayRotationTests { sMockWm.mPolicy = mock(WindowManagerPolicy.class); } + @AfterClass + public static void tearDownOnce() { + // Make sure the fake settings are cleared after the last test method. + FakeSettingsProvider.clearSettingsProvider(); + } + @Before public void setUp() { FakeSettingsProvider.clearSettingsProvider();