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