|
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: Tests for InstallOperation class |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "installoperation.h" |
|
19 #include "TestHarness.h" |
|
20 using namespace java::debug; |
|
21 |
|
22 class TestInstallOperation : public InstallOperation |
|
23 { |
|
24 public: |
|
25 TestInstallOperation():mError(0) {}; |
|
26 |
|
27 using InstallOperation::runJavaInstaller; |
|
28 virtual int startJavaInstaller() |
|
29 { |
|
30 return mError; |
|
31 }; |
|
32 |
|
33 void setError(int aError) |
|
34 { |
|
35 mError = aError; |
|
36 }; |
|
37 private: |
|
38 int mError; |
|
39 }; |
|
40 |
|
41 |
|
42 TEST_GROUP(TestInstallOperation) |
|
43 { |
|
44 TestInstallOperation runner; |
|
45 TEST_SETUP() |
|
46 { |
|
47 } |
|
48 |
|
49 TEST_TEARDOWN() |
|
50 { |
|
51 } |
|
52 }; |
|
53 |
|
54 TEST(TestInstallOperation, runOk) |
|
55 { |
|
56 int rc = runner.runJavaInstaller(); |
|
57 CHECK(rc == 0); |
|
58 } |
|
59 |
|
60 TEST(TestInstallOperation, runAlreadyExists) |
|
61 { |
|
62 runner.setError(KErrAlreadyExists); |
|
63 int rc = runner.runJavaInstaller(); |
|
64 CHECK(rc == KErrAlreadyExists); |
|
65 } |
|
66 |
|
67 TEST(TestInstallOperation, runError) |
|
68 { |
|
69 runner.setError(KErrGeneral); |
|
70 int rc = runner.runJavaInstaller(); |
|
71 CHECK(rc == KErrGeneral); |
|
72 } |