• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2014 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 com.android.cts.verifier.sensors.base;
18 
19 import junit.framework.Test;
20 import junit.framework.TestResult;
21 import junit.framework.TestSuite;
22 
23 import android.content.Context;
24 
25 import java.util.Enumeration;
26 
27 /**
28  * A wrapper class for a {@link TestSuite}.
29  *
30  * It provides a way to inject a {@link SensorCtsTestResult} during execution.
31  */
32 class SensorCtsTestSuite extends TestSuite {
33     private final Context mContext;
34     private final TestSuite mWrappedTestSuite;
35 
SensorCtsTestSuite(Context context, TestSuite testSuite)36     public SensorCtsTestSuite(Context context, TestSuite testSuite) {
37         mContext = context;
38         mWrappedTestSuite = testSuite;
39     }
40 
41     @Override
run(TestResult testResult)42     public void run(TestResult testResult) {
43         mWrappedTestSuite.run(new SensorCtsTestResult(mContext, testResult));
44     }
45 
46     @Override
addTest(Test test)47     public void addTest(Test test) {
48         mWrappedTestSuite.addTest(test);
49     }
50 
51     @Override
countTestCases()52     public int countTestCases() {
53         return mWrappedTestSuite.countTestCases();
54     }
55 
56     @Override
getName()57     public String getName() {
58         return mWrappedTestSuite.getName();
59     }
60 
61     @Override
runTest(Test test, TestResult testResult)62     public void runTest(Test test, TestResult testResult) {
63         mWrappedTestSuite.runTest(test, testResult);
64     }
65 
66     @Override
setName(String name)67     public void setName(String name) {
68         mWrappedTestSuite.setName(name);
69     }
70 
71     @Override
testAt(int index)72     public Test testAt(int index) {
73         return mWrappedTestSuite.testAt(index);
74     }
75 
76     @Override
testCount()77     public int testCount() {
78         return mWrappedTestSuite.testCount();
79     }
80 
81     @Override
tests()82     public Enumeration<Test> tests() {
83         return mWrappedTestSuite.tests();
84     }
85 
86     @Override
toString()87     public String toString() {
88         return mWrappedTestSuite.toString();
89     }
90 }
91