1 /*
2  * Copyright (C) 2012 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.p2p.testcase;
18 
19 import java.util.ArrayList;
20 
21 import android.content.Context;
22 
23 /**
24  * Test suite for go negotiation requester.
25  */
26 public class GoNegReqTestSuite {
27 
28     private static ArrayList<ReqTestCase> sTestSuite = null;
29 
30     /**
31      * Return test suite.
32      * @param context
33      * @return
34      */
getTestSuite(Context context)35     public static ArrayList<ReqTestCase> getTestSuite(Context context) {
36         initialize(context);
37         return sTestSuite;
38     }
39 
40     /**
41      * Return the specified test case.
42      * @param context
43      * @param testId
44      * @return
45      */
getTestCase(Context context, String testId)46     public static ReqTestCase getTestCase(Context context,
47             String testId) {
48         initialize(context);
49 
50         for (ReqTestCase test: sTestSuite) {
51             if (test.getTestId().equals(testId)) {
52                 return test;
53             }
54         }
55         return null;
56     }
57 
initialize(Context context)58     private static void initialize(Context context) {
59         if (sTestSuite != null) {
60             return;
61         }
62 
63         sTestSuite = new ArrayList<ReqTestCase>();
64         sTestSuite.add(new GoNegReqPbcTestCase(context));
65         sTestSuite.add(new GoNegReqPinTestCase(context));
66     }
67 }
68