|
1 // Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "cteststepbtromconfigrsocketserv002.h" |
|
17 #include <bt_sock.h> |
|
18 #include <bluetoothav.h> |
|
19 |
|
20 CTestStepBtRomConfigRSocketServ002::~CTestStepBtRomConfigRSocketServ002() |
|
21 { |
|
22 if ( iSocketServ.Handle() ) |
|
23 { |
|
24 iSocketServ.Close(); |
|
25 } |
|
26 } |
|
27 |
|
28 CTestStepBtRomConfigRSocketServ002::CTestStepBtRomConfigRSocketServ002 |
|
29 (CTestServer& aParent) |
|
30 : CTestStepBtRomConfigBase(aParent) |
|
31 { |
|
32 SetTestStepName(KTestNameRSocketServ002); |
|
33 } |
|
34 |
|
35 /** |
|
36 Static Constructor |
|
37 Note the lack of ELeave. This means that having insufficient memory will return NULL; |
|
38 */ |
|
39 CTestStepBtRomConfigRSocketServ002* CTestStepBtRomConfigRSocketServ002::New |
|
40 (CTestServer& aParent) |
|
41 { |
|
42 return new CTestStepBtRomConfigRSocketServ002(aParent); |
|
43 } |
|
44 |
|
45 /** |
|
46 See BT_ROMCONFIG_RSOCKETSERV_002.script |
|
47 */ |
|
48 TVerdict CTestStepBtRomConfigRSocketServ002::doTestStepL() |
|
49 { |
|
50 INFO_PRINTF1(\ |
|
51 _L(">>CTestStepBtRomConfigRSocketServ002::doTestStepL()")); |
|
52 |
|
53 User::LeaveIfError(iSocketServ.Connect()); |
|
54 |
|
55 // TODO: What are the packet types for the extra BT protocols? |
|
56 TestStartProtocol(KSockStream, KRFCOMM); |
|
57 TestStartProtocol(KSockSeqPacket, KL2CAP); |
|
58 TestStartProtocol(KSockStream, KSDP); |
|
59 TestStartProtocol(KUndefinedSockType, KBTLinkManager); |
|
60 TestStartProtocol(KSockDatagram, KAVCTP); |
|
61 TestStartProtocol(KSockDatagram, KAVDTP); |
|
62 |
|
63 iSocketServ.Close(); |
|
64 |
|
65 INFO_PRINTF1(\ |
|
66 _L("<<CTestStepBtRomConfigRSocketServ002::doTestStepL()")); |
|
67 CheckAndSetTestResult(); |
|
68 return TestStepResult(); |
|
69 } |
|
70 |
|
71 void CTestStepBtRomConfigRSocketServ002::TestStartProtocol(TUint aPacketType, TUint aProtocolNumber) |
|
72 { |
|
73 const TInt expectedError = ( iBtExcluded ? KErrBadName : KErrNone ); |
|
74 // this is only used for logging readability purposes |
|
75 const TDesC* expectedErrorDesPtr = ( iBtExcluded ? &KErrBadNameLit : &KErrNoneLit ); |
|
76 TRequestStatus stat; |
|
77 iSocketServ.StartProtocol( KBTAddrFamily, aPacketType, aProtocolNumber, stat ); |
|
78 User::WaitForRequest(stat); |
|
79 if ( stat.Int()!=expectedError ) |
|
80 { |
|
81 INFO_PRINTF5(\ |
|
82 _L("Failed: Expected %S(%d) and got %d when calling StartProtocol for BT protocol number %u"),\ |
|
83 expectedErrorDesPtr, expectedError, stat.Int(), aProtocolNumber); |
|
84 SetTestStepResult(EFail); |
|
85 } |
|
86 } |
|
87 |
|
88 // EOF |