diff options
author | Yorke Lee <yorkelee@google.com> | 2015-10-27 17:43:38 +0000 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2015-10-27 22:04:21 +0000 |
commit | 9ce5286ab3644733339ff739bf15f8ce36e41524 (patch) | |
tree | 17ef53f0aa4188fff3215cc124314293813311e1 /tests/src/com/android | |
parent | 996cb6f52901ab9e67354978f7f04e677600ee9f (diff) |
Remove onboarding flow
Straight revert of all onboarding flow related CLs -
the onboarding flow is not needed for now as the Dialer
will always at least be the system dialer.
Bug: 25020847
Change-Id: Ic1c5020b9b423de50801485f764209b21d5d7f33
Diffstat (limited to 'tests/src/com/android')
3 files changed, 0 insertions, 311 deletions
diff --git a/tests/src/com/android/dialer/onboard/DefaultDialerOnboardScreenTest.java b/tests/src/com/android/dialer/onboard/DefaultDialerOnboardScreenTest.java deleted file mode 100644 index 5e6544f4a..000000000 --- a/tests/src/com/android/dialer/onboard/DefaultDialerOnboardScreenTest.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.dialer.onboard; - -import static org.mockito.Mockito.when; - -import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; - -import com.android.dialer.onboard.OnboardingActivity.DefaultDialerOnboardingScreen; - -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -@SmallTest -public class DefaultDialerOnboardScreenTest extends AndroidTestCase { - private DefaultDialerOnboardingScreen mScreen; - @Mock private PermissionsChecker mPermissionsChecker; - - @Override - protected void setUp() throws Exception { - super.setUp(); - MockitoAnnotations.initMocks(this); - mScreen = new DefaultDialerOnboardingScreen(mPermissionsChecker); - } - - public void testNeverRequestedForDefaultDialer_shouldShowScreen() { - when(mPermissionsChecker.hasAlreadyRequestedDefaultDialer()).thenReturn(false); - assertTrue(mScreen.shouldShowScreen()); - } - - public void testAlreadyAskedForDefaultDialer_shouldNotShowScreen() { - when(mPermissionsChecker.hasAlreadyRequestedDefaultDialer()).thenReturn(true); - assertFalse(mScreen.shouldShowScreen()); - } - - public void testAlreadySetAsDefaultDialer_shouldNotShowScreen() { - when(mPermissionsChecker.hasAlreadyRequestedDefaultDialer()).thenReturn(false); - when(mPermissionsChecker.isDefaultOrSystemDialer()).thenReturn(true); - assertFalse(mScreen.shouldShowScreen()); - } - - public void testCanSkipScreen() { - assertTrue(mScreen.canSkipScreen()); - } -} diff --git a/tests/src/com/android/dialer/onboard/OnboardingControllerTest.java b/tests/src/com/android/dialer/onboard/OnboardingControllerTest.java deleted file mode 100644 index d6348553f..000000000 --- a/tests/src/com/android/dialer/onboard/OnboardingControllerTest.java +++ /dev/null @@ -1,185 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.dialer.onboard; - -import android.app.Activity; -import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; -import android.test.suitebuilder.annotation.Suppress; - -@SmallTest -public class OnboardingControllerTest extends AndroidTestCase { - private MockOnboardUi mOnboardUi; - private OnboardingController mController; - - public class MockOnboardUi implements OnboardingController.OnboardingUi { - public int currentScreen = -1; - public boolean completedOnboardingFlow = false; - - @Override - public void showScreen(int screenId) { - currentScreen = screenId; - } - - @Override - public void completeOnboardingFlow() { - completedOnboardingFlow = true; - } - } - - public class MockScreen extends OnboardingController.OnboardingScreen { - boolean shouldShowScreen; - boolean canSkipScreen; - - public MockScreen(boolean shouldShowScreen, boolean canSkipScreen) { - this.shouldShowScreen = shouldShowScreen; - this.canSkipScreen = canSkipScreen; - } - - @Override - public boolean shouldShowScreen() { - return shouldShowScreen; - } - - @Override - public boolean canSkipScreen() { - return canSkipScreen; - } - - @Override - public void onNextClicked(Activity activity) { - } - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - mOnboardUi = new MockOnboardUi(); - mController = new OnboardingController(mOnboardUi); - } - - @Suppress - public void testNoScreensToDisplay_OnboardingFlowImmediatelyCompleted() { - mController.showNextScreen(); - assertEquals(-1, mOnboardUi.currentScreen); - assertTrue(mOnboardUi.completedOnboardingFlow); - } - - @Suppress - public void testSkipAllScreens_OnboardingFlowImmediatelyCompleted() { - mController.addScreen(new MockScreen(false /* shouldShowScreen */, - true /* canSkipScreen */)); - mController.addScreen(new MockScreen(false /* shouldShowScreen */, - true /* canSkipScreen */)); - mController.addScreen(new MockScreen(false /* shouldShowScreen */, - true /* canSkipScreen */)); - mController.showNextScreen(); - assertEquals(-1, mOnboardUi.currentScreen); - assertTrue(mOnboardUi.completedOnboardingFlow); - } - - @Suppress - public void testFirstScreenNotNeeded_ShowsSecondScreen() { - mController.addScreen(new MockScreen(false /* shouldShowScreen */, - false /* canSkipScreen */)); - mController.addScreen(new MockScreen(true /* shouldShowScreen */, - false /* canSkipScreen */)); - mController.showNextScreen(); - assertEquals(1, mOnboardUi.currentScreen); - } - - @Suppress - public void testScreenRequired() { - final MockScreen mockScreen = - new MockScreen(true /* shouldShowScreen */, false /* canSkipScreen */); - mController.addScreen(mockScreen); - - mController.showNextScreen(); - assertEquals(0, mOnboardUi.currentScreen); - assertFalse(mOnboardUi.completedOnboardingFlow); - - // User tried to skip an unskippable screen - mController.onScreenResult(0, false); - assertEquals(0, mOnboardUi.currentScreen); - assertFalse(mOnboardUi.completedOnboardingFlow); - - // User said yes, but the underlying requirements have not been fulfilled yet, so don't - // show the next screen. Should be very rare in practice. - mController.onScreenResult(0, true); - assertEquals(0, mOnboardUi.currentScreen); - assertFalse(mOnboardUi.completedOnboardingFlow); - - // Requirement has been fulfiled. - mockScreen.shouldShowScreen = false; - mController.onScreenResult(0, true); - assertTrue(mOnboardUi.completedOnboardingFlow); - } - - /** - * Verifies the use case where completing the first screen will provide the necessary conditions - * to skip the second screen as well. - * - * For example, setting the default dialer in the first screen will automatically grant - * permissions such that the second permissions screen is no longer needed. - */ - @Suppress - public void testFirstScreenCompleted_SkipsSecondScreen() { - final MockScreen mockScreen1 = - new MockScreen(true /* shouldShowScreen */, true /* canSkipScreen */); - final MockScreen mockScreen2 = - new MockScreen(true /* shouldShowScreen */, false /* canSkipScreen */); - mController.addScreen(mockScreen1); - mController.addScreen(mockScreen2); - - mController.showNextScreen(); - assertEquals(0, mOnboardUi.currentScreen); - assertFalse(mOnboardUi.completedOnboardingFlow); - - // Screen 1 succeeded, screen 2 is no longer necessary - mockScreen2.shouldShowScreen = false; - mController.onScreenResult(0, true); - assertEquals(0, mOnboardUi.currentScreen); - assertTrue(mOnboardUi.completedOnboardingFlow); - } - - /** - * Verifies the use case where skipping the first screen will proceed to show the second screen - * since the necessary conditions to skip the second screen have not been met. - */ - @Suppress - public void testFirstScreenSkipped_ShowsSecondScreen() { - final MockScreen mockScreen1 = - new MockScreen(true /* shouldShowScreen */, true /* canSkipScreen */); - final MockScreen mockScreen2 = - new MockScreen(true /* shouldShowScreen */, false /* canSkipScreen */); - mController.addScreen(mockScreen1); - mController.addScreen(mockScreen2); - - mController.showNextScreen(); - assertEquals(0, mOnboardUi.currentScreen); - assertFalse(mOnboardUi.completedOnboardingFlow); - - // Screen 1 skipped - mController.onScreenResult(0, false); - assertEquals(1, mOnboardUi.currentScreen); - assertFalse(mOnboardUi.completedOnboardingFlow); - - // Repeatedly trying to skip screen 2 will not work since it is marked as unskippable. - mController.onScreenResult(1, false); - assertEquals(1, mOnboardUi.currentScreen); - assertFalse(mOnboardUi.completedOnboardingFlow); - } -} diff --git a/tests/src/com/android/dialer/onboard/PermissionsOnboardScreenTest.java b/tests/src/com/android/dialer/onboard/PermissionsOnboardScreenTest.java deleted file mode 100644 index 4c5ea33b8..000000000 --- a/tests/src/com/android/dialer/onboard/PermissionsOnboardScreenTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2015 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.android.dialer.onboard; - -import static org.mockito.Mockito.when; - -import android.test.AndroidTestCase; -import android.test.suitebuilder.annotation.SmallTest; - -import com.android.dialer.onboard.OnboardingActivity.PermissionsOnboardingScreen; - -import org.mockito.Mock; -import org.mockito.MockitoAnnotations; - -@SmallTest -public class PermissionsOnboardScreenTest extends AndroidTestCase { - private PermissionsOnboardingScreen mScreen; - @Mock private PermissionsChecker mPermissionsChecker; - - @Override - protected void setUp() throws Exception { - super.setUp(); - MockitoAnnotations.initMocks(this); - mScreen = new PermissionsOnboardingScreen(mPermissionsChecker); - } - - public void testMissingContactsAndPhonePermissions_shouldShowScreen() { - when(mPermissionsChecker.hasContactsPermissions()).thenReturn(false); - when(mPermissionsChecker.hasPhonePermissions()).thenReturn(false); - assertTrue(mScreen.shouldShowScreen()); - } - - public void testMissingContactsPermission_shouldShowScreen() { - when(mPermissionsChecker.hasContactsPermissions()).thenReturn(false); - when(mPermissionsChecker.hasPhonePermissions()).thenReturn(true); - assertTrue(mScreen.shouldShowScreen()); - } - - public void testMissingPhonePermission_shouldShowScreen() { - when(mPermissionsChecker.hasContactsPermissions()).thenReturn(true); - when(mPermissionsChecker.hasPhonePermissions()).thenReturn(false); - assertTrue(mScreen.shouldShowScreen()); - } - - public void testHasAllPermissions_shouldNotShowScreen() { - when(mPermissionsChecker.hasContactsPermissions()).thenReturn(true); - when(mPermissionsChecker.hasPhonePermissions()).thenReturn(true); - assertFalse(mScreen.shouldShowScreen()); - } - - public void testCanSkipScreen() { - assertFalse(mScreen.canSkipScreen()); - } -} |