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.test.suitebuilder.annotation.Suppress; 20 import android.content.ComponentName; 21 22 @Suppress 23 public class SubActivityTest extends ActivityTestsBase { 24 25 public void testPendingResult() throws Exception { 26 mIntent.putExtra("component", new ComponentName(getContext(), SubActivityScreen.class)); 27 mIntent.putExtra("mode", SubActivityScreen.PENDING_RESULT_MODE); 28 runLaunchpad(LaunchpadActivity.LAUNCH); 29 } 30 31 public void testNoResult() throws Exception { 32 mIntent.putExtra("component", new ComponentName(getContext(), SubActivityScreen.class)); 33 mIntent.putExtra("mode", SubActivityScreen.NO_RESULT_MODE); 34 runLaunchpad(LaunchpadActivity.LAUNCH); 35 } 36 37 public void testResult() throws Exception { 38 mIntent.putExtra("component", new ComponentName(getContext(), SubActivityScreen.class)); 39 mIntent.putExtra("mode", SubActivityScreen.RESULT_MODE); 40 runLaunchpad(LaunchpadActivity.LAUNCH); 41 } 42 43 public void testFinishSub() throws Exception { 44 mIntent.putExtra("component", 45 new ComponentName(getContext(), RemoteSubActivityScreen.class)); 46 mIntent.putExtra("mode", SubActivityScreen.FINISH_SUB_MODE); 47 runLaunchpad(LaunchpadActivity.LAUNCH); 48 } 49 50 public void testRemoteNoResult() throws Exception { 51 mIntent.putExtra("component", 52 new ComponentName(getContext(), RemoteSubActivityScreen.class)); 53 mIntent.putExtra("mode", SubActivityScreen.NO_RESULT_MODE); 54 runLaunchpad(LaunchpadActivity.LAUNCH); 55 } 56 57 public void testRemoteResult() throws Exception { 58 mIntent.putExtra("component", 59 new ComponentName(getContext(), RemoteSubActivityScreen.class)); 60 mIntent.putExtra("mode", SubActivityScreen.RESULT_MODE); 61 runLaunchpad(LaunchpadActivity.LAUNCH); 62 } 63 64 public void testRemoteFinishSub() throws Exception { 65 mIntent.putExtra("component", new ComponentName(getContext(), SubActivityScreen.class)); 66 mIntent.putExtra("mode", SubActivityScreen.FINISH_SUB_MODE); 67 runLaunchpad(LaunchpadActivity.LAUNCH); 68 } 69 70 public void testRemoteRestartNoResult() throws Exception { 71 mIntent.putExtra("component", 72 new ComponentName(getContext(), RemoteSubActivityScreen.class)); 73 mIntent.putExtra("mode", SubActivityScreen.NO_RESULT_MODE); 74 mIntent.putExtra("kill", true); 75 runLaunchpad(LaunchpadActivity.LAUNCH); 76 } 77 78 public void testRemoteRestartResult() throws Exception { 79 mIntent.putExtra("component", 80 new ComponentName(getContext(), RemoteSubActivityScreen.class)); 81 mIntent.putExtra("mode", SubActivityScreen.RESULT_MODE); 82 mIntent.putExtra("kill", true); 83 runLaunchpad(LaunchpadActivity.LAUNCH); 84 } 85 86 public void testRemoteRestartFinishSub() throws Exception { 87 mIntent.putExtra("component", new ComponentName(getContext(), SubActivityScreen.class)); 88 mIntent.putExtra("mode", SubActivityScreen.FINISH_SUB_MODE); 89 mIntent.putExtra("kill", true); 90 runLaunchpad(LaunchpadActivity.LAUNCH); 91 } 92 } 93