Loading src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -51,13 +51,13 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { private final CategoryManager mCategoryManager; public DashboardFeatureProviderImpl(Context context) { mContext = context; mContext = context.getApplicationContext(); mCategoryManager = CategoryManager.get(context, getExtraIntentAction()); } @VisibleForTesting DashboardFeatureProviderImpl(Context context, CategoryManager categoryManager) { mContext = context; mContext = context.getApplicationContext(); mCategoryManager = categoryManager; } Loading tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java +10 −2 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ import org.robolectric.shadows.ShadowApplication; import java.util.ArrayList; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; Loading @@ -74,6 +76,11 @@ public class DashboardFeatureProviderImplTest { mImpl = new DashboardFeatureProviderImpl(mActivity); } @Test public void shouldHoldAppContext() { assertThat(mImpl.mContext).isEqualTo(mActivity.getApplicationContext()); } @Test public void bindPreference_shouldBindAllData() { final Preference preference = new Preference( Loading Loading @@ -234,7 +241,8 @@ public class DashboardFeatureProviderImplTest { when(mSpy.isEnabled()).thenReturn(true); final DashboardCategory category = new DashboardCategory(); category.tiles.add(new Tile()); when(mCategoryManager.getTilesByCategory(mActivity, CategoryKey.CATEGORY_HOMEPAGE)) when(mCategoryManager .getTilesByCategory(any(Context.class), eq(CategoryKey.CATEGORY_HOMEPAGE))) .thenReturn(category); assertThat(mSpy.getPreferencesForCategory(mActivity, Loading Loading
src/com/android/settings/dashboard/DashboardFeatureProviderImpl.java +2 −2 Original line number Diff line number Diff line Loading @@ -51,13 +51,13 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider { private final CategoryManager mCategoryManager; public DashboardFeatureProviderImpl(Context context) { mContext = context; mContext = context.getApplicationContext(); mCategoryManager = CategoryManager.get(context, getExtraIntentAction()); } @VisibleForTesting DashboardFeatureProviderImpl(Context context, CategoryManager categoryManager) { mContext = context; mContext = context.getApplicationContext(); mCategoryManager = categoryManager; } Loading
tests/robotests/src/com/android/settings/dashboard/DashboardFeatureProviderImplTest.java +10 −2 Original line number Diff line number Diff line Loading @@ -49,6 +49,8 @@ import org.robolectric.shadows.ShadowApplication; import java.util.ArrayList; import static com.google.common.truth.Truth.assertThat; import static org.mockito.Matchers.any; import static org.mockito.Matchers.eq; import static org.mockito.Mockito.mock; import static org.mockito.Mockito.spy; import static org.mockito.Mockito.verify; Loading @@ -74,6 +76,11 @@ public class DashboardFeatureProviderImplTest { mImpl = new DashboardFeatureProviderImpl(mActivity); } @Test public void shouldHoldAppContext() { assertThat(mImpl.mContext).isEqualTo(mActivity.getApplicationContext()); } @Test public void bindPreference_shouldBindAllData() { final Preference preference = new Preference( Loading Loading @@ -234,7 +241,8 @@ public class DashboardFeatureProviderImplTest { when(mSpy.isEnabled()).thenReturn(true); final DashboardCategory category = new DashboardCategory(); category.tiles.add(new Tile()); when(mCategoryManager.getTilesByCategory(mActivity, CategoryKey.CATEGORY_HOMEPAGE)) when(mCategoryManager .getTilesByCategory(any(Context.class), eq(CategoryKey.CATEGORY_HOMEPAGE))) .thenReturn(category); assertThat(mSpy.getPreferencesForCategory(mActivity, Loading