contentstorage/casrv/causifscanner/tsrc/t_causifscanner/src/T_installNotifier.cpp
changeset 117 c63ee96dbe5f
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/contentstorage/casrv/causifscanner/tsrc/t_causifscanner/src/T_installNotifier.cpp	Thu Sep 16 12:11:40 2010 +0100
@@ -0,0 +1,143 @@
+/*
+* Copyright (c) 2004 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include <swinstdefs.h>
+#include <swinstapi.h>
+#include <w32std.h>
+#include <apgtask.h>
+
+//  CLASS HEADER
+#include "T_caUsifScaner.h"
+
+//  EXTERNAL INCLUDES
+
+#include <cadef.h>
+
+#include "castoragefactory.h"
+#include "castorageproxy.h"
+#include "casrvengutils.h"
+#include "causifscanner.h"
+#include "causifscanner.hrh"
+#include "cainnerentry.h"
+#include "cainnerquery.h"
+#include "caarraycleanup.inl"
+#include "casrvmmchistory.h"
+#include "cainstallnotifier.h"
+#include "cammcwatcher.h"
+#include "cainstallstrategy.h"
+
+//  INTERNAL INCLUDES
+#include "casrvtestutils.h"
+#include "testconsts.h"
+
+#ifdef COVERAGE_MEASUREMENT
+const unsigned int TIMEOUT_FACTOR = 2;
+#else
+const unsigned int TIMEOUT_FACTOR = 1;
+#endif
+
+class TTestsListener : public MCaInstallListener, public MMmcWatcherCallback
+    {
+public:
+    void HandleInstallNotifyL(TInt aEvent)
+        {
+        iStatus = ETrue;
+        }
+
+    virtual void MmcChangeL()
+        {
+        iStatus = ETrue;
+        }
+
+    TBool iStatus;
+    };
+// ---------------------------------------------------------------------------
+//
+void T_caUsifScaner::testJavaStrategy()
+{
+    bool result(false);
+
+    TTestsListener listener;
+    listener.iStatus = EFalse;
+
+    TRAPD(err,
+            RProperty property;
+            CCaJavaInstallStrategy *installStrategy =
+                CCaJavaInstallStrategy::NewL( property );
+
+            installStrategy->NotifyListenerL( property, listener );
+            result = installStrategy != NULL;
+            delete installStrategy;
+            property.Close();
+         );
+    QCOMPARE(err, KErrNone);
+    QVERIFY(result);
+    QVERIFY(listener.iStatus != EFalse);
+}
+
+// ---------------------------------------------------------------------------
+//
+void T_caUsifScaner::testUsifStrategy()
+{
+
+    bool result(false);
+
+    TTestsListener listener;
+    listener.iStatus = EFalse;
+
+    TRAPD(err,
+            RProperty property;
+            CCaUsifUninstallStrategy *installStrategy =
+                    CCaUsifUninstallStrategy::NewL( property );
+            result = installStrategy != NULL;
+            installStrategy->NotifyListenerL( property, listener );
+
+            delete installStrategy;
+            property.Close();
+         );
+    QCOMPARE(err, KErrNone);
+    QVERIFY(result);
+    QVERIFY(listener.iStatus == EFalse);
+}
+
+// ---------------------------------------------------------------------------
+//
+void T_caUsifScaner::testSwiStrategy()
+{
+
+    bool result(false);
+
+    TTestsListener listener;
+    listener.iStatus = EFalse;
+
+    TRAPD(err,
+            RProperty property;
+            CCaSwiInstallStrategy *installStrategy =
+                    CCaSwiInstallStrategy::NewL( property );
+
+            installStrategy->NotifyListenerL( property, listener );
+            result = installStrategy != NULL;
+            delete installStrategy;
+            property.Close();
+         );
+    QCOMPARE(err, KErrNone);
+    QVERIFY(result);
+    QVERIFY(listener.iStatus != EFalse);
+}
+
+
+//  END OF FILE