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 domain. 29 */ 30 public class ServReqDnsPtrTestCase extends ServReqTestCase { 31 ServReqDnsPtrTestCase(Context context)32 public ServReqDnsPtrTestCase(Context context) { 33 super(context); 34 } 35 36 @Override executeTest()37 protected boolean executeTest() throws InterruptedException { 38 39 notifyTestMsg(R.string.p2p_checking_serv_capab); 40 41 /* 42 * create request to search bonjour ipp PTR. 43 */ 44 List<WifiP2pServiceRequest> reqList = new ArrayList<WifiP2pServiceRequest>(); 45 reqList.add(WifiP2pDnsSdServiceRequest.newInstance("_ipp._tcp")); 46 47 /* 48 * search and check the callback function. 49 * 50 * DNS PTR: IPP service. 51 * DNS TXT: No services. 52 * UPnP: No services. 53 */ 54 return searchTest(mTargetAddress, reqList, 55 DnsSdResponseListenerTest.IPP_DNS_PTR, 56 DnsSdTxtRecordListenerTest.NO_DNS_TXT, 57 UPnPServiceResponseListenerTest.NO_UPNP_SERVICES); 58 } 59 60 @Override getTestName()61 public String getTestName() { 62 return "Request DNS PTR service test"; 63 } 64 } 65