|
1 /* |
|
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include "t_hsdomainmodel.h" |
|
20 #include "hsbackuprestoreobserver.h" |
|
21 #ifdef Q_OS_SYMBIAN |
|
22 #include "hsbackuprestoreactivecallback.h" |
|
23 #endif |
|
24 /*! |
|
25 |
|
26 */ |
|
27 void TestHsDomainModel::testBackupRestoreActiveCallback() |
|
28 { |
|
29 #ifdef Q_OS_SYMBIAN |
|
30 int error = 0; |
|
31 HsBackupRestoreObserver *observer = HsBackupRestoreObserver::instance(); |
|
32 CHsBURActiveCallback *activeCallback = 0; |
|
33 TRAP(error, activeCallback = CHsBURActiveCallback::NewL(observer)); |
|
34 QVERIFY(error == KErrNone); |
|
35 QVERIFY(activeCallback); |
|
36 activeCallback->AllSnapshotsSuppliedL(); |
|
37 |
|
38 TDriveNumber driveNumber = EDriveC; |
|
39 TBuf8<1> buf; |
|
40 HBufC8 *heapBuf = HBufC8::NewL(1); |
|
41 TBool retValue = EFalse; |
|
42 |
|
43 TRAP(error, activeCallback->ReceiveSnapshotDataL(driveNumber, buf, retValue)); |
|
44 QVERIFY(error == KErrNotSupported); |
|
45 |
|
46 TUint dataSize = activeCallback->GetExpectedDataSize(driveNumber); |
|
47 QVERIFY(dataSize == 0); |
|
48 |
|
49 TPtr8 bufPtr = heapBuf->Des(); |
|
50 TRAP(error, activeCallback->GetSnapshotDataL(driveNumber, bufPtr, retValue)); |
|
51 QVERIFY(error == KErrNotSupported); |
|
52 |
|
53 activeCallback->InitialiseGetBackupDataL(driveNumber); |
|
54 QVERIFY(observer->checkBUR()); |
|
55 |
|
56 TRAP(error, activeCallback->GetBackupDataSectionL(bufPtr, retValue)); |
|
57 QVERIFY(error == KErrNone); |
|
58 QVERIFY(retValue); |
|
59 |
|
60 TRAP(error, activeCallback->InitialiseRestoreBaseDataL(driveNumber)); |
|
61 QVERIFY(error == KErrNotSupported); |
|
62 |
|
63 TRAP(error, activeCallback->RestoreBaseDataSectionL(buf, retValue)); |
|
64 QVERIFY(error == KErrNotSupported); |
|
65 |
|
66 TRAP(error, activeCallback->InitialiseRestoreIncrementDataL(driveNumber)); |
|
67 QVERIFY(error == KErrNotSupported); |
|
68 |
|
69 TRAP(error, activeCallback->RestoreIncrementDataSectionL(buf, retValue)); |
|
70 QVERIFY(error == KErrNotSupported); |
|
71 |
|
72 activeCallback->RestoreComplete(driveNumber); |
|
73 activeCallback->TerminateMultiStageOperation(); |
|
74 QVERIFY(activeCallback->GetDataChecksum(driveNumber)==0); |
|
75 |
|
76 delete activeCallback; |
|
77 #endif |
|
78 } |
|
79 |