Home | History | Annotate | Download | only in cts
      1 /*
      2  * Copyright (C) 2018 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 android.app.cts;
     17 
     18 import static android.content.Intent.ACTION_MAIN;
     19 
     20 import android.app.ActivityManager;
     21 import android.app.TaskInfo;
     22 import android.content.ComponentName;
     23 import android.content.Intent;
     24 
     25 import static org.junit.Assert.assertEquals;
     26 import static org.junit.Assert.assertTrue;
     27 
     28 public class ActivityManagerBaseTaskInfoTest {
     29 
     30     protected void fillTaskInfo(TaskInfo taskInfo) {
     31         taskInfo.taskId = Integer.MAX_VALUE;
     32         taskInfo.isRunning = true;
     33         taskInfo.baseIntent = new Intent(ACTION_MAIN);
     34         ComponentName cn = new ComponentName("android.app.cts",
     35                 ActivityManagerBaseTaskInfoTest.class.getSimpleName());
     36         taskInfo.baseActivity = cn.clone();
     37         taskInfo.topActivity = cn.clone();
     38         taskInfo.origActivity = cn.clone();
     39         taskInfo.numActivities = Integer.MAX_VALUE;
     40         taskInfo.taskDescription = new ActivityManager.TaskDescription("Test");
     41     }
     42 
     43     protected void verifyTaskInfo(TaskInfo taskInfo, TaskInfo sourceTaskInfo) {
     44         assertEquals(sourceTaskInfo.taskId, taskInfo.taskId);
     45 
     46         assertEquals(sourceTaskInfo.isRunning, taskInfo.isRunning);
     47         assertTrue(sourceTaskInfo.baseIntent.filterEquals(taskInfo.baseIntent));
     48         assertEquals(sourceTaskInfo.baseActivity, taskInfo.baseActivity);
     49         assertEquals(sourceTaskInfo.topActivity, taskInfo.topActivity);
     50         assertEquals(sourceTaskInfo.origActivity, taskInfo.origActivity);
     51         assertEquals(sourceTaskInfo.numActivities, taskInfo.numActivities);
     52         assertEquals(sourceTaskInfo.taskDescription.getLabel(),
     53                 taskInfo.taskDescription.getLabel());
     54     }
     55 }
     56