|
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 "cteststepbtromconfiguser001.h" |
|
17 |
|
18 /** |
|
19 Panic string if an invalid test subcase is specified |
|
20 Panic number is the invalid subcase |
|
21 */ |
|
22 _LIT(KInvalidTestPanicString, "Invalid Test subcase specified"); |
|
23 |
|
24 CTestStepBtRomConfigUser001::~CTestStepBtRomConfigUser001() |
|
25 { |
|
26 if ( iSocketServ.Handle() ) |
|
27 { |
|
28 iSocketServ.Close(); |
|
29 } |
|
30 } |
|
31 |
|
32 CTestStepBtRomConfigUser001::CTestStepBtRomConfigUser001 |
|
33 (CTestServer& aParent) |
|
34 : CTestStepBtRomConfigBase(aParent) |
|
35 { |
|
36 SetTestStepName(KTestNameUser001); |
|
37 } |
|
38 |
|
39 /** |
|
40 Static Constructor |
|
41 Note the lack of ELeave. This means that having insufficient memory will return NULL; |
|
42 */ |
|
43 CTestStepBtRomConfigUser001* CTestStepBtRomConfigUser001::New |
|
44 (CTestServer& aParent) |
|
45 { |
|
46 return new CTestStepBtRomConfigUser001(aParent); |
|
47 } |
|
48 |
|
49 /** |
|
50 see BT_ROMCONFIG_USER_001.script |
|
51 */ |
|
52 TVerdict CTestStepBtRomConfigUser001::doTestStepL() |
|
53 { |
|
54 INFO_PRINTF1(\ |
|
55 _L(">>CTestStepBtRomConfigUser001::doTestStepL()")); |
|
56 User::LeaveIfError( iSocketServ.Connect() ); |
|
57 |
|
58 const TInt expectedError = ( iBtExcluded ? KErrBadName : KErrNone ); |
|
59 // this is only used for logging readability purposes |
|
60 const TDesC* expectedErrorDesPtr = ( iBtExcluded ? &KErrBadNameLit : &KErrNoneLit ); |
|
61 |
|
62 TRAPD(err, TestPhysicalLinksConstructorL(1)); |
|
63 if ( err!=expectedError ) |
|
64 { |
|
65 INFO_PRINTF4(\ |
|
66 _L("Failed: Expected %S(%d) and got %d calling CBluetoothPhysicalLinks::NewL"),\ |
|
67 expectedErrorDesPtr, expectedError, err); |
|
68 SetTestStepResult(EFail); |
|
69 } |
|
70 |
|
71 TRAPD(err2, TestPhysicalLinksConstructorL(2)); |
|
72 if ( err2!=expectedError ) |
|
73 { |
|
74 INFO_PRINTF4(\ |
|
75 _L("Failed: Expected %S(%d) and got %d calling CBluetoothPhysicalLinks::NewLC"),\ |
|
76 expectedErrorDesPtr, expectedError, err2); |
|
77 SetTestStepResult(EFail); |
|
78 } |
|
79 |
|
80 iSocketServ.Close(); |
|
81 INFO_PRINTF1(\ |
|
82 _L("<<CTestStepBtRomConfigUser001::doTestStepL()")); |
|
83 CheckAndSetTestResult(); |
|
84 return TestStepResult(); |
|
85 } |
|
86 |
|
87 void CTestStepBtRomConfigUser001::TestPhysicalLinksConstructorL(TInt aTestSubCase) |
|
88 { |
|
89 switch(aTestSubCase) |
|
90 { |
|
91 case 1: |
|
92 { |
|
93 CBluetoothPhysicalLinks* linksCase1 = |
|
94 CBluetoothPhysicalLinks::NewL(*this, iSocketServ); |
|
95 delete linksCase1; |
|
96 } |
|
97 break; |
|
98 |
|
99 case 2: |
|
100 { |
|
101 CBluetoothPhysicalLinks* linksCase2 = |
|
102 CBluetoothPhysicalLinks::NewLC(*this, iSocketServ); |
|
103 CleanupStack::PopAndDestroy(linksCase2); |
|
104 } |
|
105 break; |
|
106 |
|
107 default: |
|
108 SetTestStepResult(EFail); |
|
109 User::Panic(KInvalidTestPanicString, aTestSubCase); |
|
110 break; |
|
111 } |
|
112 } |
|
113 |
|
114 // stubs |
|
115 void CTestStepBtRomConfigUser001::HandleCreateConnectionCompleteL(TInt /*aErr*/) |
|
116 { |
|
117 } |
|
118 |
|
119 void CTestStepBtRomConfigUser001::HandleDisconnectCompleteL(TInt /*aErr*/) |
|
120 { |
|
121 } |
|
122 |
|
123 void CTestStepBtRomConfigUser001::HandleDisconnectAllCompleteL(TInt /*aErr*/) |
|
124 { |
|
125 } |
|
126 |
|
127 // EOF |