Home | History | Annotate | Download | only in testcase
      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 import java.util.List;
     21 
     22 import com.android.cts.verifier.R;
     23 
     24 import android.content.Context;
     25 import android.net.wifi.p2p.nsd.WifiP2pServiceInfo;
     26 import android.net.wifi.p2p.nsd.WifiP2pServiceRequest;
     27 
     28 /**
     29  * Service discovery requester test case to search all UPnP and Bonjour services with
     30  * WifiP2pServiceRequest.newInstance(WifiP2pServiceInfo.SERVICE_TYPE_ALL).
     31  */
     32 public class ServReqAllTestCase01 extends ServReqTestCase {
     33 
     34     public ServReqAllTestCase01(Context context) {
     35         super(context);
     36     }
     37 
     38     @Override
     39     protected boolean executeTest() throws InterruptedException {
     40 
     41         notifyTestMsg(R.string.p2p_checking_serv_capab);
     42 
     43         /*
     44          * create request to search all services.
     45          */
     46         List<WifiP2pServiceRequest> reqList = new ArrayList<WifiP2pServiceRequest>();
     47         reqList.add(WifiP2pServiceRequest.newInstance(
     48                 WifiP2pServiceInfo.SERVICE_TYPE_ALL));
     49 
     50         /*
     51          * search and check the callback function.
     52          *
     53          * The expected the argument of the callback function is as follows.
     54          * DNS PTR: ALL services.
     55          * DNS TXT: ALL services.
     56          * UPnP: ALL services.
     57          */
     58         return searchTest(mTargetAddress, reqList,
     59                 DnsSdResponseListenerTest.ALL_DNS_PTR,
     60                 DnsSdTxtRecordListenerTest.ALL_DNS_TXT,
     61                 UPnPServiceResponseListenerTest.ALL_UPNP_SERVICES);
     62     }
     63 
     64     @Override
     65     public String getTestName() {
     66         return "Request all services test 01";
     67     }
     68 }
     69