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 package com.android.cts.verifier.p2p.testcase;
     17 
     18 import java.util.ArrayList;
     19 import java.util.List;
     20 
     21 import com.android.cts.verifier.R;
     22 
     23 import android.content.Context;
     24 import android.net.wifi.p2p.nsd.WifiP2pDnsSdServiceRequest;
     25 import android.net.wifi.p2p.nsd.WifiP2pServiceRequest;
     26 
     27 /**
     28  * Service discovery requester test case to search Bonjour TXT record.
     29  */
     30 public class ServReqDnsTxtTestCase extends ServReqTestCase {
     31 
     32     public ServReqDnsTxtTestCase(Context context) {
     33         super(context);
     34     }
     35 
     36     @Override
     37     protected boolean executeTest() throws InterruptedException {
     38 
     39         notifyTestMsg(R.string.p2p_checking_serv_capab);
     40 
     41         /*
     42          * create request to search bonjour ipp TXT.
     43          */
     44         List<WifiP2pServiceRequest> reqList = new ArrayList<WifiP2pServiceRequest>();
     45         reqList.add(WifiP2pDnsSdServiceRequest.newInstance("MyPrinter",
     46                 "_ipp._tcp"));
     47 
     48         /*
     49          * search and check the callback function.
     50          *
     51          * DNS PTR: No service.
     52          * DNS TXT: IPP TXT recored.
     53          * UPnP: No services.
     54          */
     55         return searchTest(mTargetAddress, reqList,
     56                 DnsSdResponseListenerTest.NO_DNS_PTR,
     57                 DnsSdTxtRecordListenerTest.IPP_DNS_TXT,
     58                 UPnPServiceResponseListenerTest.NO_UPNP_SERVICES);
     59     }
     60 
     61     @Override
     62     public String getTestName() {
     63         return "Request DNS TXT record test";
     64     }
     65 }
     66