From 4ab4ff8becdcad802a8d7c4c59c45a1ab59a6ad9 Mon Sep 17 00:00:00 2001 From: Daniel Nishi Date: Thu, 25 May 2017 15:34:03 -0700 Subject: [PATCH] Fix a flaky test. If a test with an initialized fake factory was run before this test, it passed. If it runs first, though, it would flake. By initializing the fake factory in the test, it shouldn't flake anymore. Change-Id: I3ecb7477b6b29d093059f01d5dc0124690fb15b3 Fixes: 62103876 Test: Robotests pass --- .../AutomaticStorageManagerSwitchBarControllerTest.java | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java b/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java index be04eecefc8..1bc859f2679 100644 --- a/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java +++ b/tests/robotests/src/com/android/settings/deletionhelper/AutomaticStorageManagerSwitchBarControllerTest.java @@ -71,6 +71,7 @@ public class AutomaticStorageManagerSwitchBarControllerTest { mSwitchBar = new SwitchBar(mContext); Context fakeContextForFakeProvider = mock(Context.class, RETURNS_DEEP_STUBS); + FakeFeatureFactory.setupForTest(fakeContextForFakeProvider); FeatureFactory featureFactory = FakeFeatureFactory.getFactory(fakeContextForFakeProvider); mMetricsFeatureProvider = featureFactory.getMetricsFeatureProvider(); mPreference = new Preference(mContext);