• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2015 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.compatibility.tradefed;
17 
18 import com.android.compatibility.common.tradefed.build.CompatibilityBuildHelper;
19 import com.android.compatibility.common.tradefed.build.CompatibilityBuildProvider;
20 import com.android.tradefed.build.IBuildInfo;
21 import com.android.tradefed.util.FileUtil;
22 
23 import junit.framework.TestCase;
24 
25 import java.io.File;
26 
27 /**
28  * Tests for cts-tradefed.
29  */
30 public class CtsTradefedTest extends TestCase {
31 
32     private static final String PROPERTY_NAME = "CTS_ROOT";
33     private static final String SUITE_FULL_NAME = "Compatibility Test Suite";
34     private static final String SUITE_NAME = "CTS";
35     private static final String SUITE_PLAN = "cts";
36     private static final String DYNAMIC_CONFIG_URL = "";
37     private static final long START_TIME = 123456L;
38 
testSuiteInfoLoad()39     public void testSuiteInfoLoad() throws Exception {
40         // Test the values in the manifest can be loaded
41         File root = FileUtil.createTempDir("root");
42         System.setProperty(PROPERTY_NAME, root.getAbsolutePath());
43         File base = new File(root, "android-cts");
44         base.mkdirs();
45         File tests = new File(base, "testcases");
46         tests.mkdirs();
47         CompatibilityBuildProvider provider = new CompatibilityBuildProvider();
48         IBuildInfo info = provider.getBuild();
49         CompatibilityBuildHelper helper = new CompatibilityBuildHelper(info);
50         helper.init(SUITE_PLAN, DYNAMIC_CONFIG_URL, START_TIME);
51         assertEquals("Incorrect suite full name", SUITE_FULL_NAME, helper.getSuiteFullName());
52         assertEquals("Incorrect suite name", SUITE_NAME, helper.getSuiteName());
53         FileUtil.recursiveDelete(root);
54         System.clearProperty(PROPERTY_NAME);
55     }
56 }
57