1 /* 2 * Copyright (C) 2006 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 17 package android.app.activity; 18 19 import android.content.ComponentName; 20 import android.content.Intent; 21 import android.test.suitebuilder.annotation.MediumTest; 22 import android.test.suitebuilder.annotation.Suppress; 23 24 public class LifecycleTest extends ActivityTestsBase { 25 private Intent mTopIntent; 26 private Intent mTabIntent; 27 28 @Override 29 protected void setUp() throws Exception { 30 super.setUp(); 31 mTopIntent = mIntent; 32 mTabIntent = new Intent(mContext, LaunchpadTabActivity.class); 33 mTabIntent.putExtra("tab", new ComponentName(mContext, 34 LaunchpadActivity.class)); 35 } 36 37 @MediumTest 38 public void testBasic() throws Exception { 39 mIntent = mTopIntent; 40 runLaunchpad(LaunchpadActivity.LIFECYCLE_BASIC); 41 } 42 43 //Suppressing until 1285425 is fixed. 44 @Suppress 45 public void testTabBasic() throws Exception { 46 mIntent = mTabIntent; 47 runLaunchpad(LaunchpadActivity.LIFECYCLE_BASIC); 48 } 49 50 //Marking flaky until bug 1164344 is fixed. 51 // @FlakyTest(tolerance=2) 52 // @LargeTest 53 public void testScreen() throws Exception { 54 mIntent = mTopIntent; 55 runLaunchpad(LaunchpadActivity.LIFECYCLE_SCREEN); 56 } 57 58 //Marking flaky until bug 1164344 is fixed. 59 //@FlakyTest(tolerance=2) 60 //Suppressing until 1285425 is fixed. 61 @Suppress 62 public void testTabScreen() throws Exception { 63 mIntent = mTabIntent; 64 runLaunchpad(LaunchpadActivity.LIFECYCLE_SCREEN); 65 } 66 67 //flaky test, removing from large suite until 1866891 is fixed 68 //@LargeTest 69 public void testDialog() throws Exception { 70 mIntent = mTopIntent; 71 runLaunchpad(LaunchpadActivity.LIFECYCLE_DIALOG); 72 } 73 74 //Suppressing until 1285425 is fixed. 75 @Suppress 76 public void testTabDialog() throws Exception { 77 mIntent = mTabIntent; 78 runLaunchpad(LaunchpadActivity.LIFECYCLE_DIALOG); 79 } 80 81 @MediumTest 82 public void testFinishCreate() throws Exception { 83 mIntent = mTopIntent; 84 runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_CREATE); 85 } 86 87 //Suppressing until 1285425 is fixed. 88 @Suppress 89 public void testTabFinishCreate() throws Exception { 90 mIntent = mTabIntent; 91 runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_CREATE); 92 } 93 94 @MediumTest 95 public void testFinishStart() throws Exception { 96 mIntent = mTopIntent; 97 runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_START); 98 } 99 100 //Suppressing until 1285425 is fixed. 101 @Suppress 102 public void testTabFinishStart() throws Exception { 103 mIntent = mTabIntent; 104 runLaunchpad(LaunchpadActivity.LIFECYCLE_FINISH_START); 105 } 106 } 107