1 /* 2 * Copyright (C) 2023 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 package com.android.launcher3.allapps; 17 18 import static org.junit.Assert.assertNotNull; 19 import static org.junit.Assert.assertTrue; 20 21 import com.android.launcher3.Launcher; 22 import com.android.launcher3.LauncherState; 23 import com.android.launcher3.tapl.AppIcon; 24 import com.android.launcher3.tapl.HomeAllApps; 25 import com.android.launcher3.ui.AbstractLauncherUiTest; 26 import com.android.launcher3.ui.PortraitLandscapeRunner.PortraitLandscape; 27 28 import org.junit.Test; 29 30 /** 31 * The test runs in Out of process (Oop) and in process. 32 * Makes sure the basic behaviors of Icons on AllApps are working. 33 */ 34 public class TaplAllAppsIconsWorkingTest extends AbstractLauncherUiTest<Launcher> { 35 36 /** 37 * Makes sure we can launch an icon from All apps 38 */ 39 @Test 40 @PortraitLandscape testAppIconLaunchFromAllAppsFromHome()41 public void testAppIconLaunchFromAllAppsFromHome() { 42 final HomeAllApps allApps = mLauncher.getWorkspace().switchToAllApps(); 43 assertTrue("Launcher internal state is not All Apps", 44 isInState(() -> LauncherState.ALL_APPS)); 45 46 allApps.freeze(); 47 try { 48 final AppIcon app = allApps.getAppIcon("TestActivity7"); 49 assertNotNull("AppIcon.launch returned null", app.launch(getAppPackageName())); 50 executeOnLauncher(launcher -> assertTrue( 51 "Launcher activity is the top activity; expecting another activity to be the " 52 + "top one", 53 isInLaunchedApp(launcher))); 54 } finally { 55 allApps.unfreeze(); 56 } 57 mLauncher.goHome(); 58 } 59 } 60