|
1 /* |
|
2 * Copyright (c) 2008-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 the License "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 /** |
|
20 @file |
|
21 @internalTechnology |
|
22 */ |
|
23 |
|
24 #include "tsifgenericbrowserinstallstep.h" |
|
25 #include "tsifsuitedefs.h" |
|
26 #include <apgcli.h> |
|
27 |
|
28 using namespace Usif; |
|
29 |
|
30 CSifGenericBrowserInstallStep::~CSifGenericBrowserInstallStep() |
|
31 /** |
|
32 * Destructor |
|
33 */ |
|
34 { |
|
35 INFO_PRINTF1(_L("Cleanup in CSifGenericBrowserInstallStep::~CSifGenericBrowserInstallStep()")); |
|
36 } |
|
37 |
|
38 CSifGenericBrowserInstallStep::CSifGenericBrowserInstallStep() |
|
39 /** |
|
40 * Constructor |
|
41 */ |
|
42 { |
|
43 } |
|
44 |
|
45 void CSifGenericBrowserInstallStep::ImplTestStepPreambleL() |
|
46 /** |
|
47 * @return - TVerdict code |
|
48 * Override of base class virtual |
|
49 */ |
|
50 { |
|
51 INFO_PRINTF1(_L("I am in CSifGenericBrowserInstallStep::ImplTestStepPreambleL().")); |
|
52 } |
|
53 |
|
54 |
|
55 void CSifGenericBrowserInstallStep::ImplTestStepL() |
|
56 /** |
|
57 * @return - TVerdict code |
|
58 * Override of base class pure virtual |
|
59 * Our implementation only gets called if the base class doTestStepPreambleL() did |
|
60 * not leave. That being the case, the current test result value will be EPass. |
|
61 */ |
|
62 { |
|
63 INFO_PRINTF1(_L("I am in CSifGenericBrowserInstallStep::ImplTestStepL().")); |
|
64 |
|
65 TPtrC fileName; |
|
66 if(!GetStringFromConfig(ConfigSection(),KTe_PackageFile, fileName)) |
|
67 { |
|
68 INFO_PRINTF1(_L("Failed to read package file name from ini file, error: KErrNotFound")); |
|
69 User::Leave(KErrNotFound); |
|
70 } |
|
71 |
|
72 TBool installByFileHandle = EFalse; |
|
73 if(!GetBoolFromConfig(ConfigSection(),KTe_OperationByFileHandle, installByFileHandle)) |
|
74 { |
|
75 INFO_PRINTF1(_L("Failed to read KTe_InstallByFileHandle from ini file, error: KErrNotFound")); |
|
76 User::Leave(KErrNotFound); |
|
77 } |
|
78 |
|
79 RApaLsSession apa; |
|
80 User::LeaveIfError(apa.Connect()); |
|
81 CleanupClosePushL(apa); |
|
82 |
|
83 TRequestStatus status; |
|
84 if (installByFileHandle) |
|
85 { |
|
86 RFs fs; |
|
87 RFile file; |
|
88 User::LeaveIfError(fs.Connect()); |
|
89 fs.ShareProtected(); |
|
90 CleanupClosePushL(fs); |
|
91 User::LeaveIfError(file.Open(fs, fileName, EFileRead | EFileShareReadersOnly)); |
|
92 CleanupClosePushL(file); |
|
93 |
|
94 TThreadId threadId; |
|
95 TInt err = apa.StartDocument(file, threadId, &status); |
|
96 if (err != KErrNone) |
|
97 { |
|
98 INFO_PRINTF2(_L("Failed to call RApaLsSession::StartDocument(), error code: %d"), err); |
|
99 User::Leave(err); |
|
100 } |
|
101 User::WaitForRequest(status); |
|
102 CleanupStack::PopAndDestroy(2, &fs); |
|
103 } |
|
104 else |
|
105 { |
|
106 TThreadId threadId; |
|
107 TInt err = apa.StartDocument(fileName, threadId); |
|
108 if (err != KErrNone) |
|
109 { |
|
110 INFO_PRINTF2(_L("Failed to call RApaLsSession::StartDocument(), error code: %d"), err); |
|
111 User::Leave(err); |
|
112 } |
|
113 |
|
114 RThread thread; |
|
115 err = thread.Open(threadId); |
|
116 if (err != KErrNone) |
|
117 { |
|
118 INFO_PRINTF2(_L("Failed to call RThread::Open(), error code: %d"), err); |
|
119 User::Leave(err); |
|
120 } |
|
121 |
|
122 thread.Rendezvous(status); |
|
123 User::WaitForRequest(status); |
|
124 } |
|
125 |
|
126 CleanupStack::PopAndDestroy(&apa); |
|
127 |
|
128 if (status != iExpectedResult) |
|
129 { |
|
130 INFO_PRINTF3(_L("Expected result doesn't match: current: %d expected: %d"), status.Int(), iExpectedResult); |
|
131 SetTestStepResult(EFail); |
|
132 } |
|
133 else |
|
134 { |
|
135 SetTestStepResult(EPass); |
|
136 } |
|
137 } |
|
138 |
|
139 |
|
140 |
|
141 void CSifGenericBrowserInstallStep::ImplTestStepPostambleL() |
|
142 /** |
|
143 * @return - TVerdict code |
|
144 * Override of base class virtual |
|
145 */ |
|
146 { |
|
147 } |