|
1 // Copyright (c) 2002-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 // This contains PhbkSync Close() matched Test Steps |
|
15 // |
|
16 // |
|
17 |
|
18 #include "TE_PhBkSyncBase.h" |
|
19 #include "TestOpenSteps.h" |
|
20 |
|
21 LOCAL_C void SetUpPhoneUsingTSYL(TInt aTestNumber) |
|
22 { |
|
23 RProperty testNumberProperty; |
|
24 User::LeaveIfError(testNumberProperty.Attach(KUidPSSimTsyCategory, KPSSimTsyTestNumber)); |
|
25 CleanupClosePushL(testNumberProperty); |
|
26 |
|
27 TRequestStatus status; |
|
28 testNumberProperty.Subscribe(status); |
|
29 User::LeaveIfError(testNumberProperty.Set(KUidPSSimTsyCategory,KPSSimTsyTestNumber,aTestNumber)); |
|
30 User::WaitForRequest(status); |
|
31 User::LeaveIfError(status.Int()); |
|
32 TInt testNumberCheck; |
|
33 User::LeaveIfError(testNumberProperty.Get(testNumberCheck)); |
|
34 if (aTestNumber != testNumberCheck) |
|
35 { |
|
36 User::Leave(KErrNotFound); |
|
37 } |
|
38 |
|
39 CleanupStack::PopAndDestroy(&testNumberProperty); |
|
40 } |
|
41 |
|
42 // |
|
43 // Test step1 -- Close() matched test step // |
|
44 // |
|
45 CPhbkSyncOpenTest_01::CPhbkSyncOpenTest_01() |
|
46 { |
|
47 // store the name of this test step |
|
48 SetTestStepName(_L("PhbkSyncOpenTest_01")); |
|
49 } |
|
50 |
|
51 CPhbkSyncOpenTest_01::~CPhbkSyncOpenTest_01() |
|
52 { |
|
53 } |
|
54 |
|
55 TVerdict CPhbkSyncOpenTest_01::doTestStepL( ) |
|
56 { |
|
57 // |
|
58 // Stop PhBkSyncSvr before deleting INI and Contacts... |
|
59 // |
|
60 iSession.Close(); |
|
61 ConfigurePhbkSyncToIdleL(); |
|
62 |
|
63 RFs fs; |
|
64 User::LeaveIfError(fs.Connect()); // Connect to File server |
|
65 CleanupClosePushL(fs); |
|
66 TInt err(fs.Delete(KPhbkSyncIniFile)); // Delete PhBkSync.INI file |
|
67 |
|
68 // either successful or no default .ini file |
|
69 TESTCHECKCONDITION(err == KErrNone || err == KErrNotFound || err == KErrPathNotFound); |
|
70 |
|
71 // Delete default ContactsDb |
|
72 TRAP(err,CContactDatabase::DeleteDefaultFileL()); |
|
73 |
|
74 // Deleted successfully OR no default ContactsDb |
|
75 TESTCHECKCONDITION(err == KErrNone || err == KErrNotFound); |
|
76 |
|
77 CleanupStack::PopAndDestroy(); // fs |
|
78 |
|
79 // before calling the API connect(), the phone has to be ready |
|
80 SetUpPhoneUsingTSYL(0); // initialise the phone using [test0] |
|
81 |
|
82 ConfigurePhbkSyncToFullL(); |
|
83 |
|
84 // now, call connect and this one should start the server |
|
85 User::LeaveIfError(iSession.Connect()); |
|
86 |
|
87 return TestStepResult(); |
|
88 } |
|
89 |