|
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 /** |
|
17 @file |
|
18 @internalComponent - Internal Symbian test code |
|
19 */ |
|
20 |
|
21 #include "t_abstractnonnativeappsstep.h" |
|
22 |
|
23 #include <apgicnfl.h> |
|
24 #ifdef SYMBIAN_ENABLE_SPLIT_HEADERS |
|
25 #include <apgicnflpartner.h> |
|
26 #endif //SYMBIAN_ENABLE_SPLIT_HEADERS |
|
27 |
|
28 CT_AbstractNonNativeAppsTestStep::CT_AbstractNonNativeAppsTestStep() |
|
29 { |
|
30 } |
|
31 |
|
32 CT_AbstractNonNativeAppsTestStep::~CT_AbstractNonNativeAppsTestStep() |
|
33 { |
|
34 } |
|
35 |
|
36 void CT_AbstractNonNativeAppsTestStep::doAbstractNonNativeAppsTestStepPreambleL() |
|
37 { |
|
38 TInt error = iSession.Connect(); |
|
39 TEST(error==KErrNone); |
|
40 error = iUtils.Connect(); |
|
41 TEST(error==KErrNone); |
|
42 } |
|
43 |
|
44 void CT_AbstractNonNativeAppsTestStep::CleanupAndResetL(RTestableApaLsSession& aSession, const TTestAppDetails& aApp) |
|
45 { |
|
46 // make sure we're starting from a clean sheet |
|
47 CompleteDeregisterL(aSession, aApp); |
|
48 aSession.DeregisterNonNativeApplicationTypeL(TUid::Uid(KApplicationType)); |
|
49 aSession.RegisterNonNativeApplicationTypeL(TUid::Uid(KApplicationType), KLitNativeExecutable); |
|
50 } |
|
51 |
|
52 void CT_AbstractNonNativeAppsTestStep::CallRegisterL(RTestableApaLsSession& aSession, const TTestAppDetails& aApp) |
|
53 { |
|
54 CApaRegistrationResourceFileWriter* const registrationResourceFileWriter = |
|
55 CApaRegistrationResourceFileWriter::NewL(TUid::Uid(aApp.iAppUid), aApp.iLogicalExecutable, TApaAppCapability::ENonNative); |
|
56 CleanupStack::PushL(registrationResourceFileWriter); |
|
57 aSession.RegisterNonNativeApplicationL(TUid::Uid(KApplicationType), EDriveC, *registrationResourceFileWriter, NULL, NULL); |
|
58 CleanupStack::PopAndDestroy(); |
|
59 } |
|
60 |
|
61 void CT_AbstractNonNativeAppsTestStep::CompleteRegisterL(RTestableApaLsSession& aSession, const TTestAppDetails& aApp) |
|
62 { |
|
63 aSession.PrepareNonNativeApplicationsUpdatesL(); |
|
64 CallRegisterL(aSession, aApp); |
|
65 aSession.CommitNonNativeApplicationsUpdatesL(); |
|
66 } |
|
67 |
|
68 void CT_AbstractNonNativeAppsTestStep::CallDeregisterL(RTestableApaLsSession& aSession, const TTestAppDetails& aApp) |
|
69 { |
|
70 aSession.DeregisterNonNativeApplicationL(TUid::Uid(aApp.iAppUid)); |
|
71 } |
|
72 |
|
73 void CT_AbstractNonNativeAppsTestStep::CompleteDeregisterL(RTestableApaLsSession& aSession, const TTestAppDetails& aApp) |
|
74 { |
|
75 aSession.PrepareNonNativeApplicationsUpdatesL(); |
|
76 CallDeregisterL(aSession, aApp); |
|
77 aSession.CommitNonNativeApplicationsUpdatesL(); |
|
78 } |
|
79 |
|
80 TBool CT_AbstractNonNativeAppsTestStep::FilePresent(const TDesC& aFile) |
|
81 { |
|
82 TBool present = EFalse; |
|
83 TInt err = iUtils.IsFilePresent(aFile, present); |
|
84 TEST(err == KErrNone); |
|
85 return present; |
|
86 } |
|
87 |
|
88 TBool CT_AbstractNonNativeAppsTestStep::FileAbsent(const TDesC& aFile) |
|
89 { |
|
90 TBool present = ETrue; |
|
91 TInt err = iUtils.IsFilePresent(aFile, present); |
|
92 TEST(err == KErrNone); |
|
93 return !present; |
|
94 } |
|
95 |
|
96 TBool CT_AbstractNonNativeAppsTestStep::AppPresent(RTestableApaLsSession& aSession, const TTestAppDetails& aApp) |
|
97 { |
|
98 TApaAppInfo info; |
|
99 TInt err = aSession.GetAppInfo(info,TUid::Uid(aApp.iAppUid)); |
|
100 TEST(err == KErrNone); |
|
101 TUid typeUid; |
|
102 err = aSession.GetAppType(typeUid, TUid::Uid(aApp.iAppUid)); |
|
103 TEST(err == KErrNone); |
|
104 |
|
105 TBool test1 = (info.iUid.iUid == aApp.iAppUid) && (typeUid == TUid::Uid(KApplicationType)); |
|
106 TBool test2 = FilePresent(aApp.iRegistrationFile); |
|
107 TBool test3 = FileAbsent(KLitUpdatedAppsList); |
|
108 return test1 && test2 && test3; |
|
109 } |
|
110 |
|
111 TBool CT_AbstractNonNativeAppsTestStep::AppAbsent(RTestableApaLsSession& aSession, const TTestAppDetails& aApp) |
|
112 { |
|
113 TApaAppInfo info; |
|
114 TInt err = aSession.GetAppInfo(info,TUid::Uid(aApp.iAppUid)); |
|
115 TBool test1 = (err == KErrNotFound); |
|
116 TBool test2 = FileAbsent(aApp.iRegistrationFile); |
|
117 TBool test3 = FileAbsent(KLitUpdatedAppsList); |
|
118 return test1 && test2 && test3; |
|
119 } |