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 // TE_PerfTestCacheEnabledStep.cpp |
|
15 // |
|
16 // |
|
17 |
|
18 #include "TE_PerfTestCacheStepBase.h" |
|
19 #include <centralrepository.h> |
|
20 #include "t_cenrep_helper.h" |
|
21 #include "srvreqs.h" |
|
22 |
|
23 //-------------------------------- |
|
24 // class CPerfTestCacheStepBase |
|
25 //-------------------------------- |
|
26 |
|
27 #if defined(__CENTREP_SERVER_CACHETEST__) && defined(__CENTREP_SERVER_PERFTEST__) |
|
28 const TUid KUidCacheTestRepositorySmTxt = { 0x00000002 }; |
|
29 const TUid KUidCacheTestRepositoryLrgTxt = { 0xCCCCCC01 }; |
|
30 const TUid KUidCacheTestRepositorySmCre = { 0x22222221 }; |
|
31 const TUid KUidCacheTestRepositoryLrgCre = { 0xCCCCCC02 }; |
|
32 #endif |
|
33 |
|
34 // CommonTestStepL |
|
35 // This function accesses a small and a large repository various times |
|
36 // when cache is enabled and disabled. |
|
37 void CPerfTestCacheStepBase::CommonTestStepL() |
|
38 { |
|
39 SetTestStepResult(EFail); |
|
40 |
|
41 #if defined(__CENTREP_SERVER_CACHETEST__) && defined(__CENTREP_SERVER_PERFTEST__) |
|
42 TInt r = SetGetParameters(TIpcArgs(ERestartPerfTests)); |
|
43 TEST(r==KErrNone); |
|
44 |
|
45 CRepository* repository; |
|
46 TInt i; |
|
47 // Access small text rep 5 times in a row |
|
48 for(i=0; i<5; i++) |
|
49 { |
|
50 User::LeaveIfNull(repository = CRepository::NewL(KUidCacheTestRepositorySmTxt)); |
|
51 delete repository; |
|
52 repository = NULL; |
|
53 User::After(200000); // delay 200ms before access |
|
54 } |
|
55 |
|
56 // Access large text rep 5 times in a row |
|
57 for(i=0; i<5; i++) |
|
58 { |
|
59 User::LeaveIfNull(repository = CRepository::NewL(KUidCacheTestRepositoryLrgTxt)); |
|
60 delete repository; |
|
61 repository = NULL; |
|
62 User::After(200000); // delay 200ms before access |
|
63 } |
|
64 |
|
65 // Access small binary rep 20 times in a row |
|
66 for(i=0; i<20; i++) |
|
67 { |
|
68 User::LeaveIfNull(repository = CRepository::NewL(KUidCacheTestRepositorySmCre)); |
|
69 delete repository; |
|
70 repository = NULL; |
|
71 User::After(200000); // delay 200ms before access |
|
72 } |
|
73 |
|
74 // Access large binary rep 20 times in a row |
|
75 for(i=0; i<20; i++) |
|
76 { |
|
77 User::LeaveIfNull(repository = CRepository::NewL(KUidCacheTestRepositoryLrgCre)); |
|
78 delete repository; |
|
79 repository = NULL; |
|
80 User::After(200000); // delay 200ms before access |
|
81 } |
|
82 SetTestStepResult(EPass); |
|
83 |
|
84 #endif |
|
85 } |
|