--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/bwins/mt_hssettingsu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/eabi/mt_hssettingsu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,30 @@
+/*
+* Copyright (c) 2005 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: hssettings.dll unit test build file.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+mt_hssettings.mmp
+
+PRJ_TESTEXPORTS
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/group/mt_hssettings.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,51 @@
+/*
+* Copyright (c) 2009 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 <platform_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET mt_hssettings.dll
+TARGETTYPE dll
+TARGETPATH /digiaeunit/tests
+UID 0x1000af5a 0x01700000
+
+CAPABILITY EUNIT_CAPS
+
+SOURCEPATH ../src
+SOURCE mt_hssettingsdllmain.cpp
+SOURCE mt_map.cpp
+SOURCE mt_hspluginsettings.cpp
+SOURCE chomescreensettingsobserver.cpp
+SOURCE mt_pluginmap.cpp
+SOURCE mt_hspsconfiguration.cpp
+SOURCE mt_objectmap.cpp
+SOURCE mt_plugininfo.cpp
+
+USERINCLUDE ../inc
+USERINCLUDE ../../../../homescreenpluginsrv/homescreen_settings_api/inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE ../inc
+SYSTEMINCLUDE /epoc32/tools
+
+LIBRARY euser.lib charconv.lib eunit.lib
+
+// Module under test
+LIBRARY hspluginsettings.lib
+
+LIBRARY ecom.lib
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/inc/chomescreensettingsobserver.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,86 @@
+/*
+* Copyright (c) 2009 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: EUnit test for homescreen settings API, main suite
+*
+*/
+
+#ifndef __CHomescreenSettingsObserver_H__
+#define __CHomescreenSettingsObserver_H__
+
+// External includes
+#include <e32def.h>
+
+// Internal includes
+#include <MHomescreenSettingsObserver.h>
+
+// Forward declarations
+
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// Class definition
+/**
+ *
+ * Homescreen settings API test class.
+ *
+ */
+NONSHARABLE_CLASS( CHomescreenSettingsObserver )
+ : public HSPluginSettingsIf::MHomeScreenSettingsObserver
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static CHomescreenSettingsObserver* NewL();
+
+ /**
+ * Two phase construction
+ */
+ static CHomescreenSettingsObserver* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~CHomescreenSettingsObserver();
+
+private:
+
+ /**
+ * Private constructor
+ */
+ CHomescreenSettingsObserver();
+
+ /**
+ * Leaving constructor
+ */
+ void ConstructL();
+
+public:
+
+private:
+
+ /**
+ * Interface method SettingsChangedL
+ */
+ void SettingsChangedL( const TDesC8& aEvent, const TDesC8& aPluginName,
+ const TDesC8& aPluginUid, const TDesC8& aPluginId );
+
+private:
+
+ };
+
+#endif // __CHomescreenSettingsObserver_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/inc/mt_hspluginsettings.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2009 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: EUnit test for homescreen settings API, main suite
+*
+*/
+
+#ifndef __MT_HsPluginSettings_H__
+#define __MT_HsPluginSettings_H__
+
+// External includes
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <e32def.h>
+
+// Internal includes
+#include "chomescreensettingsobserver.h"
+
+// Forward declarations
+class CItemMap;
+
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// Class definition
+
+/**
+ *
+ * Homescreen settings API test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_HsPluginSettings ) : public CEUnitTestSuiteClass
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_HsPluginSettings* NewL();
+
+ /**
+ * Two phase construction
+ */
+ static MT_HsPluginSettings* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~MT_HsPluginSettings();
+
+private:
+
+ /**
+ * Private constructor
+ */
+ MT_HsPluginSettings();
+
+ /**
+ * Leaving constructor
+ */
+ void ConstructL();
+
+public:
+
+private:
+
+ /**
+ * Setup the test
+ */
+ void SetupL();
+
+ /**
+ * Clean after the test
+ */
+ void Teardown();
+
+ /**
+ * Test the get of settings
+ */
+ void TestGetSettingsL();
+
+ /**
+ * Test the set of settings
+ */
+ void TestSetSettingsL();
+
+private:
+ /** Test set */
+ EUNIT_DECLARE_TEST_TABLE;
+
+ HSPluginSettingsIf::CHomescreenSettings* iHomescreenSettings; // Not owned.
+ CHomescreenSettingsObserver* iObserver;
+ };
+
+#endif // __MT_HsPluginSettings_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/inc/mt_hspsconfiguration.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,116 @@
+/*
+* Copyright (c) 2010 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: EUnit test for homescreen settings API, hsps configuration tests
+*
+*/
+
+#ifndef __MT_HSPSCONFIGURATION_H__
+#define __MT_HSPSCONFIGURATION_H__
+
+// External includes
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <e32def.h>
+
+// Internal includes
+#include "hspsconfiguration.h"
+
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// Class definition
+/**
+ *
+ * Homescreen settings API test class for hspsconfiguration tests.
+ *
+ */
+NONSHARABLE_CLASS( MT_HspsConfiguration ) : public CEUnitTestSuiteClass
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_HspsConfiguration* NewL();
+
+ /**
+ * Two phase construction
+ */
+ static MT_HspsConfiguration* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~MT_HspsConfiguration();
+
+private:
+
+ /**
+ * Private constructor
+ */
+ MT_HspsConfiguration();
+
+ /**
+ * Leaving constructor
+ */
+ void ConstructL();
+
+public:
+
+private:
+
+ /**
+ * Setup the test
+ */
+ void SetupL();
+
+ /**
+ * Clean after the test
+ */
+ void Teardown();
+
+ /**
+ * Test confId
+ */
+ void ConfigIdTestL();
+
+ /**
+ * Test PluginInfo handling functions
+ */
+ void PluginInfoTestL();
+
+ /**
+ * Test Plugin maps
+ */
+ void PluginsTestL();
+
+ /**
+ * Test Items
+ */
+ void ItemsTestL();
+
+ /**
+ * Test Objects
+ */
+ void ObjectsTestL();
+
+private:
+ /** Test set */
+ EUNIT_DECLARE_TEST_TABLE;
+
+ HSPluginSettingsIf::CHspsConfiguration* iConfiguration;
+ };
+
+#endif // __MT_HSPSCONFIGURATION_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/inc/mt_map.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,123 @@
+/*
+* Copyright (c) 2009 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: EUnit test for homescreen settings API, main suite
+*
+*/
+
+#ifndef __MT_Map_H__
+#define __MT_Map_H__
+
+// External includes
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <e32def.h>
+
+// Internal includes
+#include <hspluginsettings.h>
+
+// Forward declarations
+class HSPluginSettingsIf::CItemMap;
+class HSPluginSettingsIf::CPropertyMap;
+
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// Class definition
+/**
+ *
+ * Homescreen settings API test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_Map ) : public CEUnitTestSuiteClass
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_Map* NewL();
+
+ /**
+ * Two phase construction
+ */
+ static MT_Map* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~MT_Map();
+
+private:
+
+ /**
+ * Private constructor
+ */
+ MT_Map();
+
+ /**
+ * Leaving constructor
+ */
+ void ConstructL();
+
+public:
+
+private:
+
+ /**
+ * Setup the test
+ */
+ void SetupL();
+
+ /**
+ * Clean after the test
+ */
+ void Teardown();
+ void TeardownPropertyMap();
+
+ /**
+ * Test set and get the item ID
+ */
+ void TestItemIdL();
+
+ /**
+ * Test set and get the item name
+ */
+ void TestItemNameL();
+
+ /**
+ * Test set and get the property name
+ */
+ void TestPropertyNameL();
+
+ /**
+ * Test set and get the property value
+ */
+ void TestPropertyValueL();
+
+ /**
+ * Test set and get the property map
+ */
+ void TestPropertyMapL();
+
+private:
+ /** Test set */
+ EUNIT_DECLARE_TEST_TABLE;
+
+ HSPluginSettingsIf::CItemMap* iItemMap;
+ HSPluginSettingsIf::CPropertyMap* iPropertyMap;
+ RPointerArray< HSPluginSettingsIf::CPropertyMap > iProperties;
+ };
+
+#endif // __MT_Map_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/inc/mt_objectmap.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* Copyright (c) 2010 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: EUnit test for homescreen settings API, object map tests
+*
+*/
+
+#ifndef __MT_OBJECTMAP_H__
+#define __MT_OBJECTMAP_H__
+
+// External includes
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <e32def.h>
+
+// Internal includes
+
+// Forward declarations
+namespace HSPluginSettingsIf
+ {
+ class CObjectMap;
+ }
+
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// Class definition
+/**
+ *
+ * Homescreen settings API test class for object map tests.
+ *
+ */
+NONSHARABLE_CLASS( MT_ObjectMap ) : public CEUnitTestSuiteClass
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_ObjectMap* NewL();
+
+ /**
+ * Two phase construction
+ */
+ static MT_ObjectMap* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~MT_ObjectMap();
+
+private:
+
+ /**
+ * Private constructor
+ */
+ MT_ObjectMap();
+
+ /**
+ * Leaving constructor
+ */
+ void ConstructL();
+
+public:
+
+private:
+
+ /**
+ * Setup the test
+ */
+ void SetupL();
+
+ /**
+ * Clean after the test
+ */
+ void Teardown();
+
+ /**
+ * Test Set and Get object Media Type
+ */
+ void TestMediaTypeL();
+
+ /**
+ * Test Set and Get object Name
+ */
+ void TestNameL();
+
+ /**
+ * Test Set and Get object Path
+ */
+ void TestPathL();
+
+private:
+ /** Test set */
+ EUNIT_DECLARE_TEST_TABLE;
+
+ HSPluginSettingsIf::CObjectMap* iObjectMap;
+ };
+
+#endif // __MT_OBJECTMAP_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/inc/mt_plugininfo.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2010 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: EUnit test for homescreen settings API, object map tests
+*
+*/
+
+#ifndef __MT_PLUGININFO_H__
+#define __MT_PLUGININFO_H__
+
+// External includes
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <e32def.h>
+
+// Internal includes
+
+// Forward declarations
+namespace HSPluginSettingsIf
+ {
+ class CPluginInfo;
+ }
+
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// Class definition
+/**
+ *
+ * Homescreen settings API test class for object map tests.
+ *
+ */
+NONSHARABLE_CLASS( MT_PluginInfo ) : public CEUnitTestSuiteClass
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_PluginInfo* NewL();
+
+ /**
+ * Two phase construction
+ */
+ static MT_PluginInfo* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~MT_PluginInfo();
+
+private:
+
+ /**
+ * Private constructor
+ */
+ MT_PluginInfo();
+
+ /**
+ * Leaving constructor
+ */
+ void ConstructL();
+
+public:
+
+private:
+
+ /**
+ * Setup the test
+ */
+ void SetupL();
+
+ /**
+ * Clean after the test
+ */
+ void Teardown();
+
+ /**
+ * Test set and get ConfigurationState
+ */
+ void TestConfigurationStateL();
+
+ /**
+ * Test set and get Name
+ */
+ void TestNameL();
+
+ /**
+ * Test set and get Interface
+ */
+ void TestInterfaceL();
+
+ /**
+ * Test set and get Type
+ */
+ void TestTypeL();
+
+ /**
+ * Test set and get Uid
+ */
+ void TestUidL();
+
+private:
+ /** Test set */
+ EUNIT_DECLARE_TEST_TABLE;
+
+ HSPluginSettingsIf::CPluginInfo* iPluginInfo;
+ };
+
+#endif // __MT_PLUGININFO_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/inc/mt_pluginmap.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,101 @@
+/*
+* Copyright (c) 2010 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: EUnit test for homescreen settings API, plugin map tests
+*
+*/
+
+#ifndef __MT_PLUGINMAP_H__
+#define __MT_PLUGINMAP_H__
+
+// External includes
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <e32def.h>
+
+// Internal includes
+#include "pluginmap.h"
+
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// Class definition
+/**
+ *
+ * Homescreen settings API test class for plugin map tests.
+ *
+ */
+NONSHARABLE_CLASS( MT_PluginMap ) : public CEUnitTestSuiteClass
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_PluginMap* NewL();
+
+ /**
+ * Two phase construction
+ */
+ static MT_PluginMap* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~MT_PluginMap();
+
+private:
+
+ /**
+ * Private constructor
+ */
+ MT_PluginMap();
+
+ /**
+ * Leaving constructor
+ */
+ void ConstructL();
+
+public:
+
+private:
+
+ /**
+ * Setup the test
+ */
+ void SetupL();
+
+ /**
+ * Clean after the test
+ */
+ void Teardown();
+
+ /**
+ * Test Set/Get plugin Id
+ */
+ void PluginIdTestL();
+
+ /**
+ * Test Set/Get plugin Uid
+ */
+ void PluginUidTestL();
+
+private:
+ /** Test set */
+ EUNIT_DECLARE_TEST_TABLE;
+
+ HSPluginSettingsIf::CPluginMap* iPluginMap;
+ };
+
+#endif // __MT_PLUGINMAP_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/src/chomescreensettingsobserver.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2009 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: EUnit test for homescreen settings API, main suite
+*
+*/
+
+// External includes
+#include <e32err.h>
+
+// Internal includes
+#include "CHomescreenSettingsObserver.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+//----------------------------------------------------------------------------
+// CHomescreenSettingsObserver::NewL( )
+//----------------------------------------------------------------------------
+//
+CHomescreenSettingsObserver* CHomescreenSettingsObserver::NewL()
+ {
+ CHomescreenSettingsObserver* self = CHomescreenSettingsObserver::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// CHomescreenSettingsObserver::NewLC( )
+//----------------------------------------------------------------------------
+//
+CHomescreenSettingsObserver* CHomescreenSettingsObserver::NewLC()
+ {
+ CHomescreenSettingsObserver* self =
+ new( ELeave ) CHomescreenSettingsObserver();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// CHomescreenSettingsObserver::~CHomescreenSettingsObserver( )
+//----------------------------------------------------------------------------
+//
+CHomescreenSettingsObserver::~CHomescreenSettingsObserver()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// CHomescreenSettingsObserver::CHomescreenSettingsObserver( )
+//----------------------------------------------------------------------------
+//
+CHomescreenSettingsObserver::CHomescreenSettingsObserver()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// CHomescreenSettingsObserver::ConstructL( )
+//----------------------------------------------------------------------------
+//
+void CHomescreenSettingsObserver::ConstructL()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// CHomescreenSettingsObserver::SettingsChangedL( )
+//----------------------------------------------------------------------------
+//
+void CHomescreenSettingsObserver::SettingsChangedL( const TDesC8& /*aEvent*/,
+ const TDesC8& /*aPluginName*/,
+ const TDesC8& /*aPluginUid*/,
+ const TDesC8& /*aPluginId*/ )
+ {
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/src/mt_hspluginsettings.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,178 @@
+/*
+* Copyright (c) 2009 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: EUnit test for homescreen settings API, main suite
+*
+*/
+
+// External includes
+#include <digia/eunit/eunitmacros.h>
+#include <e32std.h>
+#include <e32cmn.h>
+
+// Internal includes
+#include <hspluginsettings.h>
+#include <MT_HsPluginSettings.h>
+#include <itemmap.h>
+
+// ======== MEMBER FUNCTIONS ========
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::NewL( )
+//----------------------------------------------------------------------------
+//
+MT_HsPluginSettings* MT_HsPluginSettings::NewL()
+ {
+ MT_HsPluginSettings* self = MT_HsPluginSettings::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::NewLC( )
+//----------------------------------------------------------------------------
+//
+MT_HsPluginSettings* MT_HsPluginSettings::NewLC()
+ {
+ MT_HsPluginSettings* self = new( ELeave ) MT_HsPluginSettings();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::~MT_HsPluginSettings( )
+//----------------------------------------------------------------------------
+//
+MT_HsPluginSettings::~MT_HsPluginSettings()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::MT_HsPluginSettings( )
+//----------------------------------------------------------------------------
+//
+MT_HsPluginSettings::MT_HsPluginSettings()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::ConstructL( )
+//----------------------------------------------------------------------------
+//
+void MT_HsPluginSettings::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::SetupL( )
+//----------------------------------------------------------------------------
+//
+void MT_HsPluginSettings::SetupL( )
+ {
+ iObserver = CHomescreenSettingsObserver::NewL();
+ HSPluginSettingsIf::CHomescreenSettings::InitializeL( _L8( "271012080" ) );
+ iHomescreenSettings = HSPluginSettingsIf::CHomescreenSettings::Instance();
+ iHomescreenSettings->AddObserverL( iObserver );
+ }
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::Teardown( )
+//----------------------------------------------------------------------------
+//
+void MT_HsPluginSettings::Teardown( )
+ {
+ iHomescreenSettings->RemoveObserver( iObserver );
+ HSPluginSettingsIf::CHomescreenSettings::UnInitialize();
+ iHomescreenSettings = NULL;
+
+ if( iObserver )
+ {
+ delete iObserver;
+ iObserver = NULL;
+ }
+ }
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::TestGetSettingsL( )
+//----------------------------------------------------------------------------
+//
+void MT_HsPluginSettings::TestGetSettingsL()
+ {
+ _LIT8( KId, "1" ); // Plugin with ID 1 should be present - usually
+ //_LIT8( KId, "0x2001f482" ); // root config UId - GetSettingsL does not work with uids
+
+ RPointerArray<HSPluginSettingsIf::CItemMap> settingItems;
+ CleanupClosePushL( settingItems );
+
+ TInt err = iHomescreenSettings->GetSettingsL( KId, settingItems );
+ if ( err )
+ {
+ EUNIT_PRINT( _L( "Warning: Get plugin settings failed" ) );
+ }
+
+ CleanupStack::Pop( &settingItems );
+ settingItems.ResetAndDestroy();
+
+ EUNIT_ASSERT( ETrue );
+ }
+
+//----------------------------------------------------------------------------
+// MT_HsPluginSettings::TestSetSettingsL( )
+//----------------------------------------------------------------------------
+//
+void MT_HsPluginSettings::TestSetSettingsL()
+ {
+ _LIT8( KId, "1" ); // Plugin with ID 1 should be present - usually
+ //_LIT8( KId, "0x2001f482" ); // root config UId - does not work with uids
+
+ RPointerArray<HSPluginSettingsIf::CItemMap> settingItems;
+ CleanupClosePushL( settingItems );
+
+ TInt err = iHomescreenSettings->SetSettingsL( KId, settingItems, EFalse );
+ if ( err )
+ {
+ EUNIT_PRINT( _L( "Warning: Set plugin settings function failed" ) );
+ }
+
+ CleanupStack::Pop( &settingItems );
+ settingItems.ResetAndDestroy();
+
+ EUNIT_ASSERT( ETrue );
+ }
+
+// EUnit test table
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_HsPluginSettings,
+ "Test hspluginsettings",
+ "MODULE")
+
+EUNIT_TEST(
+ "Test GetSettingsL",
+ "GetSettingsL",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestGetSettingsL, Teardown)
+
+EUNIT_TEST(
+ "Test SetSettingsL",
+ "SetSettingsL",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestSetSettingsL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/src/mt_hspsconfiguration.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,246 @@
+/*
+* Copyright (c) 2010 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: EUnit test for homescreen settings API, hsps configuration tests
+*
+*/
+
+// External includes
+#include <digia/eunit/eunitmacros.h>
+
+// Internal includes
+#include "plugininfo.h"
+#include "pluginmap.h"
+#include "itemmap.h"
+#include "objectmap.h"
+#include "mt_hspsconfiguration.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::NewL( )
+//----------------------------------------------------------------------------
+//
+MT_HspsConfiguration* MT_HspsConfiguration::NewL()
+ {
+ MT_HspsConfiguration* self = MT_HspsConfiguration::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::NewLC( )
+//----------------------------------------------------------------------------
+//
+MT_HspsConfiguration* MT_HspsConfiguration::NewLC()
+ {
+ MT_HspsConfiguration* self = new( ELeave ) MT_HspsConfiguration();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::~MT_HspsConfiguration( )
+//----------------------------------------------------------------------------
+//
+MT_HspsConfiguration::~MT_HspsConfiguration()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::MT_HspsConfiguration( )
+//----------------------------------------------------------------------------
+//
+MT_HspsConfiguration::MT_HspsConfiguration()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::ConstructL( )
+//----------------------------------------------------------------------------
+//
+void MT_HspsConfiguration::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::SetupL( )
+//----------------------------------------------------------------------------
+//
+void MT_HspsConfiguration::SetupL( )
+ {
+ iConfiguration = HSPluginSettingsIf::CHspsConfiguration::NewL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::Teardown( )
+//----------------------------------------------------------------------------
+//
+void MT_HspsConfiguration::Teardown( )
+ {
+ if ( iConfiguration )
+ {
+ delete iConfiguration;
+ iConfiguration = NULL;
+ }
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::ConfigIdTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_HspsConfiguration::ConfigIdTestL( )
+ {
+ // First try to read Id which has not been set yet
+ TBufC8<10> id ( iConfiguration->ConfId() );
+ EUNIT_ASSERT( id.Compare( KNullDesC8 ) == 0 );
+
+ // Set new Id and try to read it
+ _LIT8( KId, "10" );
+ EUNIT_ASSERT_NO_LEAVE( iConfiguration->SetConfIdL( KId ) );
+ TBufC8<10> id2 ( iConfiguration->ConfId() );
+ EUNIT_ASSERT( id2.Compare( KId ) == 0 );
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::PluginInfoTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_HspsConfiguration::PluginInfoTestL( )
+ {
+ // HspsConfiguration creates plugininfo during construction, so
+ // test its existence
+ EUNIT_ASSERT( ( & iConfiguration->PluginInfo() ) != NULL );
+ HSPluginSettingsIf::CPluginInfo& info = iConfiguration->PluginInfo();
+
+ // Fill info with something, in teardown no memory leak should occur
+ _LIT8( KName, "My name is Nobody (Il mio nome e Nessuno)" );
+ EUNIT_ASSERT_NO_LEAVE( info.SetNameL( KName ) );
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::PluginsTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_HspsConfiguration::PluginsTestL( )
+ {
+ // First try to read map which has not been set yet
+ EUNIT_ASSERT( iConfiguration->PluginMaps().Count() == 0 );
+ RPointerArray<HSPluginSettingsIf::CPluginMap>& maps = iConfiguration->PluginMaps();
+
+ // Fill map with something, in teardown no memory leak should occur
+ TInt itemCount = 10;
+ for ( TInt i = 0; i < itemCount; i++ )
+ {
+ // Should be deleted automatically in the iConfiguration destructor,
+ // otherwise a memory leak occurs (can be considered as the last test)
+ iConfiguration->AddPluginMapL( HSPluginSettingsIf::CPluginMap::NewL() );
+ }
+
+ // Test if the items were added
+ EUNIT_ASSERT( maps.Count() == itemCount );
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::ItemsTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_HspsConfiguration::ItemsTestL( )
+ {
+ // First try to read map which has not been set yet
+ EUNIT_ASSERT( iConfiguration->Settings().Count() == 0 );
+ RPointerArray<HSPluginSettingsIf::CItemMap>& maps = iConfiguration->Settings();
+
+ // Fill map with something, in teardown no memory leak should occur
+ TInt itemCount = 10;
+ for ( TInt i = 0; i < itemCount; i++ )
+ {
+ // Should be deleted automatically in the iConfiguration destructor,
+ // otherwise a memory leak occurs (can be considered as the last test)
+ iConfiguration->AddItemMapL( HSPluginSettingsIf::CItemMap::NewL() );
+ }
+
+ // Test if the items were added
+ EUNIT_ASSERT( maps.Count() == itemCount );
+ }
+
+//----------------------------------------------------------------------------
+// MT_HspsConfiguration::ObjectsTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_HspsConfiguration::ObjectsTestL( )
+ {
+ // First try to read map which has not been set yet
+ EUNIT_ASSERT( iConfiguration->Resources().Count() == 0 );
+ RPointerArray<HSPluginSettingsIf::CObjectMap>& maps = iConfiguration->Resources();
+
+ // Fill map with something, in teardown no memory leak should occur
+ TInt itemCount = 10;
+ for ( TInt i = 0; i < itemCount; i++ )
+ {
+ // Should be deleted automatically in the iConfiguration destructor,
+ // otherwise a memory leak occurs (can be considered as the last test)
+ iConfiguration->AddObjectMapL( HSPluginSettingsIf::CObjectMap::NewL() );
+ }
+
+ // Test if the items were added
+ EUNIT_ASSERT( maps.Count() == itemCount );
+ }
+
+// EUnit test table
+EUNIT_BEGIN_TEST_TABLE(
+ MT_HspsConfiguration,
+ "Test for the CPluginMap basic functionality",
+ "MODULE")
+
+
+EUNIT_TEST(
+ "Test ConfigId Set Get functionality",
+ "CHSPSConfiguration",
+ "SetConfIdL, ConfId",
+ "FUNCTIONALITY",
+ SetupL, ConfigIdTestL, Teardown)
+
+EUNIT_TEST(
+ "Test PluginInfo",
+ "CHSPSConfiguration",
+ "PluginInfo",
+ "FUNCTIONALITY",
+ SetupL, PluginInfoTestL, Teardown)
+
+EUNIT_TEST(
+ "Test Plugin maps",
+ "CHSPSConfiguration",
+ "PluginMaps, AddPluginMapL",
+ "FUNCTIONALITY",
+ SetupL, PluginsTestL, Teardown)
+
+EUNIT_TEST(
+ "Test Item maps",
+ "CHSPSConfiguration",
+ "Settings, AddItemMapL",
+ "FUNCTIONALITY",
+ SetupL, ItemsTestL, Teardown)
+
+EUNIT_TEST(
+ "Test Object maps",
+ "CHSPSConfiguration",
+ "Resources, AddObjectMapL",
+ "FUNCTIONALITY",
+ SetupL, ObjectsTestL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/src/mt_hssettingsdllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 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: EUnit test for homescreen settings API, main suite
+*
+*/
+
+// External includes
+#include <digia/eunit/ceunittestsuite.h>
+
+// Internal includes
+#include <MT_Map.h>
+#include "mt_pluginmap.h"
+#include "mt_hspsconfiguration.h"
+#include <MT_HsPluginSettings.h>
+#include "mt_objectmap.h"
+#include "mt_plugininfo.h"
+
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ _LIT(KMainSuiteName, "MT_HsSettings");
+ CEUnitTestSuite* mainSuite = CEUnitTestSuite::NewLC(KMainSuiteName);
+
+ MEUnitTest* subSuite = MT_Map::NewLC();
+ mainSuite->AddL( subSuite );
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_HsPluginSettings::NewLC();
+ mainSuite->AddL( subSuite );
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_PluginMap::NewLC();
+ mainSuite->AddL( subSuite );
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_HspsConfiguration::NewLC();
+ mainSuite->AddL( subSuite );
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_ObjectMap::NewLC();
+ mainSuite->AddL( subSuite );
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_PluginInfo::NewLC();
+ mainSuite->AddL( subSuite );
+ CleanupStack::Pop(); // subSuite
+
+ CleanupStack::Pop(mainSuite);
+ return mainSuite;
+ }
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/src/mt_map.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 2009 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: EUnit test for homescreen settings API, main suite
+*
+*/
+
+// External includes
+#include <digia/eunit/eunitmacros.h>
+
+// Internal includes
+#include <itemmap.h>
+#include <propertymap.h>
+#include <MT_Map.h>
+
+// ======== MEMBER FUNCTIONS ========
+
+//----------------------------------------------------------------------------
+// MT_Map::NewL( )
+//----------------------------------------------------------------------------
+//
+MT_Map* MT_Map::NewL()
+ {
+ MT_Map* self = MT_Map::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::NewLC( )
+//----------------------------------------------------------------------------
+//
+MT_Map* MT_Map::NewLC()
+ {
+ MT_Map* self = new( ELeave ) MT_Map();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::~MT_Map( )
+//----------------------------------------------------------------------------
+//
+MT_Map::~MT_Map()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::MT_Map( )
+//----------------------------------------------------------------------------
+//
+MT_Map::MT_Map()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::ConstructL( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::SetupL( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::SetupL( )
+ {
+ iItemMap = HSPluginSettingsIf::CItemMap::NewL();
+ iPropertyMap = HSPluginSettingsIf::CPropertyMap::NewL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::Teardown( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::Teardown( )
+ {
+ if( iItemMap )
+ {
+ delete iItemMap;
+ iItemMap = NULL;
+ }
+
+ if( iPropertyMap )
+ {
+ delete iPropertyMap;
+ iPropertyMap = NULL;
+ }
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::TeardownPropertyMap( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::TeardownPropertyMap( )
+ {
+ if( iItemMap )
+ {
+ delete iItemMap;
+ iItemMap = NULL;
+ }
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::TestItemIdL( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::TestItemIdL()
+ {
+ iItemMap->SetItemIdL( _L8( "12" ) );
+ const TDesC8& itemIdVal = iItemMap->ItemId();
+ EUNIT_ASSERT( itemIdVal == _L8( "12" ) );
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::TestItemNameL( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::TestItemNameL()
+ {
+ iItemMap->SetItemNameL( _L8( "item name" ) );
+ const TDesC8& itemNameVal = iItemMap->ItemName();
+ EUNIT_ASSERT( itemNameVal == _L8( "item name" ) );
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::TestPropertyNameL( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::TestPropertyNameL()
+ {
+ iPropertyMap->SetNameL( _L8( "property name" ) );
+ const TDesC8& propertyNameVal = iPropertyMap->Name();
+ EUNIT_ASSERT( propertyNameVal == _L8( "property name" ) );
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::TestPropertyValueL( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::TestPropertyValueL()
+ {
+ iPropertyMap->SetValueL( _L8( "property value" ) );
+ const TDesC8& propertyValueVal = iPropertyMap->Value();
+ EUNIT_ASSERT( propertyValueVal == _L8( "property value" ) );
+ }
+
+//----------------------------------------------------------------------------
+// MT_Map::TestPropertyMapL( )
+//----------------------------------------------------------------------------
+//
+void MT_Map::TestPropertyMapL()
+ {
+ iPropertyMap->SetNameL( _L8( "property name" ) );
+ const TDesC8& propertyNameVal = iPropertyMap->Name();
+ EUNIT_ASSERT( propertyNameVal == _L8( "property name" ) );
+
+ iPropertyMap->SetValueL( _L8( "property value" ) );
+ const TDesC8& propertyValueVal = iPropertyMap->Value();
+ EUNIT_ASSERT( propertyValueVal == _L8( "property value" ) );
+
+ RPointerArray< HSPluginSettingsIf::CPropertyMap >& iProperties = iItemMap->Properties();
+ EUNIT_ASSERT( iProperties.Count() == 0 );
+ iItemMap->AddPropertyMapL( iPropertyMap );
+ EUNIT_ASSERT( iProperties.Count() == 1 );
+ }
+
+// EUnit test table
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_Map,
+ "Test MAiPluginTool implementation returned from AiUtility::CreatePluginToolL",
+ "MODULE")
+
+EUNIT_TEST(
+ "Test SetItemIdL, ItemId",
+ "SetItemIdL, ItemId",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestItemIdL, Teardown)
+
+EUNIT_TEST(
+ "Test SetItemNameL, ItemName",
+ "SetItemNameL, ItemName",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestItemNameL, Teardown)
+
+EUNIT_TEST(
+ "Test SetNameL, Name",
+ "SetNameL, Name",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestPropertyNameL, Teardown)
+
+EUNIT_TEST(
+ "Test SetValueL, Value",
+ "SetValueL, Value",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestPropertyValueL, Teardown)
+
+EUNIT_TEST(
+ "Test AddPropertyMapL, Properties",
+ "AddPropertyMapL, Properties",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestPropertyMapL, TeardownPropertyMap)
+
+EUNIT_END_TEST_TABLE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/src/mt_objectmap.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* Copyright (c) 2010 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: EUnit test for homescreen settings API, object map tests
+*
+*/
+
+// External includes
+#include <digia/eunit/eunitmacros.h>
+
+// Internal includes
+#include "mt_objectmap.h"
+#include "objectmap.h"
+
+_LIT8(KPath,"\\path\\");
+_LIT8(KMediaType,"mediaType");
+_LIT8(KName, "Name");
+
+// ======== MEMBER FUNCTIONS ========
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::NewL( )
+//----------------------------------------------------------------------------
+//
+MT_ObjectMap* MT_ObjectMap::NewL()
+ {
+ MT_ObjectMap* self = MT_ObjectMap::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::NewLC( )
+//----------------------------------------------------------------------------
+//
+MT_ObjectMap* MT_ObjectMap::NewLC()
+ {
+ MT_ObjectMap* self = new( ELeave ) MT_ObjectMap();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::~MT_ObjectMap( )
+//----------------------------------------------------------------------------
+//
+MT_ObjectMap::~MT_ObjectMap()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::MT_ObjectMap( )
+//----------------------------------------------------------------------------
+//
+MT_ObjectMap::MT_ObjectMap()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::ConstructL( )
+//----------------------------------------------------------------------------
+//
+void MT_ObjectMap::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::SetupL( )
+//----------------------------------------------------------------------------
+//
+void MT_ObjectMap::SetupL( )
+ {
+ iObjectMap = HSPluginSettingsIf::CObjectMap::NewL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::Teardown( )
+//----------------------------------------------------------------------------
+//
+void MT_ObjectMap::Teardown( )
+ {
+ if ( iObjectMap )
+ {
+ delete iObjectMap;
+ iObjectMap = NULL;
+ }
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::SetMediaTypeTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_ObjectMap::TestMediaTypeL( )
+ {
+ EUNIT_ASSERT( iObjectMap->MediaType() == KNullDesC8 );
+
+ iObjectMap->SetMediaTypeL( KMediaType );
+ const TDesC8& mediaType = iObjectMap->MediaType();
+ EUNIT_ASSERT( mediaType == KMediaType );
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::SetNameTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_ObjectMap::TestNameL( )
+ {
+ EUNIT_ASSERT( iObjectMap->NameL() == KNullDesC8 );
+
+ iObjectMap->SetNameL( KName );
+ const TDesC8& name = iObjectMap->NameL();
+ EUNIT_ASSERT( name == KName );
+ }
+
+//----------------------------------------------------------------------------
+// MT_ObjectMap::SetPathL( )
+//----------------------------------------------------------------------------
+//
+void MT_ObjectMap::TestPathL( )
+ {
+ EUNIT_ASSERT( iObjectMap->Path() == KNullDesC8 );
+
+ iObjectMap->SetPathL( KPath );
+ const TDesC8& mediaType = iObjectMap->Path();
+ EUNIT_ASSERT( mediaType == KPath );
+ }
+
+// EUnit test table
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_ObjectMap,
+ "Test CObjectMap basic functionality",
+ "MODULE")
+
+EUNIT_TEST(
+ "Test SetMediaTypeL, MediaType",
+ "CObjectMap",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestMediaTypeL, Teardown)
+
+EUNIT_TEST(
+ "Test SetNameL, Name",
+ "CObjectMap",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestNameL, Teardown)
+
+EUNIT_TEST(
+ "Test SetPathL, Path",
+ "CObjectMap",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestPathL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/src/mt_plugininfo.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,218 @@
+/*
+* Copyright (c) 2010 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: EUnit test for homescreen settings API, object map tests
+*
+*/
+
+// External includes
+#include <digia/eunit/eunitmacros.h>
+
+// Internal includes
+#include "mt_plugininfo.h"
+#include "plugininfo.h"
+
+
+_LIT8(KConfigurationState,"ConfigurationState");
+_LIT8(KName, "Name");
+_LIT8(KInterface,"Interface");
+_LIT8(KType,"Type");
+_LIT8(KUid, "Uid");
+// ======== MEMBER FUNCTIONS ========
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::NewL( )
+//----------------------------------------------------------------------------
+//
+MT_PluginInfo* MT_PluginInfo::NewL()
+ {
+ MT_PluginInfo* self = MT_PluginInfo::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::NewLC( )
+//----------------------------------------------------------------------------
+//
+MT_PluginInfo* MT_PluginInfo::NewLC()
+ {
+ MT_PluginInfo* self = new( ELeave ) MT_PluginInfo();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::~MT_PluginInfo( )
+//----------------------------------------------------------------------------
+//
+MT_PluginInfo::~MT_PluginInfo()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::MT_PluginInfo( )
+//----------------------------------------------------------------------------
+//
+MT_PluginInfo::MT_PluginInfo()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::ConstructL( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginInfo::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::SetupL( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginInfo::SetupL( )
+ {
+ iPluginInfo = HSPluginSettingsIf::CPluginInfo::NewL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::Teardown( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginInfo::Teardown( )
+ {
+ if ( iPluginInfo )
+ {
+ delete iPluginInfo;
+ iPluginInfo = NULL;
+ }
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::TestConfigurationState( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginInfo::TestConfigurationStateL()
+ {
+ EUNIT_ASSERT( iPluginInfo->ConfigurationState() == KNullDesC8 );
+
+ iPluginInfo->SetConfigurationStateL( KConfigurationState );
+ const TDesC8& config = iPluginInfo->ConfigurationState();
+ EUNIT_ASSERT( config == KConfigurationState );
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::TestName( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginInfo::TestNameL()
+ {
+ EUNIT_ASSERT( iPluginInfo->Name() == KNullDesC8 );
+
+ iPluginInfo->SetNameL( KName );
+ const TDesC8& name = iPluginInfo->Name();
+ EUNIT_ASSERT( name == KName );
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::TestInterface( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginInfo::TestInterfaceL()
+ {
+ EUNIT_ASSERT( iPluginInfo->Interface() == KNullDesC8 );
+
+ iPluginInfo->SetInterfaceL( KInterface );
+ const TDesC8& interface = iPluginInfo->Interface();
+ EUNIT_ASSERT( interface == KInterface );
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::TestType( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginInfo::TestTypeL()
+ {
+ EUNIT_ASSERT( iPluginInfo->Type() == KNullDesC8 );
+
+ iPluginInfo->SetTypeL( KType );
+ const TDesC8& type = iPluginInfo->Type();
+ EUNIT_ASSERT( type == KType );
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginInfo::TestUid( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginInfo::TestUidL()
+ {
+ EUNIT_ASSERT( iPluginInfo->Uid() == KNullDesC8 );
+
+ iPluginInfo->SetUidL( KUid );
+ const TDesC8& uid = iPluginInfo->Uid();
+ EUNIT_ASSERT( uid == KUid );
+ }
+
+//----------------------------------------------------------------------------
+
+
+// EUnit test table
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_PluginInfo,
+ "Test CPluginInfo basic functionality",
+ "MODULE")
+
+
+EUNIT_TEST(
+ "Test SetConfigurationStateL, TestConfigurationState",
+ "CPluginInfo",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestConfigurationStateL, Teardown)
+
+EUNIT_TEST(
+ "Test SetNameL, Name",
+ "CPluginInfo",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestNameL, Teardown)
+
+EUNIT_TEST(
+ "Test SetInterfaceL, Interface",
+ "CPluginInfo",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestInterfaceL, Teardown)
+
+EUNIT_TEST(
+ "Test SetTypeL, Type",
+ "CPluginInfo",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestTypeL, Teardown)
+
+EUNIT_TEST(
+ "Test SetUidL, Uid",
+ "CPluginInfo",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestUidL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/homescreensrv_plat/hs_settings_api/tsrc/src/mt_pluginmap.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,157 @@
+/*
+* Copyright (c) 2010 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: EUnit test for homescreen settings API, plugin map tests
+*
+*/
+
+// External includes
+#include <digia/eunit/eunitmacros.h>
+
+// Internal includes
+#include "pluginmap.h"
+#include "mt_pluginmap.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::NewL( )
+//----------------------------------------------------------------------------
+//
+MT_PluginMap* MT_PluginMap::NewL()
+ {
+ MT_PluginMap* self = MT_PluginMap::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::NewLC( )
+//----------------------------------------------------------------------------
+//
+MT_PluginMap* MT_PluginMap::NewLC()
+ {
+ MT_PluginMap* self = new( ELeave ) MT_PluginMap();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::~MT_PluginMap( )
+//----------------------------------------------------------------------------
+//
+MT_PluginMap::~MT_PluginMap()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::MT_PluginMap( )
+//----------------------------------------------------------------------------
+//
+MT_PluginMap::MT_PluginMap()
+ {
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::ConstructL( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginMap::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::SetupL( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginMap::SetupL( )
+ {
+ iPluginMap = HSPluginSettingsIf::CPluginMap::NewL();
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::Teardown( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginMap::Teardown( )
+ {
+ if ( iPluginMap )
+ {
+ delete iPluginMap;
+ iPluginMap = NULL;
+ }
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::PluginIdTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginMap::PluginIdTestL( )
+ {
+ // First try to read Id which has not been set yet
+ TBufC8<10> id ( iPluginMap->PluginId() );
+ EUNIT_ASSERT( ( id.Compare( KNullDesC8 ) == 0 ) );
+
+ // Set new Id and try to read it
+ _LIT8( KId, "10" );
+ iPluginMap->SetPluginIdL( KId );
+ TBufC8<10> id2 ( iPluginMap->PluginId() );
+ EUNIT_ASSERT( ( id2.Compare( KId ) == 0 ) );
+ }
+
+//----------------------------------------------------------------------------
+// MT_PluginMap::PluginUidTestL( )
+//----------------------------------------------------------------------------
+//
+void MT_PluginMap::PluginUidTestL( )
+ {
+ // First try to read Uid which has not been set yet
+ TBufC8<10> uid( iPluginMap->PluginUid() );
+ EUNIT_ASSERT( ( uid.Compare( KNullDesC8 ) == 0 ) );
+
+ // Set new Uid and try to read it
+ _LIT8( KUid, "10" );
+ iPluginMap->SetPluginUidL( KUid );
+ TBufC8<10> uid2( iPluginMap->PluginUid() );
+ EUNIT_ASSERT( ( uid2.Compare( KUid ) == 0 ) );
+ }
+
+// EUnit test table
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_PluginMap,
+ "Test for the CPluginMap basic functionality",
+ "MODULE")
+
+
+EUNIT_TEST(
+ "Test SetId, GetId",
+ "CPluginMap",
+ "SetPluginIdL, PluginId",
+ "FUNCTIONALITY",
+ SetupL, PluginIdTestL, Teardown)
+
+EUNIT_TEST(
+ "Test SetUid, GetUid",
+ "CPluginMap",
+ "SetPluginUidL, PluginUid",
+ "FUNCTIONALITY",
+ SetupL, PluginUidTestL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/bwins/mt_apiaiutilsu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/eabi/mt_apiaiutilsu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/group/ai_utilities_api.pkg Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,33 @@
+;
+; Copyright (c) 2009 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:
+;
+
+;Language - standard language definitions
+&EN
+
+; standard SIS file header
+#{"ai_utilities"},(0x0ACB3350),1,0,0
+
+;Supports Series 60 v 3.0
+(0x101F7961), 0, 0, 0, {"Series60ProductID"}
+
+;Localized Vendor Name
+%{"My Test EN"}
+
+;Unique Vendor name
+:"Vendor"
+
+; Files to copy
+"\epoc32\release\armv5\urel\mt_apiaiutils.dll"-"!:\sys\bin\mt_apiaiutils.dll"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2005 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: aiutils.dll unit test build file.
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+mt_apiaiutils.mmp
+
+
+PRJ_TESTEXPORTS
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/group/mt_apiaiutils.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2009 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 <platform_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET mt_apiaiutils.dll
+TARGETTYPE dll
+UID 0x1000af5a 0x017000F3
+
+CAPABILITY EUNIT_CAPS
+
+SOURCEPATH ../src
+SOURCE mt_apiaiutilsdllmain.cpp
+SOURCE mt_apiaicontentitemarrayiterator.cpp
+SOURCE mt_apiaipspropertyobserver.cpp
+SOURCE mt_apicontentprioritymap.cpp
+SOURCE mt_apiaistrparser.cpp
+SOURCE mt_apiaiplugintool.cpp
+SOURCE mt_apiaipluginsettings.cpp
+
+USERINCLUDE ../inc
+
+MW_LAYER_SYSTEMINCLUDE
+
+SYSTEMINCLUDE ../inc
+SYSTEMINCLUDE /epoc32/tools
+
+LIBRARY euser.lib charconv.lib eunit.lib
+
+// Module under test
+LIBRARY aiutils.lib
+
+LIBRARY ecom.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/caipspropertyobserver.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,108 @@
+/*
+* Copyright (c) 2005-2006 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:
+*
+*/
+
+
+#ifndef C_CPSPROPERTYOBSERVER_H
+#define C_CPSPROPERTYOBSERVER_H
+
+#include <e32base.h>
+#include <e32property.h>
+#include "aipspropertyobserver.h"
+
+/**
+ * Publish and subscribe key observer
+ *
+ * @lib aiutils.lib
+ * @since S60 3.2
+ */
+
+NONSHARABLE_CLASS(CPSPropertyObserver) :
+ public CActive, public MAiPSPropertyObserver
+ {
+
+public:
+
+ /**
+ * Two-phased constructor.
+ */
+ static CPSPropertyObserver* NewL (TCallBack aCallBack, TUid aCategory, TInt aKey);
+
+ /**
+ * Destructor.
+ */
+ ~CPSPropertyObserver();
+
+ /**
+ * Release the observer
+ */
+ void Release();
+
+// from base class CActive
+
+ void RunL();
+
+ void DoCancel();
+
+// from base class MAiPSPropertyObserver
+
+ TInt Get( TInt& aValue );
+
+ TInt Get( TDes8& aString );
+
+ TInt Get( TDes16& aString );
+
+private:
+
+ /**
+ * By default Symbian 2nd phase constructor is private.
+ */
+ void ConstructL();
+
+ /**
+ * C++ default constructor.
+ */
+ CPSPropertyObserver( TCallBack aCallBack,
+ TUid aCategory,
+ TInt aKey );
+
+private:
+
+ /**
+ * Callback member
+ */
+ TCallBack iCallBack;
+
+ /**
+ * PS category id
+ */
+ TUid iCategory;
+
+ /**
+ * PS key
+ */
+ TInt iKey;
+
+ /**
+ * Property member
+ */
+ RProperty iProperty;
+
+ };
+
+#endif // C_CPSPROPERTYOBSERVER_H
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/caouserafter.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,90 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef __CAOUSERAFTER_H__
+#define __CAOUSERAFTER_H__
+
+// INCLUDES
+#include <e32base.h>
+#include <e32svr.h>
+#include <coemain.h>
+
+
+/**
+ * Active object version of User::After()
+ */
+class CAOUserAfter : public CTimer
+ {
+ private:
+ CActiveSchedulerWait iWait;
+ TInt iLength;
+
+
+ public: //new functions
+
+ /**
+ * Constructs the waiting timer, executes
+ * it and when timer expires, deletes self.
+ * @param aLength The lenghth of wait in micro
+ * seconds.
+ */
+ static void AfterLD( TInt aLenght )
+ {
+ CAOUserAfter* wait= new ( ELeave ) CAOUserAfter( aLenght );
+ CleanupStack::PushL( wait );
+ wait->ConstructL();
+ CleanupStack::Pop();
+
+ RDebug::Print( _L("CAOUserAfter - Starting time consuming...") );
+ wait->StartWaitD();
+ RDebug::Print( _L("CAOUserAfter - completed.") );
+ }
+
+ private:
+ CAOUserAfter( TInt aLenght )
+ : CTimer( CActive::EPriorityStandard ),
+ iLength( aLenght )
+ {
+ }
+
+ void ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add( this );
+ }
+
+ virtual ~CAOUserAfter()
+ {
+ }
+
+ void StartWaitD()
+ {
+ After( iLength );
+ iWait.Start();
+ }
+
+ void RunL()
+ {
+ iWait.AsyncStop();
+ Cancel();
+ delete this;
+ }
+ };
+
+#endif // __CAOUSERAFTER_H__
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/contentprioritymap.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,100 @@
+/*
+* Copyright (c) 2005-2006 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:
+*
+*/
+
+
+#ifndef C_CONTENTPRIORITYMAP_H
+#define C_CONTENTPRIORITYMAP_H
+
+#include <e32base.h>
+#include <e32hashtab.h>
+
+namespace AiUtility {
+
+/**
+ * Content priority map for UI controllers.
+ *
+ * @lib aiutils.lib
+ * @since S60 3.2
+ */
+class CContentPriorityMap : public CBase
+ {
+
+public:
+ /**
+ * Creates and returns a new instance of this class.
+ *
+ * @post CurrentPriority(*) == KErrNotFound
+ */
+ IMPORT_C static CContentPriorityMap* NewL();
+
+ virtual ~CContentPriorityMap();
+
+ /**
+ * Returns the current priority assigned to UI element.
+ *
+ * @param aUiElementId textual identifier of the UI element.
+ * @return Current priority set to ui element or KErrNotFound if not set.
+ */
+ IMPORT_C TInt CurrentPriority( const TDesC8& aUiElementId ) const;
+
+ /**
+ * Sets the current priority assigned to UI element.
+ *
+ * @param aUiElementId textual identifier of the UI element.
+ * @param aPriority priority value to set.
+ * @return KErrNone if priority was set succesfully, otherwise one of
+ * the system-wide error codes.
+ * @post CurrentPriority(aUiElementId) == aPriority
+ */
+ IMPORT_C TInt SetCurrentPriority( const TDesC8& aUiElementId, TInt aPriority );
+
+ /**
+ * Clears the current priority assigned to UI element.
+ *
+ * @param aUiElementId textual identifier of the UI element.
+ * @post CurrentPriority(aUiElementId) == KErrNotFound
+ */
+ IMPORT_C void ClearPriority( const TDesC8& aUiElementId );
+
+ /**
+ * Clears all priority assignments of this map.
+ */
+ IMPORT_C void Reset();
+
+ /**
+ * Tests if content with given priority may override
+ * current content in given ui element.
+ *
+ * @param aUiElementId textual identifier of the UI element.
+ * @param aNewPriority priority of the new content.
+ */
+ IMPORT_C TBool OverrideContent( const TDesC8& aUiElementId, TInt aNewPriority ) const;
+
+private:
+
+ CContentPriorityMap();
+
+private: // data
+
+ RPtrHashMap<TDesC8,TInt> iPriorityMap;
+
+ };
+
+
+} // namespace AiUtility
+
+#endif // C_CONTENTPRIORITYMAP_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/mt_apiaicontentitemarrayiterator.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,83 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef __MT_ApiAiContentItemArrayIterator_H__
+#define __MT_ApiAiContentItemArrayIterator_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// INTERNAL INCLUDES
+
+
+// FORWARD DECLARATIONS
+
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_ApiAiContentItemArrayIterator )
+ : public CEUnitTestSuiteClass
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_ApiAiContentItemArrayIterator* NewL();
+ static MT_ApiAiContentItemArrayIterator* NewLC();
+ /**
+ * Destructor
+ */
+ ~MT_ApiAiContentItemArrayIterator();
+
+ private: // Constructors and destructors
+
+ MT_ApiAiContentItemArrayIterator();
+ void ConstructL();
+
+ public: // From observer interface
+
+
+
+ private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void TestEmptyL();
+ void TestOneL();
+ void TestManyL();
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ };
+
+#endif // __MT_ApiAiContentItemArrayIterator_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/mt_apiaipluginsettings.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef __MT_ApiAiPluginSettings_H__
+#define __MT_ApiAiPluginSettings_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <aipluginsettings.h>
+
+// INTERNAL INCLUDES
+
+
+// FORWARD DECLARATIONS
+class MAiPluginSettings;
+class MAiPluginSettingsItem;
+class MAiPluginContentItem;
+class MAiPluginConfigurationItem;
+
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_ApiAiPluginSettings )
+ : public CEUnitTestSuiteClass
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_ApiAiPluginSettings* NewL();
+ static MT_ApiAiPluginSettings* NewLC();
+ /**
+ * Destructor
+ */
+ ~MT_ApiAiPluginSettings();
+
+ private: // Constructors and destructors
+
+ MT_ApiAiPluginSettings();
+ void ConstructL();
+
+ public: // From observer interface
+
+
+
+ private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void TestAiPluginSettingsItemL();
+
+ void TestAiPluginContentItemL();
+
+ void TestAiPluginConfigurationItemL();
+
+ void TestAiPluginSettingsStorerBasicL();
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+ MAiPluginSettings* iAiPluginSettings;
+
+ };
+
+/**
+ *
+ * Additional test class.
+ * Emulates basic storing functionality
+ *
+ */
+NONSHARABLE_CLASS( TStorer ): public MAiPluginSettingsStorer
+ {
+ public:
+ TStorer( );
+ ~TStorer( );
+
+ // derived from MAiPluginSettingsStorer
+ void SaveL( TInt32 aKey, const TDesC& aValue );
+ void ReadL( TInt32 aKey, TDes& aValue );
+ // functions to set and read values
+ void SetKey( TInt32 aKey );
+ void SetValue( const TDesC aValue );
+ void GetKey( TInt32& aKey );
+ void GetValue( TDes& aValue );
+ private:
+ TInt32 iKey;
+ TBuf<40> iValue;
+ };
+
+#endif // __MT_ApiAiPluginSettings_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/mt_apiaiplugintool.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,84 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef __MT_ApiAiplugintool_H__
+#define __MT_ApiAiplugintool_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// INTERNAL INCLUDES
+
+
+// FORWARD DECLARATIONS
+class MAiPluginTool;
+class CHsContentPublisher;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_ApiAiplugintool )
+ : public CEUnitTestSuiteClass
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_ApiAiplugintool* NewL();
+ static MT_ApiAiplugintool* NewLC();
+ /**
+ * Destructor
+ */
+ ~MT_ApiAiplugintool();
+
+ private: // Constructors and destructors
+
+ MT_ApiAiplugintool();
+ void ConstructL();
+
+ public: // From observer interface
+
+
+
+ private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void TestContentItemIteratorLL();
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+ MAiPluginTool* iAiPluginTool;
+ CHsContentPublisher* iPublisher;
+
+ };
+
+#endif // __MT_ApiAiplugintool_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/mt_apiaipspropertyobserver.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,92 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef __MT_ApiAiPSPropertyObserver_H__
+#define __MT_ApiAiPSPropertyObserver_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// INTERNAL INCLUDES
+
+
+// FORWARD DECLARATIONS
+class MAiPSPropertyObserver;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_ApiAiPSPropertyObserver )
+ : public CEUnitTestSuiteClass
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_ApiAiPSPropertyObserver* NewL();
+ static MT_ApiAiPSPropertyObserver* NewLC();
+ /**
+ * Destructor
+ */
+ ~MT_ApiAiPSPropertyObserver();
+
+ private: // Constructors and destructors
+
+ MT_ApiAiPSPropertyObserver();
+ void ConstructL();
+
+ public: // From observer interface
+
+
+
+ private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void TestBasicFunctionalityL();
+
+ void TestGettersL();
+
+ void TestDoCancelL();
+
+ static TInt HandleSystemStateChangedL(TAny* aPtr);
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ MAiPSPropertyObserver* iPSObserver;
+
+ TBool iStateOk;
+
+
+ };
+
+#endif // __MT_ApiAiPSPropertyObserver_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/mt_apiaistrparser.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef MT_ApiAiStrParser_H
+#define MT_ApiAiStrParser_H
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// INTERNAL INCLUDES
+
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+class MAiStrParser;
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_ApiAiStrParser )
+ : public CEUnitTestSuiteClass
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_ApiAiStrParser* NewL();
+ static MT_ApiAiStrParser* NewLC();
+ /**
+ * Destructor
+ */
+ ~MT_ApiAiStrParser();
+
+ private: // Constructors and destructors
+
+ MT_ApiAiStrParser();
+ void ConstructL();
+
+ public: // From observer interface
+
+
+
+ private: // New methods
+
+ void SetupL();
+
+ void SetupUtf8BufferL();
+
+ void SetupUnicodeBufferL();
+
+ void SetupHexIntL();
+
+ void SetupIntL();
+
+ void SetupNoIntL();
+
+ void SetupHexIntUnicodeL();
+
+ void SetupIntUnicodeL();
+
+ void SetupNoIntUnicodeL();
+
+ void Teardown();
+
+ void TestCopyUnicodeToUnicodeL();
+
+ void TestCopyUnicodeToUtf8L();
+
+ void TestCopyUtf8ToUnicodeL();
+
+ void TestCopyUtf8ToUtf8L();
+
+ void TestParseInt();
+
+ void TestParseIntUnicode();
+
+ void TestEnsureBufMaxLengthL();
+
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ HBufC* iUnicodeBuffer;
+
+ HBufC8* iUtf8Buffer;
+
+ TInt iTestResult;
+
+ TInt32 iTestValue;
+
+ MAiStrParser* iStrParser;
+ };
+
+#endif // __UT_ActiveTransactionStack_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/inc/mt_apicontentprioritymap.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#ifndef __MT_ApiContentPriorityMap_H__
+#define __MT_ApiContentPriorityMap_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// INTERNAL INCLUDES
+
+
+// FORWARD DECLARATIONS
+namespace AiUtility
+ {
+class CContentPriorityMap;
+ }
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_ApiContentPriorityMap )
+ : public CEUnitTestSuiteClass
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_ApiContentPriorityMap* NewL();
+ static MT_ApiContentPriorityMap* NewLC();
+ /**
+ * Destructor
+ */
+ ~MT_ApiContentPriorityMap();
+
+ private: // Constructors and destructors
+
+ MT_ApiContentPriorityMap();
+ void ConstructL();
+
+ public: // From observer interface
+
+
+
+ private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void TestEmptyMapL();
+
+ void TestClearL();
+
+ void TestUpdateL();
+
+ void TestOverrideL();
+
+ void TestResetL();
+
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ AiUtility::CContentPriorityMap* iContentPriorityMap;
+
+ };
+
+#endif // __MT_ApiContentPriorityMap_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/src/mt_apiaicontentItemarrayiterator.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,262 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// CLASS UNDER TEST
+#include <aiutility.h>
+#include <aicontentmodel.h>
+
+#include <mt_apiaicontentitemarrayiterator.h>
+#include <digia/eunit/eunitmacros.h>
+
+const TInt KNonExistentItemId = -1;
+_LIT(KNonExistentItemCid, "NonExistentCid");
+
+
+
+// CONSTRUCTION
+MT_ApiAiContentItemArrayIterator* MT_ApiAiContentItemArrayIterator::NewL()
+ {
+ MT_ApiAiContentItemArrayIterator* self = MT_ApiAiContentItemArrayIterator::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+MT_ApiAiContentItemArrayIterator* MT_ApiAiContentItemArrayIterator::NewLC()
+ {
+ MT_ApiAiContentItemArrayIterator* self = new( ELeave ) MT_ApiAiContentItemArrayIterator();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+MT_ApiAiContentItemArrayIterator::~MT_ApiAiContentItemArrayIterator()
+ {
+#if _BullseyeCoverage
+ cov_write();
+#endif
+ }
+
+// Default constructor
+MT_ApiAiContentItemArrayIterator::MT_ApiAiContentItemArrayIterator()
+ {
+ }
+
+// Second phase construct
+void MT_ApiAiContentItemArrayIterator::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// METHODS
+
+
+
+void MT_ApiAiContentItemArrayIterator::SetupL( )
+ {
+ }
+
+void MT_ApiAiContentItemArrayIterator::Teardown( )
+ {
+ }
+
+void MT_ApiAiContentItemArrayIterator::TestEmptyL( )
+ {
+ MAiContentItemIterator* iter = NULL;
+ // Test that Release(NULL) does not crash
+ Release(iter);
+
+ // Test that the iterator works correctly with an empty (NULL) array
+ iter = AiUtility::CreateContentItemArrayIteratorL(NULL, 0);
+ CleanupReleasePushL(iter);
+
+ // Make two passes through the iterator to test also Reset
+ for (TInt round = 1; round <= 2; ++round)
+ {
+ EUNIT_ASSERT( !iter->HasNext() );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( iter->NextL(), KErrOverflow );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( iter->ItemL(0), KErrNotFound );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( iter->ItemL(KNullDesC), KErrNotFound );
+ iter->Reset();
+ }
+
+ CleanupStack::PopAndDestroy(iter);
+
+ // Array with negative count should work as an empty array
+ iter = AiUtility::CreateContentItemArrayIteratorL(NULL, -1);
+ CleanupReleasePushL(iter);
+
+ // Make two passes through the iterator to test also Reset
+ for (TInt round = 1; round <= 2; ++round)
+ {
+ EUNIT_ASSERT( !iter->HasNext() );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( iter->NextL(), KErrOverflow );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( iter->ItemL(0), KErrNotFound );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( iter->ItemL(KNullDesC), KErrNotFound );
+ iter->Reset();
+ }
+
+ CleanupStack::PopAndDestroy(iter);
+ }
+
+TBool operator==(const TAiContentItem& aLhs, const TAiContentItem& aRhs)
+ {
+ // Use pointer comparison as CAiContentItemArrayIterator iterates through
+ // the original items
+ return (&aLhs == &aRhs);
+ }
+
+void DoTestOneL
+ ( const TAiContentItem& aRefItem, MAiContentItemIterator& aIter )
+ {
+ // Make two passes through the iterator to test also Reset
+ for (TInt pass = 1; pass <= 2; ++pass)
+ {
+ EUNIT_ASSERT( aIter.HasNext() );
+ EUNIT_ASSERT_EQUALS( aRefItem, aIter.NextL() );
+ EUNIT_ASSERT( !aIter.HasNext() );
+
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.NextL(), KErrOverflow );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.ItemL(KNonExistentItemId), KErrNotFound );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.ItemL(KNonExistentItemCid), KErrNotFound );
+
+ EUNIT_ASSERT_EQUALS( aRefItem, aIter.ItemL(aRefItem.id) );
+ EUNIT_ASSERT_EQUALS( aRefItem, aIter.ItemL(ContentCid(aRefItem)) );
+
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.ItemL(KNonExistentItemId), KErrNotFound );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.ItemL(KNonExistentItemCid), KErrNotFound );
+
+ aIter.Reset();
+ }
+ }
+
+void MT_ApiAiContentItemArrayIterator::TestOneL( )
+ {
+ const TInt KTestId = 42;
+ static const wchar_t KTestCid[] = L"testcid";
+ static const char KTestType[] = "testtype";
+ static const TAiContentItem KOneItem[] = { { KTestId, KTestCid, KTestType } };
+
+ // Test iterator created with NewL
+ MAiContentItemIterator* iter =
+ AiUtility::CreateContentItemArrayIteratorL(KOneItem, 1);
+ CleanupReleasePushL(iter);
+ DoTestOneL( KOneItem[0], *iter );
+ CleanupStack::PopAndDestroy(iter);
+
+ // Test iterator created with create template helper
+ iter = AiUtility::CreateContentItemArrayIteratorL(KOneItem);
+ CleanupReleasePushL(iter);
+ DoTestOneL( KOneItem[0], *iter );
+ CleanupStack::PopAndDestroy(iter);
+ }
+
+void DoTestManyL
+ ( const TAiContentItem& aRefItem, MAiContentItemIterator& aIter, TInt aCount )
+ {
+ // Make two passes through the iterator to test also Reset
+ for (TInt pass = 1; pass <= 2; ++pass)
+ {
+ TBool refItemIndex = -1;
+ for ( TInt count = 0; count < aCount; ++count )
+ {
+ EUNIT_ASSERT( aIter.HasNext() );
+ if (aIter.NextL() == aRefItem)
+ {
+ refItemIndex = count;
+ }
+ }
+ EUNIT_ASSERT( refItemIndex >= 0 );
+ EUNIT_ASSERT( !aIter.HasNext() );
+
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.NextL(), KErrOverflow );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.ItemL(KNonExistentItemId), KErrNotFound );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.ItemL(KNonExistentItemCid), KErrNotFound );
+
+ EUNIT_ASSERT_EQUALS( aRefItem, aIter.ItemL(aRefItem.id) );
+ EUNIT_ASSERT_EQUALS( aRefItem, aIter.ItemL(ContentCid(aRefItem)) );
+
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.ItemL(KNonExistentItemId), KErrNotFound );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( aIter.ItemL(KNonExistentItemCid), KErrNotFound );
+
+ aIter.Reset();
+ }
+ }
+
+void MT_ApiAiContentItemArrayIterator::TestManyL( )
+ {
+ const TInt KTestId1 = 42;
+ static const wchar_t KTestCid1[] = L"testcid1";
+ static const char KTestType1[] = "testtype1";
+ const TInt KTestId2 = 53;
+ static const wchar_t KTestCid2[] = L"testcid2";
+ static const char KTestType2[] = "testtype2";
+ static const TAiContentItem KTwoItems[] =
+ {
+ { KTestId1, KTestCid1, KTestType1 },
+ { KTestId2, KTestCid2, KTestType2 }
+ };
+
+ // Test iterator created with NewL
+ MAiContentItemIterator* iter =
+ AiUtility::CreateContentItemArrayIteratorL(KTwoItems, 2);
+ CleanupReleasePushL(iter);
+ DoTestManyL( KTwoItems[0], *iter, 2 );
+ DoTestManyL( KTwoItems[1], *iter, 2 );
+ CleanupStack::PopAndDestroy(iter);
+
+ // Test iterator created with template helper
+ iter = AiUtility::CreateContentItemArrayIteratorL(KTwoItems);
+ CleanupReleasePushL(iter);
+ DoTestManyL( KTwoItems[0], *iter, 2 );
+ DoTestManyL( KTwoItems[1], *iter, 2 );
+ CleanupStack::PopAndDestroy(iter);
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_ApiAiContentItemArrayIterator,
+ "Unit test suite for MAiContentItemIterator implementation returned from AiUtility::CreateContentItemArrayIteratorL",
+ "CAiContentItemArrayIterator" )
+
+EUNIT_TEST(
+ "Test empty (NULL) array",
+ "MAiContentItemIterator",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestEmptyL, Teardown)
+
+EUNIT_TEST(
+ "Test array with one item",
+ "MAiContentItemIterator",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestOneL, Teardown)
+
+EUNIT_TEST(
+ "Test array with multiple items",
+ "MAiContentItemIteratore",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestManyL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/src/mt_apiaipluginsettings.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,267 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// CLASS UNDER TEST
+#include <caouserafter.h>
+#include <aiutility.h>
+#include <aiplugintool.h>
+#include <mt_apiaipluginsettings.h>
+
+#include <aisystemuids.hrh>
+#include <aipluginsettings.h>
+
+#include <digia/eunit/eunitmacros.h>
+
+class TStorer;
+
+// CONSTRUCTION
+MT_ApiAiPluginSettings* MT_ApiAiPluginSettings::NewL()
+ {
+ MT_ApiAiPluginSettings* self = MT_ApiAiPluginSettings::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+MT_ApiAiPluginSettings* MT_ApiAiPluginSettings::NewLC()
+ {
+ MT_ApiAiPluginSettings* self = new( ELeave ) MT_ApiAiPluginSettings();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+MT_ApiAiPluginSettings::~MT_ApiAiPluginSettings()
+ {
+#if _BullseyeCoverage
+ cov_write();
+#endif
+ }
+
+// Default constructor
+MT_ApiAiPluginSettings::MT_ApiAiPluginSettings()
+ {
+ }
+
+// Second phase construct
+void MT_ApiAiPluginSettings::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+
+ //CAOUserAfter::AfterLD( 2 * 1000000 );
+ }
+
+// METHODS
+
+void MT_ApiAiPluginSettings::SetupL( )
+ {
+ iAiPluginSettings = AiUtility::CreatePluginSettingsL();
+ }
+
+void MT_ApiAiPluginSettings::Teardown( )
+ {
+ if( iAiPluginSettings )
+ {
+ delete iAiPluginSettings;
+ iAiPluginSettings = NULL;
+ }
+
+ }
+
+void MT_ApiAiPluginSettings::TestAiPluginSettingsItemL( )
+ {
+ MAiPluginSettingsItem& item = iAiPluginSettings->AiPluginSettingsItem();
+
+ item.SetPublisherId( TUid::Uid( 0x10170FFF ) );
+ item.SetValueL( _L("DesValue") );
+ item.SetKey( 1 );
+
+ EUNIT_ASSERT( item.PublisherId() == TUid::Uid( 0x10170FFF ) );
+ EUNIT_ASSERT( item.Value().Compare( _L("DesValue")) == 0 );
+ EUNIT_ASSERT( item.Key() == 1 );
+
+ TInt type = iAiPluginSettings->AiPluginItemType();
+
+ }
+
+void MT_ApiAiPluginSettings::TestAiPluginContentItemL( )
+ {
+ MAiPluginContentItem& contentItem = iAiPluginSettings->AiPluginContentItem();
+
+ contentItem.SetNameL(_L("ContentItemName"));
+ contentItem.SetTypeL(_L("ContentItemType"));
+
+ EUNIT_ASSERT( contentItem.Name().Compare( _L("ContentItemName")) == 0 );
+ EUNIT_ASSERT( contentItem.Type().Compare( _L("ContentItemType")) == 0 );
+ }
+
+void MT_ApiAiPluginSettings::TestAiPluginConfigurationItemL( )
+ {
+ MAiPluginConfigurationItem& configurationItem = iAiPluginSettings->AiPluginConfigurationItem();
+
+ configurationItem.SetOwnerL(_L("ConfigurationItemOwner"));
+ configurationItem.SetNameL( _L("ConfigurationItemName") );
+ configurationItem.SetValueL( _L("ConfigurationItemValue") );
+
+ EUNIT_ASSERT( configurationItem.Owner().Compare( _L("ConfigurationItemOwner")) == 0 );
+ EUNIT_ASSERT( configurationItem.Name().Compare( _L("ConfigurationItemName")) == 0 );
+ EUNIT_ASSERT( configurationItem.Value().Compare( _L("ConfigurationItemValue")) == 0 );
+ }
+
+void MT_ApiAiPluginSettings::TestAiPluginSettingsStorerBasicL( )
+ {
+ //Get settings item
+ MAiPluginSettingsItem& item = iAiPluginSettings->AiPluginSettingsItem();
+
+ // test situation the storer is not set, value is not set
+ // should do nothing
+ EUNIT_ASSERT_NO_LEAVE( item.ReadFromStoreL() );
+ EUNIT_ASSERT_NO_LEAVE( item.SaveToStoreL() );
+
+ // test very basic storer functionality when key and value are set
+ // correctly
+ TStorer storer;
+ item.SetStorer( &storer );
+ TInt32 key = 0x20A;
+ TBuf<20> value( _L("VALUE") );
+ item.SetKey( key );
+ item.SetValueL( value );
+
+ // Store data to the storer and test storer if the result is stored
+ EUNIT_ASSERT_NO_LEAVE( item.SaveToStoreL() );
+ TInt32 keyRes;
+ TBuf<20> valueRes;
+ storer.GetKey( keyRes );
+ storer.GetValue( valueRes );
+ EUNIT_ASSERT( key == keyRes );
+ EUNIT_ASSERT( value.Compare( valueRes ) == 0 );
+
+ // Read data from the storer and test if the result is read
+ TBuf<20> valueBuf;
+ valueBuf.SetLength(20);
+ // iValue is allocated according to length of input string, erase iValue
+ item.SetValueL( valueBuf );
+ EUNIT_ASSERT_NO_LEAVE( item.ReadFromStoreL() );
+ EUNIT_ASSERT( value.Compare( item.Value() )==0 );
+ }
+
+// Storer class implementation
+TStorer::TStorer( )
+ {
+
+ }
+
+TStorer::~TStorer( )
+ {
+
+ }
+
+void TStorer::SaveL( TInt32 aKey, const TDesC& aValue )
+ {
+ iKey = aKey;
+ if ( aValue.Length()>iValue.MaxLength() )
+ {
+ User::Leave( KErrArgument );
+ }
+ iValue.SetLength( 0 );
+ iValue.Copy( aValue );
+ }
+
+void TStorer::ReadL( TInt32 aKey, TDes& aValue )
+ {
+ if ( aKey != iKey )
+ {
+ User::Leave( KErrArgument );
+ }
+ if ( aValue.MaxLength()<iValue.Length() )
+ {
+ User::Leave( KErrArgument );
+ }
+ aValue.SetLength( 0 );
+ aValue.Copy( iValue );
+ }
+
+void TStorer::SetKey( TInt32 aKey )
+ {
+ iKey = aKey;
+ }
+
+void TStorer::SetValue( const TDesC aValue )
+ {
+ if ( aValue.Length()<=iValue.MaxLength() )
+ {
+ iValue.SetLength( 0 );
+ iValue.Copy( aValue );
+ }
+ }
+
+void TStorer::GetKey( TInt32& aKey )
+ {
+ aKey = iKey;
+ }
+
+void TStorer::GetValue( TDes& aValue )
+ {
+ if ( aValue.MaxLength()>=iValue.Length() )
+ {
+ aValue.SetLength( 0 );
+ aValue.Copy( iValue );
+
+ }
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_ApiAiPluginSettings,
+ "Test AiPluginSettingsItem implementation returned from AiUtility::CreatePluginToolL",
+ "MODULE")
+
+EUNIT_TEST(
+ "Test AiPluginSettingsItem",
+ "AiPluginSettingsItem",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestAiPluginSettingsItemL, Teardown)
+
+EUNIT_TEST(
+ "Test AiPluginContentItem",
+ "AiPluginContentItem",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestAiPluginContentItemL, Teardown)
+
+EUNIT_TEST(
+ "Test AiPluginConfigurationItem",
+ "AiPluginConfigurationItem",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestAiPluginConfigurationItemL, Teardown)
+
+EUNIT_TEST(
+ "Test TestAiPluginSettingsStorerBasicL",
+ "TestAiPluginSettingsStorerBasicL",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestAiPluginSettingsStorerBasicL, Teardown)
+
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/src/mt_apiaiplugintool.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,120 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// CLASS UNDER TEST
+#include <caouserafter.h>
+#include <aiutility.h>
+#include <aiplugintool.h>
+#include <mt_apiaiplugintool.h>
+
+#include <aisystemuids.hrh>
+//#include <aicontentpublisher.h>
+
+#include <digia/eunit/eunitmacros.h>
+
+
+// CONSTRUCTION
+MT_ApiAiplugintool* MT_ApiAiplugintool::NewL()
+ {
+ MT_ApiAiplugintool* self = MT_ApiAiplugintool::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+MT_ApiAiplugintool* MT_ApiAiplugintool::NewLC()
+ {
+ MT_ApiAiplugintool* self = new( ELeave ) MT_ApiAiplugintool();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+MT_ApiAiplugintool::~MT_ApiAiplugintool()
+ {
+#if _BullseyeCoverage
+ cov_write();
+#endif
+ }
+
+// Default constructor
+MT_ApiAiplugintool::MT_ApiAiplugintool()
+ {
+ }
+
+// Second phase construct
+void MT_ApiAiplugintool::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+
+ //CAOUserAfter::AfterLD( 2 * 1000000 );
+ }
+
+// METHODS
+
+void MT_ApiAiplugintool::SetupL( )
+ {
+ iAiPluginTool = AiUtility::CreatePluginToolL();
+ }
+
+void MT_ApiAiplugintool::Teardown( )
+ {
+ if( iPublisher )
+ {
+ iPublisher->Stop( CHsContentPublisher::ESystemShutdown );
+ delete iPublisher;
+ iPublisher = NULL;
+ }
+
+ Release( iAiPluginTool );
+ }
+
+void MT_ApiAiplugintool::TestContentItemIteratorLL( )
+ {
+ TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PROFILEPLUGIN };
+
+ _LIT( KDeviceStatusPluginName, "0x10275101" );
+ _LIT8( KNameSpace, "1" );
+
+ THsPublisherInfo pubInfo( uid, KDeviceStatusPluginName, KNameSpace );
+ iPublisher = CHsContentPublisher::NewL( pubInfo );
+
+ MAiContentItemIterator* itemIterator = NULL;
+ itemIterator= iAiPluginTool->ContentItemIterator( *iPublisher );
+
+ EUNIT_ASSERT( itemIterator);
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_ApiAiplugintool,
+ "Test MAiPluginTool implementation returned from AiUtility::CreatePluginToolL",
+ "MODULE")
+
+EUNIT_TEST(
+ "Test ContentItemIteratorL",
+ "ContentItemIteratorL",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestContentItemIteratorLL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/src/mt_apiaipspropertyobserver.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,197 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// CLASS UNDER TEST
+#include <caouserafter.h>
+#include <aiutility.h>
+#include <caipspropertyobserver.h>
+
+#include <mt_apiaipspropertyobserver.h>
+#include <digia/eunit/eunitmacros.h>
+
+const TInt KRandTestUid( 0x017000F5 );
+const TInt KRandTestKey( 0x000000FF );
+
+void ChangeKeyValueL( TInt aValue )
+ {
+ RProperty::Define( TUid::Uid( KRandTestUid ),
+ KRandTestKey,
+ RProperty::EInt );
+
+ User::LeaveIfError(
+ RProperty::Set( TUid::Uid( KRandTestUid ),
+ KRandTestKey,
+ aValue ) );
+
+ }
+
+
+// CONSTRUCTION
+MT_ApiAiPSPropertyObserver* MT_ApiAiPSPropertyObserver::NewL()
+ {
+ MT_ApiAiPSPropertyObserver* self = MT_ApiAiPSPropertyObserver::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+MT_ApiAiPSPropertyObserver* MT_ApiAiPSPropertyObserver::NewLC()
+ {
+ MT_ApiAiPSPropertyObserver* self = new( ELeave ) MT_ApiAiPSPropertyObserver();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+MT_ApiAiPSPropertyObserver::~MT_ApiAiPSPropertyObserver()
+ {
+#if _BullseyeCoverage
+ cov_write();
+#endif
+ }
+
+// Default constructor
+MT_ApiAiPSPropertyObserver::MT_ApiAiPSPropertyObserver()
+ {
+ }
+
+// Second phase construct
+void MT_ApiAiPSPropertyObserver::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+
+ ChangeKeyValueL( 5 );
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+ }
+
+// METHODS
+
+TInt MT_ApiAiPSPropertyObserver::HandleSystemStateChangedL(TAny* aPtr)
+ {
+ MT_ApiAiPSPropertyObserver* self =
+ static_cast<MT_ApiAiPSPropertyObserver*>( aPtr );
+ TInt value = 0;
+
+ self->iPSObserver->Get(value);
+
+ if ( value == 10 )
+ {
+ self->iStateOk = ETrue;
+ }
+
+ return KErrNone;
+ }
+
+void MT_ApiAiPSPropertyObserver::SetupL( )
+ {
+ iPSObserver = AiUtility::CreatePSPropertyObserverL(
+ TCallBack( HandleSystemStateChangedL, this ),
+ TUid::Uid( KRandTestUid ),
+ KRandTestKey );
+ }
+
+void MT_ApiAiPSPropertyObserver::Teardown( )
+ {
+ Release( iPSObserver );
+ }
+
+void MT_ApiAiPSPropertyObserver::TestBasicFunctionalityL( )
+ {
+ MAiPSPropertyObserver* obs = NULL;
+ // Test that Release(NULL) does not crash
+ Release(obs);
+
+ // test
+ ChangeKeyValueL( 10 );
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+ if( iStateOk )
+ {
+ EUNIT_ASSERT( ETrue );
+ return;
+ }
+ EUNIT_ASSERT( EFalse );
+ }
+
+void MT_ApiAiPSPropertyObserver::TestGettersL( )
+ {
+ TInt err = KErrNone;
+ TBuf16<100> buf16;
+ TBuf8<100> buf8;
+ TInt value = 0;
+ err = iPSObserver->Get(buf16);
+
+ EUNIT_ASSERT( err != KErrNone );
+
+ err = KErrNone;
+ err = iPSObserver->Get(buf8);
+
+ EUNIT_ASSERT( err != KErrNone );
+
+ err = iPSObserver->Get(value);
+
+ EUNIT_ASSERT( err == KErrNone );
+ EUNIT_ASSERT( value == 5 || value == 10 );
+ }
+
+void MT_ApiAiPSPropertyObserver::TestDoCancelL( )
+ {
+ iStateOk = EFalse;
+ ChangeKeyValueL( 10 );
+ Release(iPSObserver);
+ iPSObserver = NULL;
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+ if( !iStateOk ) // make sure that the change was cancelled
+ {
+ EUNIT_ASSERT( ETrue );
+ return;
+ }
+ EUNIT_ASSERT( EFalse );
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_ApiAiPSPropertyObserver,
+ "Unit test suite for MAiContentItemIterator implementation returned from AiUtility::CreateContentItemArrayIteratorL",
+ "CAiContentItemArrayIterator" )
+
+EUNIT_TEST(
+ "Test one",
+ "MAiContentItemIterator",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestBasicFunctionalityL, Teardown)
+
+EUNIT_TEST(
+ "Test one",
+ "MAiContentItemIterator",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestGettersL, Teardown)
+
+EUNIT_TEST(
+ "Test one",
+ "MAiContentItemIterator",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestDoCancelL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/src/mt_apiaistrparser.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,378 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// CLASS HEADER
+#include <mt_apiaistrparser.h>
+
+// external includes
+#include <digia/eunit/eunitmacros.h>
+#include <utf.h>
+
+// internal includes
+#include <aistrparser.h>
+#include <aiutility.h>
+#include <aistrcnv.h>
+
+// CONSTANTS
+namespace
+ {
+ _LIT( KUnicode, "Text with unicode characters ä and \x20AC" );
+ _LIT8( KUtf8, "Text" );
+ }
+
+_LIT16( KHexPrefix16, "0x" );
+
+TInt ParseInt
+ ( TInt32& aValue, const TDesC16& aStringValue )
+ {
+ const TInt pos = aStringValue.FindF( KHexPrefix16 );
+ if (pos != KErrNotFound)
+ {
+ TLex16 lex( aStringValue.Mid( pos + KHexPrefix16().Length() ) );
+ // Hex parsing needs unsigned int
+ TUint32 value = 0;
+ const TInt parseResult = lex.Val( value, EHex );
+ if ( parseResult == KErrNone )
+ {
+ aValue = value;
+ }
+ return parseResult;
+ }
+ else
+ {
+ TLex16 lex( aStringValue );
+ return lex.Val(aValue);
+ }
+ }
+
+
+// CONSTRUCTION
+MT_ApiAiStrParser* MT_ApiAiStrParser::NewL()
+ {
+ MT_ApiAiStrParser* self = MT_ApiAiStrParser::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+MT_ApiAiStrParser* MT_ApiAiStrParser::NewLC()
+ {
+ MT_ApiAiStrParser* self = new( ELeave ) MT_ApiAiStrParser();
+ CleanupStack::PushL( self );
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+MT_ApiAiStrParser::~MT_ApiAiStrParser()
+ {
+ }
+
+// Default constructor
+MT_ApiAiStrParser::MT_ApiAiStrParser()
+ {
+ }
+
+// Second phase construct
+void MT_ApiAiStrParser::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// METHODS
+
+
+void MT_ApiAiStrParser::SetupL()
+ {
+ iStrParser = AiUtility::CreateStrParserL();
+ }
+
+void MT_ApiAiStrParser::SetupUtf8BufferL()
+ {
+ iStrParser = AiUtility::CreateStrParserL();
+ iUtf8Buffer = HBufC8::NewL(0);
+ }
+
+void MT_ApiAiStrParser::SetupUnicodeBufferL()
+ {
+ iStrParser = AiUtility::CreateStrParserL();
+ iUtf8Buffer = HBufC8::NewL(0);
+ }
+
+void MT_ApiAiStrParser::SetupHexIntL()
+ {
+ iStrParser = AiUtility::CreateStrParserL();
+ _LIT8( KTestValue, "0xbad" );
+ iUtf8Buffer = KTestValue().AllocL();
+ iTestValue = 0xbad;
+ iTestResult = KErrNone;
+ }
+
+void MT_ApiAiStrParser::SetupHexIntUnicodeL()
+ {
+ iStrParser = AiUtility::CreateStrParserL();
+ _LIT( KTestValue, "0xbad" );
+ iUnicodeBuffer = KTestValue().AllocL();
+ iTestValue = 0xbad;
+ iTestResult = KErrNone;
+ }
+
+void MT_ApiAiStrParser::SetupIntL()
+ {
+ iStrParser = AiUtility::CreateStrParserL();
+ _LIT8( KTestValue, "42" );
+ iUtf8Buffer = KTestValue().AllocL();
+ iTestValue = 42;
+ iTestResult = KErrNone;
+ }
+
+void MT_ApiAiStrParser::SetupIntUnicodeL()
+ {
+ iStrParser = AiUtility::CreateStrParserL();
+ _LIT( KTestValue, "42" );
+ iUnicodeBuffer = KTestValue().AllocL();
+ iTestValue = 42;
+ iTestResult = KErrNone;
+ }
+
+void MT_ApiAiStrParser::SetupNoIntL()
+ {
+ SetupUtf8BufferL();
+ iTestResult = KErrGeneral;
+ }
+
+void MT_ApiAiStrParser::SetupNoIntUnicodeL()
+ {
+ iStrParser = AiUtility::CreateStrParserL();
+ iUnicodeBuffer = HBufC::NewL(0);
+ iTestResult = KErrGeneral;
+ }
+
+void MT_ApiAiStrParser::Teardown( )
+ {
+ delete iUnicodeBuffer;
+ iUnicodeBuffer = NULL;
+
+ delete iUtf8Buffer;
+ iUtf8Buffer = NULL;
+
+ Release( iStrParser );
+ }
+
+void MT_ApiAiStrParser::TestCopyUnicodeToUnicodeL()
+ {
+ iUnicodeBuffer = iStrParser->CopyToBufferL(iUnicodeBuffer, KUnicode );
+
+ EUNIT_ASSERT( *iUnicodeBuffer == KUnicode );
+ }
+
+void MT_ApiAiStrParser::TestCopyUnicodeToUtf8L()
+ {
+ iUtf8Buffer = iStrParser->CopyToBufferL( iUtf8Buffer, KUnicode );
+
+ HBufC8* reference = CnvUtfConverter::ConvertFromUnicodeToUtf8L( KUnicode );
+
+ EUNIT_ASSERT_EQUALS( *iUtf8Buffer, *reference );
+
+ delete reference;
+ }
+
+void MT_ApiAiStrParser::TestCopyUtf8ToUnicodeL()
+ {
+ iUnicodeBuffer = iStrParser->CopyToBufferL( iUnicodeBuffer, KUtf8 );
+
+ HBufC* reference = CnvUtfConverter::ConvertToUnicodeFromUtf8L( KUtf8 );
+
+ EUNIT_ASSERT_EQUALS( *iUnicodeBuffer, *reference );
+
+ delete reference;
+ }
+
+void MT_ApiAiStrParser::TestCopyUtf8ToUtf8L()
+ {
+ iUtf8Buffer = iStrParser->CopyToBufferL( iUtf8Buffer, KUtf8 );
+
+ EUNIT_ASSERT_EQUALS( *iUtf8Buffer, KUtf8 );
+ }
+
+void MT_ApiAiStrParser::TestParseInt()
+ {
+ TInt32 value(0);
+
+ TInt result = iStrParser->ParseInt( value, *iUtf8Buffer );
+
+ EUNIT_ASSERT_EQUALS( result, iTestResult );
+
+ if ( result == KErrNone )
+ {
+ EUNIT_ASSERT_EQUALS( value, iTestValue );
+ }
+ }
+
+void MT_ApiAiStrParser::TestParseIntUnicode()
+ {
+ TInt32 value(0);
+
+ TInt result = ParseInt( value, *iUnicodeBuffer );
+
+ EUNIT_ASSERT_EQUALS( result, iTestResult );
+
+ if ( result == KErrNone )
+ {
+ EUNIT_ASSERT_EQUALS( value, iTestValue );
+ }
+ }
+
+void MT_ApiAiStrParser::TestEnsureBufMaxLengthL()
+ {
+ _LIT( KTestValue, "text1 text2 text3 " );
+ _LIT( KTestValue2, "text4" );
+ _LIT( KTestValue3, "text1 text2 text3 text4" );
+
+ HBufC* buffer = KTestValue().AllocL();
+ CleanupStack::PushL(buffer);
+ TPtr ptr = AiUtility::EnsureBufMaxLengthL(buffer , 25 );
+ ptr.Append(KTestValue2);
+
+
+
+ EUNIT_ASSERT(!ptr.Compare(KTestValue3));
+
+ CleanupStack::PopAndDestroy(buffer);
+
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_ApiAiStrParser,
+ "Unit test suite for class XmlUiController utility functions",
+ "UNIT" )
+
+EUNIT_TEST(
+ "Copy unicode to unicode, no buffer",
+ "AiXmlUiController",
+ "CopyToBufferL( HBufC16*, const TDesC16& )",
+ "FUNCTIONALITY",
+ SetupL, TestCopyUnicodeToUnicodeL, Teardown)
+
+EUNIT_TEST(
+ "Copy unicode to unicode, reallocate buffer",
+ "AiXmlUiController",
+ "CopyToBufferL( HBufC16*, const TDesC16& )",
+ "FUNCTIONALITY",
+ SetupUnicodeBufferL, TestCopyUnicodeToUnicodeL, Teardown)
+
+EUNIT_TEST(
+ "Copy UTF8 to unicode, no buffer",
+ "AiXmlUiController",
+ "CopyToBufferL( HBufC16*, const TDesC8& )",
+ "FUNCTIONALITY",
+ SetupL, TestCopyUtf8ToUnicodeL, Teardown)
+
+
+EUNIT_TEST(
+ "Copy UTF8 to unicode, reallocate buffer",
+ "AiXmlUiController",
+ "CopyToBufferL( HBufC16*, const TDesC8& )",
+ "FUNCTIONALITY",
+ SetupUnicodeBufferL, TestCopyUtf8ToUnicodeL, Teardown)
+
+EUNIT_TEST(
+ "Copy unicode to UTF8, no buffer",
+ "AiXmlUiController",
+ "CopyToBufferL( HBufC8*, const TDesC16& )",
+ "FUNCTIONALITY",
+ SetupL, TestCopyUnicodeToUtf8L, Teardown)
+
+EUNIT_TEST(
+ "Copy unicode to UTF8, reallocate buffer",
+ "AiXmlUiController",
+ "CopyToBufferL( HBufC8*, const TDesC16& )",
+ "FUNCTIONALITY",
+ SetupUtf8BufferL, TestCopyUnicodeToUtf8L, Teardown)
+
+EUNIT_TEST(
+ "Copy UTF8 to UTF8, no buffer",
+ "AiXmlUiController",
+ "CopyToBufferL( HBufC8*, const TDesC8& )",
+ "FUNCTIONALITY",
+ SetupL, TestCopyUtf8ToUtf8L, Teardown)
+
+EUNIT_TEST(
+ "Copy UTF8 to UTF8, reallocate buffer",
+ "AiXmlUiController",
+ "CopyToBufferL( HBufC8*, const TDesC8& )",
+ "FUNCTIONALITY",
+ SetupUtf8BufferL, TestCopyUtf8ToUtf8L, Teardown)
+
+EUNIT_TEST(
+ "Parse hex integer",
+ "AiXmlUiController",
+ "ParseInt",
+ "FUNCTIONALITY",
+ SetupHexIntL, TestParseInt, Teardown)
+
+EUNIT_TEST(
+ "Parse decimal integer",
+ "AiXmlUiController",
+ "ParseInt",
+ "FUNCTIONALITY",
+ SetupIntL, TestParseInt, Teardown)
+
+EUNIT_TEST(
+ "Parse invalid buffer",
+ "AiXmlUiController",
+ "ParseInt",
+ "ERROR HANDLING",
+ SetupNoIntL, TestParseInt, Teardown)
+
+EUNIT_TEST(
+ "Parse UNICODE hex integer",
+ "AiXmlUiController",
+ "ParseInt",
+ "FUNCTIONALITY",
+ SetupHexIntUnicodeL, TestParseIntUnicode, Teardown)
+
+EUNIT_TEST(
+ "Parse UNICODE decimal integer",
+ "AiXmlUiController",
+ "ParseInt",
+ "FUNCTIONALITY",
+ SetupIntUnicodeL, TestParseIntUnicode, Teardown)
+
+EUNIT_TEST(
+ "Parse UNICODE invalid buffer",
+ "AiXmlUiController",
+ "ParseInt",
+ "ERROR HANDLING",
+ SetupNoIntUnicodeL, TestParseIntUnicode, Teardown)
+
+EUNIT_TEST(
+ "Copy string to buffer",
+ "AiXmlUiController",
+ "EnsureBufMaxLengthL",
+ "ERROR HANDLING",
+ SetupL, TestEnsureBufMaxLengthL, Teardown)
+
+ EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/src/mt_apiaiutilsdllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,73 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// CLASS HEADER
+#include <mt_apiaicontentitemarrayiterator.h>
+#include <mt_apiaipspropertyobserver.h>
+#include <mt_apicontentprioritymap.h>
+#include <mt_apiaistrparser.h>
+#include <mt_apiaiplugintool.h>
+#include <mt_apiaipluginsettings.h>
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ _LIT(KMainSuiteName, "MT_ApiAiUtils");
+ CEUnitTestSuite* mainSuite = CEUnitTestSuite::NewLC(KMainSuiteName);
+
+ MEUnitTest* subSuite = MT_ApiAiContentItemArrayIterator::NewLC();
+ mainSuite->AddL(subSuite);
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_ApiAiPSPropertyObserver::NewLC();
+ mainSuite->AddL(subSuite);
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_ApiContentPriorityMap::NewLC();
+ mainSuite->AddL(subSuite);
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_ApiAiStrParser::NewLC();
+ mainSuite->AddL(subSuite);
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_ApiAiplugintool::NewLC();
+ mainSuite->AddL(subSuite);
+ CleanupStack::Pop(); // subSuite
+
+ subSuite = MT_ApiAiPluginSettings::NewLC();
+ mainSuite->AddL(subSuite);
+ CleanupStack::Pop(); // subSuite
+
+ CleanupStack::Pop(mainSuite);
+ return mainSuite;
+ }
+
+
+
+// END OF FILE
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/ai_utilities_api/src/mt_apicontentprioritymap.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,208 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// CLASS UNDER TEST
+#include <contentprioritymap.h>
+
+#include <mt_apicontentprioritymap.h>
+#include <digia/eunit/eunitmacros.h>
+
+using namespace AiUtility;
+
+namespace
+ {
+ _LIT8( KTestId, "TestElementId" );
+
+ const TInt KDefaultPriority( 0 );
+
+ const TInt KHighPriority( 1 );
+ }
+
+
+// CONSTRUCTION
+MT_ApiContentPriorityMap* MT_ApiContentPriorityMap::NewL()
+ {
+ MT_ApiContentPriorityMap* self = MT_ApiContentPriorityMap::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+MT_ApiContentPriorityMap* MT_ApiContentPriorityMap::NewLC()
+ {
+ MT_ApiContentPriorityMap* self = new( ELeave ) MT_ApiContentPriorityMap();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+MT_ApiContentPriorityMap::~MT_ApiContentPriorityMap()
+ {
+#if _BullseyeCoverage
+ cov_write();
+#endif
+ }
+
+// Default constructor
+MT_ApiContentPriorityMap::MT_ApiContentPriorityMap()
+ {
+ }
+
+// Second phase construct
+void MT_ApiContentPriorityMap::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// METHODS
+
+void MT_ApiContentPriorityMap::SetupL( )
+ {
+ iContentPriorityMap = CContentPriorityMap::NewL();
+ }
+
+void MT_ApiContentPriorityMap::Teardown( )
+ {
+ delete iContentPriorityMap;
+ iContentPriorityMap = NULL;
+ }
+
+void MT_ApiContentPriorityMap::TestEmptyMapL( )
+ {
+ // Test that map is empty
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->CurrentPriority( KTestId ),
+ KErrNotFound );
+
+ // Test initial value setting
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->SetCurrentPriority( KTestId, KDefaultPriority ),
+ KErrNone );
+
+ // Test current priority
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->CurrentPriority( KTestId ),
+ KDefaultPriority );
+
+ }
+
+void MT_ApiContentPriorityMap::TestClearL( )
+ {
+ // Clear empty map (for coverage )
+ iContentPriorityMap->ClearPriority( KTestId ); //
+
+ // Set default priority
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->SetCurrentPriority( KTestId, KDefaultPriority ),
+ KErrNone );
+
+ // Clear priority
+ iContentPriorityMap->ClearPriority( KTestId );
+
+ // Test that priority is cleared
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->CurrentPriority( KTestId ),
+ KErrNotFound );
+ }
+
+void MT_ApiContentPriorityMap::TestUpdateL( )
+ {
+ // Set default priority
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->SetCurrentPriority( KTestId, KDefaultPriority ),
+ KErrNone );
+
+ // Update priority
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->SetCurrentPriority( KTestId, KHighPriority ),
+ KErrNone );
+
+ // Test updated priority
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->CurrentPriority( KTestId ),
+ KHighPriority );
+ }
+
+void MT_ApiContentPriorityMap::TestOverrideL()
+ {
+ // Test empty map
+ EUNIT_ASSERT( iContentPriorityMap->OverrideContent( KTestId, KDefaultPriority ) );
+
+ // Set default
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->SetCurrentPriority( KTestId, KDefaultPriority ),
+ KErrNone );
+
+ // Test again with default priority
+ EUNIT_ASSERT( iContentPriorityMap->OverrideContent( KTestId, KDefaultPriority ) );
+
+ // Test high priority
+ EUNIT_ASSERT( iContentPriorityMap->OverrideContent( KTestId, KHighPriority ) );
+
+ // Set high priority
+ EUNIT_ASSERT_EQUALS( iContentPriorityMap->SetCurrentPriority( KTestId, KHighPriority ),
+ KErrNone );
+
+ // Test default priority
+ EUNIT_ASSERT( !iContentPriorityMap->OverrideContent( KTestId, KDefaultPriority ) );
+
+ }
+
+void MT_ApiContentPriorityMap::TestResetL()
+ {
+ iContentPriorityMap->Reset();
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_ApiContentPriorityMap,
+ "Unit test suite for AiUtility::CContentPriorityMap",
+ "AiUtility::CContentPriorityMap" )
+
+EUNIT_TEST(
+ "Test empty map",
+ "AiUtility::CContentPriorityMap",
+ "CurrentPriority, SetCurrentPriority",
+ "FUNCTIONALITY",
+ SetupL, TestEmptyMapL, Teardown)
+
+EUNIT_TEST(
+ "Test clear functionality",
+ "AiUtility::CContentPriorityMap",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestClearL, Teardown)
+
+EUNIT_TEST(
+ "Test update functionality",
+ "AiUtility::CContentPriorityMap",
+ "All",
+ "FUNCTIONALITY",
+ SetupL, TestUpdateL, Teardown)
+
+EUNIT_TEST(
+ "Test override functionality",
+ "AiUtility::CContentPriorityMap",
+ "OverrideContent, SetCurrentPriority",
+ "FUNCTIONALITY",
+ SetupL, TestOverrideL, Teardown)
+
+EUNIT_TEST(
+ "Test reset functionality",
+ "AiUtility::CContentPriorityMap",
+ "Reset, Reset",
+ "FUNCTIONALITY",
+ SetupL, TestResetL, Teardown)
+
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/bwins/MT_DevStaPlgu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,2 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * __cdecl CreateTestSuiteL(void)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/bwins/UT_DevStaPlg2U.DEF Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,8 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+ ??1CNWSession@@UAE@XZ @ 3 NONAME ; CNWSession::~CNWSession(void)
+ ?NewL@CProfileChangeNotifyHandler@@SAPAV1@PAVMProfileChangeObserver@@@Z @ 4 NONAME ; class CProfileChangeNotifyHandler * CProfileChangeNotifyHandler::NewL(class MProfileChangeObserver *)
+ ?NewL@CProfileEngine@@SAPAV1@XZ @ 5 NONAME ; class CProfileEngine * CProfileEngine::NewL(void)
+ ?NewLC@CProfileEngine@@SAPAV1@XZ @ 6 NONAME ; class CProfileEngine * CProfileEngine::NewLC(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/bwins/UT_DevStaPlgU.DEF Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/eabi/MT_DevStaPlgu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,7 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _ZTI12CRuntimeTest @ 2 NONAME ; #<TI>#
+ _ZTI16CContentObserver @ 3 NONAME ; #<TI>#
+ _ZTV12CRuntimeTest @ 4 NONAME ; #<VT>#
+ _ZTV16CContentObserver @ 5 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/eabi/UT_DevStaPlg2u.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,50 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _Z24ImplementationGroupProxyRi @ 2 NONAME
+ _ZN14CProfileEngine4NewLEv @ 3 NONAME
+ _ZN14CProfileEngine5NewLCEv @ 4 NONAME
+ _ZTI10CNWSession @ 5 NONAME ; #<TI>#
+ _ZTI12CRuntimeTest @ 6 NONAME ; #<TI>#
+ _ZTI14CProfileEngine @ 7 NONAME ; #<TI>#
+ _ZTI15CAiCUGPublisher @ 8 NONAME ; #<TI>#
+ _ZTI15CAiMCNPublisher @ 9 NONAME ; #<TI>#
+ _ZTI15CAiNwsPublisher @ 10 NONAME ; #<TI>#
+ _ZTI15CAiVHZPublisher @ 11 NONAME ; #<TI>#
+ _ZTI16CAiDatePublisher @ 12 NONAME ; #<TI>#
+ _ZTI16CContentObserver @ 13 NONAME ; #<TI>#
+ _ZTI17CAiBTSAPPublisher @ 14 NONAME ; #<TI>#
+ _ZTI18CAiCUGMCNPublisher @ 15 NONAME ; #<TI>#
+ _ZTI18CAiSimRegPublisher @ 16 NONAME ; #<TI>#
+ _ZTI19CAiProfilePublisher @ 17 NONAME ; #<TI>#
+ _ZTI21CAiDeviceStatusPlugin @ 18 NONAME ; #<TI>#
+ _ZTI21CAiPublishPrioritizer @ 19 NONAME ; #<TI>#
+ _ZTI22CAiNetworkInfoListener @ 20 NONAME ; #<TI>#
+ _ZTI23CAiMultiContentObserver @ 21 NONAME ; #<TI>#
+ _ZTI24CAiOperatorLogoPublisher @ 22 NONAME ; #<TI>#
+ _ZTI24CAiOperatorNamePublisher @ 23 NONAME ; #<TI>#
+ _ZTI27CAiContentObserverOptimizer @ 24 NONAME ; #<TI>#
+ _ZTI27CAiDeviceStatusPluginEngine @ 25 NONAME ; #<TI>#
+ _ZTI8CProfile @ 26 NONAME ; #<TI>#
+ _ZTV10CNWSession @ 27 NONAME ; #<VT>#
+ _ZTV12CRuntimeTest @ 28 NONAME ; #<VT>#
+ _ZTV14CProfileEngine @ 29 NONAME ; #<VT>#
+ _ZTV15CAiCUGPublisher @ 30 NONAME ; #<VT>#
+ _ZTV15CAiMCNPublisher @ 31 NONAME ; #<VT>#
+ _ZTV15CAiNwsPublisher @ 32 NONAME ; #<VT>#
+ _ZTV15CAiVHZPublisher @ 33 NONAME ; #<VT>#
+ _ZTV16CAiDatePublisher @ 34 NONAME ; #<VT>#
+ _ZTV16CContentObserver @ 35 NONAME ; #<VT>#
+ _ZTV17CAiBTSAPPublisher @ 36 NONAME ; #<VT>#
+ _ZTV18CAiCUGMCNPublisher @ 37 NONAME ; #<VT>#
+ _ZTV18CAiSimRegPublisher @ 38 NONAME ; #<VT>#
+ _ZTV19CAiProfilePublisher @ 39 NONAME ; #<VT>#
+ _ZTV21CAiDeviceStatusPlugin @ 40 NONAME ; #<VT>#
+ _ZTV21CAiPublishPrioritizer @ 41 NONAME ; #<VT>#
+ _ZTV22CAiNetworkInfoListener @ 42 NONAME ; #<VT>#
+ _ZTV23CAiMultiContentObserver @ 43 NONAME ; #<VT>#
+ _ZTV24CAiOperatorLogoPublisher @ 44 NONAME ; #<VT>#
+ _ZTV24CAiOperatorNamePublisher @ 45 NONAME ; #<VT>#
+ _ZTV27CAiContentObserverOptimizer @ 46 NONAME ; #<VT>#
+ _ZTV27CAiDeviceStatusPluginEngine @ 47 NONAME ; #<VT>#
+ _ZTV8CProfile @ 48 NONAME ; #<VT>#
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/group/MT_DevStaPlg.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,64 @@
+/*
+* 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET mt_devstaplg.dll
+TARGETTYPE dll
+TARGETPATH /digiaeunit/tests
+UID 0x1000af5a 0x01700000
+
+CAPABILITY EUNIT_CAPS
+VENDORID 0x00000000
+
+SOURCEPATH ../mt_devstaplg
+SOURCE mt_devstaplgdllmain.cpp
+SOURCE mt_devstaplg.cpp
+SOURCE contentobserver.cpp
+SOURCE runtimetest.cpp
+//SOURCE testobserver.cpp
+
+USERINCLUDE ../mt_devstaplg
+USERINCLUDE ../stub/src
+USERINCLUDE ../../../../inc/common
+USERINCLUDE ../../../../inc/framework
+USERINCLUDE ../../../../group
+USERINCLUDE ../../../../plugins/devicestatus/inc
+USERINCLUDE ../../../../../../homescreen/idlehomescreen/inc
+USERINCLUDE ../../../../../../homescreen/idlehomescreen/nativeuicontroller/inc
+USERINCLUDE ../../../../../idlefw/plugins/profileplugin/inc
+USERINCLUDE ../../../../../../../app/homescreen/idlehomescreen/inc
+USERINCLUDE ../../../../../../../app/homescreen/idlehomescreen/nativeuicontroller/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY eunit.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY stub.lib
+LIBRARY eunitutil.lib
+LIBRARY efsrv.lib
+LIBRARY phoneclient.lib
+LIBRARY fbscli.lib
+LIBRARY egul.lib
+LIBRARY aifw.lib
+LIBRARY flogger.lib
+LIBRARY aiutils.lib
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/group/UT_DevStaPlg.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,104 @@
+/*
+* 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET UT_DevStaPlg.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700000
+
+CAPABILITY EUNIT_CAPS
+
+VENDORID 0x00000000
+
+SOURCEPATH ../UT_DevStaPlg
+SOURCE UT_DevStaPlgDllMain.cpp
+SOURCE UT_DevStaPlg.cpp
+
+SOURCEPATH ../../../../plugins/devicestatus/src
+SOURCE aioperatornamepublisher.cpp
+SOURCE aioperatorlogopublisher.cpp
+
+SOURCEPATH ../Stub
+SOURCE profileengine.cpp
+SOURCE networkhandling.cpp
+
+SOURCEPATH ../MT_DevStaPlg
+SOURCE contentobserver.cpp
+SOURCE runtimetest.cpp
+
+SOURCEPATH ../../../../plugins/devicestatus/src
+SOURCE aidevicestatusplugin.cpp
+SOURCE aidevicestatuspluginengine.cpp
+SOURCE aimulticontentobserver.cpp
+SOURCE aiprofilepublisher.cpp
+SOURCE aidatepublisher.cpp
+SOURCE aipublisherfactory.cpp
+SOURCE ainetworkinfolistener.cpp
+SOURCE aibtsappublisher.cpp
+SOURCE aisimregpublisher.cpp
+SOURCE aimcnpublisher.cpp
+SOURCE aicugpublisher.cpp
+SOURCE aivhzpublisher.cpp
+SOURCE aipublishprioritizer.cpp
+
+
+USERINCLUDE ../UT_DevStaPlg
+USERINCLUDE ../MT_DevStaPlg
+USERINCLUDE ../Stub
+USERINCLUDE ../../../../inc/common
+USERINCLUDE ../../../../inc/framework
+USERINCLUDE ../../../../group
+USERINCLUDE ../../../../plugins/devicestatus/inc
+USERINCLUDE ../../../../inc/nativeuicontroller
+
+SYSTEMINCLUDE /epoc32/include
+SYSTEMINCLUDE /epoc32/include/oem
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY stub.lib
+LIBRARY EUnit.lib
+LIBRARY avkon.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY stub.lib
+LIBRARY eunitutil.lib
+LIBRARY efsrv.lib
+LIBRARY phoneclient.lib
+LIBRARY fbscli.lib
+LIBRARY egul.lib
+LIBRARY aifw.lib
+LIBRARY flogger.lib
+LIBRARY aiutils.lib
+LIBRARY featmgr.lib
+LIBRARY cone.lib
+LIBRARY commonengine.lib
+LIBRARY centralrepository.lib
+LIBRARY cenrepnotifhandler.lib
+LIBRARY egul.lib
+LIBRARY aknlayout2scalable.lib
+LIBRARY cdlengine.lib
+LIBRARY gdi.lib
+LIBRARY bitgdi.lib
+LIBRARY aiutils.lib
+LIBRARY bafl.lib
+LIBRARY profileengine.lib
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/group/UT_DevStaPlg2.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,119 @@
+/*
+* 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET UT_DevStaPlg2.dll
+TARGETTYPE dll
+TARGETPATH /sys/bin/
+UID 0x1000af5a 0x01700000
+
+CAPABILITY EUNIT_CAPS
+VENDORID 0x00000000
+
+SOURCEPATH ../UT_DevStaPlg
+SOURCE UT_DevStaPlg2DllMain.cpp
+SOURCE UT_DevStaPlg2.cpp
+
+SOURCEPATH ../Stub
+SOURCE profileengine.cpp
+SOURCE networkhandling.cpp
+SOURCE aioperatornamepublishercontainer.cpp
+SOURCE aioperatorlogopublishercontainer.cpp
+SOURCE aidatepublishercontainer.cpp
+// SOURCE aiprofilepublishercontainer.cpp
+
+SOURCEPATH ../MT_DevStaPlg
+SOURCE contentobserver.cpp
+SOURCE runtimetest.cpp
+
+SOURCEPATH ../../../../plugins/devicestatus/src
+SOURCE aidevicestatusplugin.cpp
+SOURCE aidevicestatuspluginengine.cpp
+SOURCE aicontentobserveroptimizer.cpp
+SOURCE aimulticontentobserver.cpp
+SOURCE aipublisherfactory.cpp
+SOURCE ainetworkinfolistener.cpp
+SOURCE aibtsappublisher.cpp
+SOURCE aisimregpublisher.cpp
+SOURCE aimcnpublisher.cpp
+SOURCE aicugpublisher.cpp
+SOURCE aivhzpublisher.cpp
+SOURCE aipublishprioritizer.cpp
+SOURCE ainwspublisher.cpp
+SOURCE aicugmcnpublisher.cpp
+
+SOURCEPATH ../../../../plugins/devicestatus/data
+START RESOURCE aidevstaplgres.rss
+HEADER
+TARGET aidevstaplgres.rsc
+TARGETPATH ../UT_DevStaPlg
+LANGUAGE_IDS
+END
+
+
+USERINCLUDE ../UT_DevStaPlg
+USERINCLUDE ../MT_DevStaPlg
+USERINCLUDE ../Stub
+USERINCLUDE ../../../../inc/common
+USERINCLUDE ../../../../inc/framework
+USERINCLUDE ../../../../group
+USERINCLUDE ../../../../plugins/devicestatus/inc
+USERINCLUDE ../../../../plugins/devicestatus/src
+USERINCLUDE ../../../../plugins/devicestatus/loc
+USERINCLUDE ../../../../cenrep
+USERINCLUDE ../../../../../../homescreen/idlehomescreen/nativeuicontroller/inc
+USERINCLUDE ../../../../../../../app/homescreen/idlehomescreen/nativeuicontroller/inc
+USERINCLUDE ../../../../../../homescreen/idlehomescreen/inc
+USERINCLUDE ../../../../../idlefw/plugins/profileplugin/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY stub.lib
+LIBRARY EUnit.lib
+LIBRARY avkon.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY eunitutil.lib
+LIBRARY efsrv.lib
+LIBRARY phoneclient.lib
+LIBRARY fbscli.lib
+LIBRARY aifw.lib
+LIBRARY flogger.lib
+LIBRARY featmgr.lib
+LIBRARY cone.lib
+LIBRARY commonengine.lib
+LIBRARY centralrepository.lib
+LIBRARY cenrepnotifhandler.lib
+LIBRARY egul.lib
+LIBRARY aknlayout2scalable.lib
+LIBRARY cdlengine.lib
+LIBRARY gdi.lib
+LIBRARY bitgdi.lib
+LIBRARY aiutils.lib
+LIBRARY bafl.lib
+
+
+
+LIBRARY sssettings.lib
+LIBRARY profileengine.lib
+LIBRARY networkhandling.lib
+
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2005 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+mt_devstaplg.mmp
+//ut_devstaplg2.mmp
+#include "../stub/group/bld.inf"
+
+
+PRJ_TESTEXPORTS
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/CAOUserAfter.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,89 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+#ifndef __CAOUSERAFTER_H__
+#define __CAOUSERAFTER_H__
+
+// INCLUDES
+#include <E32base.h>
+#include <E32svr.h>
+#include <CoeMain.h>
+
+
+/**
+ * Active object version of User::After()
+ */
+class CAOUserAfter : public CTimer
+ {
+ private:
+ CActiveSchedulerWait iWait;
+ TInt iLength;
+
+
+ public: //new functions
+
+ /**
+ * Constructs the waiting timer, executes
+ * it and when timer expires, deletes self.
+ * @param aLength The lenghth of wait in micro
+ * seconds.
+ */
+ static void AfterLD( TInt aLenght )
+ {
+ CAOUserAfter* wait= new ( ELeave ) CAOUserAfter( aLenght );
+ CleanupStack::PushL( wait );
+ wait->ConstructL();
+ CleanupStack::Pop();
+
+ RDebug::Print( _L("CAOUserAfter - Starting time consuming...") );
+ wait->StartWaitD();
+ RDebug::Print( _L("CAOUserAfter - completed.") );
+ }
+
+ private:
+ CAOUserAfter( TInt aLenght )
+ : CTimer( CActive::EPriorityStandard ),
+ iLength( aLenght )
+ {
+ }
+
+ void ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add( this );
+ }
+
+ virtual ~CAOUserAfter()
+ {
+ }
+
+ void StartWaitD()
+ {
+ After( iLength );
+ iWait.Start();
+ }
+
+ void RunL()
+ {
+ iWait.AsyncStop();
+ Cancel();
+ delete this;
+ }
+ };
+
+#endif // __CAOUSERAFTER_H__
+// End of File
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/CContentCache.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef C_CONTENTCACHE_H
+#define C_CONTENTCACHE_H
+
+class CContentCache : public CBase
+ {
+ public:
+ ~CContentCache()
+ {
+ delete iText;
+ delete iData;
+ }
+
+ HBufC* iText;
+ HBufC8* iData;
+ TBool iClean;
+ TInt iResource;
+ TInt iIndex;
+ TInt iId;
+ };
+
+
+LOCAL_C CContentCache* GetContent( RPointerArray<CContentCache>& aArray, TInt aId, TBool aClean = EFalse )
+ {
+ const TInt count( aArray.Count() );
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ if( aArray[i]->iId == aId )
+ {
+ if( !aClean && aArray[i]->iClean)
+ {
+ continue;
+ }
+ return aArray[i];
+ }
+ }
+
+ return NULL;
+ }
+
+
+#endif // C_CONTENTCACHE_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/DelayedFunctionCall.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,712 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+//DelayedFunctionCall.h
+//DFC caller and templated generic function call objects.
+
+#ifndef CDELAYEDFUNCTIONCALL_H__
+#define CDELAYEDFUNCTIONCALL_H__
+
+
+// INCLUDES
+#include <E32base.h>
+
+
+// CLASS DESCRIPTION
+
+/**
+ * Abstract interface for function call object.
+ */
+class MFunctionCall
+ {
+ public:
+
+ /**
+ * Function execution.
+ *
+ * Executes the function call.
+ *
+ * If function execution fails (e.g. leaves),
+ * leave code is stored in CDelayedFunctionCall host.
+ */
+ virtual void InvokeL() = 0;
+
+ virtual MFunctionCall* CloneLC() const = 0;
+
+
+ /**
+ * Public virtual destructor.
+ *
+ * Allows thus function call object deletion.
+ */
+ virtual ~MFunctionCall() {}
+ };
+
+
+
+// CLASS DESCRIPTION
+
+/**
+ * Delayed Function Call - caller.
+ *
+ * Executes DFC objects after given delay.
+ */
+class CDelayedFunctionCall : public CTimer
+ {
+ public: //Construction
+
+ static inline CDelayedFunctionCall* NewLC();
+ static inline CDelayedFunctionCall* NewL();
+ inline ~CDelayedFunctionCall();
+
+ public: //Delayed call
+
+ /**
+ * Issues DFC call. Panics if CDelayedFunctionCall object
+ * is already in use.
+ *
+ * @param aFC The FC object to execute.
+ * @param aCallDelay The delay when to execute the FC.
+ * @param aFCOwnershipTransf If ETrue, the aFC object
+ * ownership is transferred to DFC caller and DFC caller
+ * deletes object. If EFalse, no ownership transfer is done.
+ */
+ inline void IssueDfc( MFunctionCall& aFC, TInt aCallDelay, TBool aFCOwnershipTransf = ETrue );
+
+
+ /**
+ * Similar like IssueDfc() but pushes
+ * release to CleanupStack ==>
+ * if there happens a leave before the DFC gets scheduled,
+ * DFC is canceled.
+ */
+ inline void IssueDfcLC( MFunctionCall& aFC, TInt aCallDelay, TBool aFCOwnershipTransf = ETrue );
+
+
+ /**
+ * Releases the DFC.
+ * Cancels the call and deletes possibly owned FC.
+ */
+ inline void Release();
+
+
+ /**
+ * Delayed FC error handling.
+ */
+ inline void LeaveIfFcFailedL();
+
+ /**
+ * Tests was the FC executed or not.
+ */
+ inline TBool FcExecuted();
+
+
+ private:
+ inline CDelayedFunctionCall();
+ inline void RunL();
+ inline TInt RunError( TInt aError );
+ inline void InvokeL();
+
+
+ private: //data
+
+ //REF/OWN: Function call object
+ MFunctionCall* iFC;
+
+ //OWN: Is function call object owned
+ TBool iFCOwned;
+
+ //OWN: Did function call leave
+ TBool iFCLeft;
+
+ //OWN: Was function called
+ TBool iFCCalled;
+
+ //OWN: Leave code from the function call
+ TInt iFCLeaveErr;
+ };
+
+
+
+
+// -----------------------------------------------------------------------------
+// CDelayedFunctionCall public functions
+// -----------------------------------------------------------------------------
+//
+inline CDelayedFunctionCall* CDelayedFunctionCall::NewLC()
+ {
+ CDelayedFunctionCall* self = new (ELeave) CDelayedFunctionCall();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+inline CDelayedFunctionCall* CDelayedFunctionCall::NewL()
+ {
+ CDelayedFunctionCall* self = NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+inline CDelayedFunctionCall::~CDelayedFunctionCall()
+ {
+ Cancel();
+ if( iFCOwned )
+ {
+ delete iFC;
+ }
+ }
+
+
+inline void CDelayedFunctionCall::IssueDfc( MFunctionCall& aFC,
+ TInt aFCDelay,
+ TBool aFCOwnershipTransf )
+ {
+ __ASSERT_ALWAYS( !IsActive(), User::Panic( _L("DFC caller"), KErrInUse ) );
+
+ iFC = &aFC;
+ iFCOwned = aFCOwnershipTransf;
+ iFCLeft = EFalse;
+ iFCLeaveErr = KErrNone;
+ iFCCalled = EFalse;
+
+ if( aFCDelay >= 0 )
+ {
+ After( aFCDelay );
+ }
+ else
+ {
+ InvokeL();
+ }
+ }
+
+
+inline void CDelayedFunctionCall::IssueDfcLC( MFunctionCall& aFC,
+ TInt aFCDelay,
+ TBool aFCOwnershipTransf )
+ {
+ IssueDfc( aFC, aFCDelay, aFCOwnershipTransf );
+ CleanupReleasePushL( *this );
+ }
+
+
+inline void CDelayedFunctionCall::Release()
+ {
+ Cancel();
+ if( iFCOwned )
+ {
+ delete iFC;
+ iFC = NULL;
+ }
+ }
+
+inline void CDelayedFunctionCall::LeaveIfFcFailedL()
+ {
+ if( iFCLeft )
+ {
+ User::Leave( iFCLeaveErr );
+ }
+ }
+
+
+inline TBool CDelayedFunctionCall::FcExecuted()
+ {
+ return iFCCalled;
+ }
+
+
+
+// -----------------------------------------------------------------------------
+// CDelayedFunctionCall private functions
+// -----------------------------------------------------------------------------
+//
+inline CDelayedFunctionCall::CDelayedFunctionCall()
+ : CTimer( CActive::EPriorityHigh )
+ {
+ CActiveScheduler::Add( this );
+ }
+
+inline void CDelayedFunctionCall::RunL()
+ {
+ InvokeL();
+ }
+
+inline TInt CDelayedFunctionCall::RunError( TInt aError )
+ {
+ iFCLeft = ETrue;
+ iFCCalled = ETrue;
+ iFCLeaveErr = aError;
+ if( iFCOwned )
+ {
+ delete iFC;
+ iFC = NULL;
+ }
+
+ return KErrNone;
+ }
+
+
+inline void CDelayedFunctionCall::InvokeL()
+ {
+ iFC->InvokeL();
+ iFCCalled = ETrue;
+ if( iFCOwned )
+ {
+ delete iFC;
+ iFC = NULL;
+ }
+ }
+
+
+
+
+
+
+
+// =============================================================================
+// Generic Function Call classes
+// =============================================================================
+
+
+// CLASS DESCRIPTION
+
+/**
+ * Base class for generic function call objects.
+ * Initializes function call members to zero
+ * during the object construction.
+ */
+class TMemFillBase
+ {
+ protected: //Protected constructor & virtual destructor
+ TMemFillBase( TUint aSize ) { Mem::FillZ( this, aSize); }
+ virtual ~TMemFillBase() {}
+ };
+
+
+
+
+
+// CLASS DESCRIPTION
+
+/**
+ * Generic function call object for function that returns void.
+ *
+ * This function call object doesn't own any of the
+ * call parameters, nor the called object.
+ */
+template< class C,
+ class P1=TInt,
+ class P2=TInt,
+ class P3=TInt,
+ class P4=TInt >
+class TGenericFuncCallVoid : public TMemFillBase, public MFunctionCall
+ {
+ private: //Function type shortcuts
+ typedef void (C::*TFuncTypeVoid)();
+ typedef void (C::*TFuncType1)( P1 aP1 );
+ typedef void (C::*TFuncType2)( P1 aP1, P2 aP2 );
+ typedef void (C::*TFuncType3)( P1 aP1, P2 aP2, P3 aP3 );
+ typedef void (C::*TFuncType4)( P1 aP1, P2 aP2, P3 aP3, P4 aP4 );
+
+
+ public: //Construction / destruction
+ TGenericFuncCallVoid( C& aObj, TFuncTypeVoid aFunc )
+ : TMemFillBase( sizeof( TGenericFuncCallVoid ) ),
+ iObj( aObj ),
+ iFVoid( aFunc )
+ {}
+
+ TGenericFuncCallVoid( C& aObj, TFuncType1 aFunc, P1 aP1 )
+ : TMemFillBase( sizeof( TGenericFuncCallVoid ) ),
+ iObj( aObj ),
+ iF1( aFunc ),
+ iP1( aP1 )
+ {}
+
+ TGenericFuncCallVoid( C& aObj, TFuncType2 aFunc, P1 aP1, P2 aP2 )
+ : TMemFillBase( sizeof( TGenericFuncCallVoid ) ),
+ iObj( aObj ),
+ iF2( aFunc ),
+ iP1( aP1 ), iP2( aP2 )
+ {}
+
+ TGenericFuncCallVoid( C& aObj, TFuncType3 aFunc, P1 aP1 , P2 aP2, P3 aP3 )
+ : TMemFillBase( sizeof( TGenericFuncCallVoid ) ),
+ iObj( aObj ),
+ iF3( aFunc ),
+ iP1( aP1 ), iP2( aP2 ), iP3( aP3 )
+ {}
+
+ TGenericFuncCallVoid( C& aObj, TFuncType4 aFunc, P1 aP1 , P2 aP2, P3 aP3, P4 aP4 )
+ : TMemFillBase( sizeof( TGenericFuncCallVoid ) ),
+ iObj( aObj ),
+ iF4( aFunc ),
+ iP1( aP1 ), iP2( aP2 ), iP3( aP3 ), iP4( aP4 )
+ {}
+
+ ~TGenericFuncCallVoid()
+ {}
+
+ private: //From MFunctionCall
+
+ void InvokeL()
+ {
+ if( iFVoid )
+ {
+ (iObj.*iFVoid)();
+ }
+ else if( iF1 )
+ {
+ (iObj.*iF1)( iP1 );
+ }
+ else if( iF2 )
+ {
+ (iObj.*iF2)( iP1, iP2 );
+ }
+ else if( iF3 )
+ {
+ (iObj.*iF3)( iP1, iP2, iP3 );
+ }
+ else if( iF4 )
+ {
+ (iObj.*iF4)( iP1, iP2, iP3, iP4 );
+ }
+ }
+
+ MFunctionCall* TGenericFuncCallVoid::CloneLC() const
+ {
+ TAny* self = User::AllocL( sizeof( TGenericFuncCallVoid ) );
+ Mem::Copy( self, this, sizeof( TGenericFuncCallVoid ) );
+ TGenericFuncCallVoid* self2 = (TGenericFuncCallVoid*) self;
+ CleanupDeletePushL( self2 );
+ return (MFunctionCall*) self2;
+ }
+
+
+ private: //Call data
+
+ C& iObj;
+ P1 iP1;
+ P2 iP2;
+ P3 iP3;
+ P4 iP4;
+ TFuncTypeVoid iFVoid;
+ TFuncType1 iF1;
+ TFuncType2 iF2;
+ TFuncType3 iF3;
+ TFuncType4 iF4;
+ };
+
+
+
+
+
+// CLASS DESCRIPTION
+
+/**
+ * Generic function call object for function that returns a value
+ * (with by-value convention).
+ *
+ * This function call object doesn't own any of the
+ * call parameters, nor the called object or the result.
+ */
+template< class C,
+ class R,
+ class P1=TInt,
+ class P2=TInt,
+ class P3=TInt,
+ class P4=TInt >
+class TGenericFuncCallRetByValue : public TMemFillBase, public MFunctionCall
+ {
+ private: //Function type shortcuts
+ typedef R (C::*TFuncTypeVoid)();
+ typedef R (C::*TFuncType1)( P1 aP1 );
+ typedef R (C::*TFuncType2)( P1 aP1, P2 aP2 );
+ typedef R (C::*TFuncType3)( P1 aP1, P2 aP2, P3 aP3 );
+ typedef R (C::*TFuncType4)( P1 aP1, P2 aP2, P3 aP3, P4 aP4 );
+
+
+ public: //Construction / destruction
+ TGenericFuncCallRetByValue( C& aObj, TFuncTypeVoid aFunc )
+ : TMemFillBase( sizeof( TGenericFuncCallRetByValue ) ),
+ iObj( aObj ),
+ iFVoid( aFunc )
+ {}
+
+ TGenericFuncCallRetByValue( C& aObj, TFuncType1 aFunc, P1 aP1 )
+ : TMemFillBase( sizeof( TGenericFuncCallRetByValue ) ),
+ iObj( aObj ),
+ iF1( aFunc ),
+ iP1( aP1 )
+ {}
+
+ TGenericFuncCallRetByValue( C& aObj, TFuncType2 aFunc, P1 aP1, P2 aP2 )
+ : TMemFillBase( sizeof( TGenericFuncCallRetByValue ) ),
+ iObj( aObj ),
+ iF2( aFunc ),
+ iP1( aP1 ), iP2( aP2 )
+ {}
+
+ TGenericFuncCallRetByValue( C& aObj, TFuncType3 aFunc, P1 aP1 , P2 aP2, P3 aP3 )
+ : TMemFillBase( sizeof( TGenericFuncCallRetByValue ) ),
+ iObj( aObj ),
+ iF3( aFunc ),
+ iP1( aP1 ), iP2( aP2 ), iP3( aP3 )
+ {}
+
+ TGenericFuncCallRetByValue( C& aObj, TFuncType4 aFunc, P1 aP1 , P2 aP2, P3 aP3, P4 aP4 )
+ : TMemFillBase( sizeof( TGenericFuncCallRetByValue ) ),
+ iObj( aObj ),
+ iF4( aFunc ),
+ iP1( aP1 ), iP2( aP2 ), iP3( aP3 ), iP4( aP4 )
+ {}
+
+ ~TGenericFuncCallRetByValue()
+ {}
+
+ private: //From MFunctionCall
+
+ void InvokeL()
+ {
+ if( iFVoid )
+ {
+ iReturnValue = (iObj.*iFVoid)();
+ }
+ else if( iF1 )
+ {
+ iReturnValue = (iObj.*iF1)( iP1 );
+ }
+ else if( iF2 )
+ {
+ iReturnValue = (iObj.*iF2)( iP1, iP2 );
+ }
+ else if( iF3 )
+ {
+ iReturnValue = (iObj.*iF3)( iP1, iP2, iP3 );
+ }
+ else if( iF4 )
+ {
+ iReturnValue = (iObj.*iF4)( iP1, iP2, iP3, iP4 );
+ }
+ }
+
+ MFunctionCall* TGenericFuncCallRetByValue::CloneLC() const
+ {
+ TAny* self = User::AllocL( sizeof( TGenericFuncCallRetByValue ) );
+ Mem::Copy( self, this, sizeof( TGenericFuncCallRetByValue ) );
+ TGenericFuncCallRetByValue* self2 = (TGenericFuncCallRetByValue*) self;
+ CleanupDeletePushL( self2 );
+ return (MFunctionCall*) self2;
+ }
+
+ private: //Call data
+
+ C& iObj;
+ P1 iP1;
+ P2 iP2;
+ P3 iP3;
+ P4 iP4;
+ TFuncTypeVoid iFVoid;
+ TFuncType1 iF1;
+ TFuncType2 iF2;
+ TFuncType3 iF3;
+ TFuncType4 iF4;
+
+ public: //Return value
+
+ R iReturnValue;
+ };
+
+
+
+
+template< class P1=TInt,
+ class P2=TInt,
+ class P3=TInt,
+ class P4=TInt >
+class TGenericGlobalFuncCallVoid : public TMemFillBase, public MFunctionCall
+ {
+ private: //Function type shortcuts
+ typedef void (*TFuncTypeVoid)();
+ typedef void (*TFuncType1)( P1 aP1 );
+ typedef void (*TFuncType2)( P1 aP1, P2 aP2 );
+ typedef void (*TFuncType3)( P1 aP1, P2 aP2, P3 aP3 );
+ typedef void (*TFuncType4)( P1 aP1, P2 aP2, P3 aP3, P4 aP4 );
+
+
+ public: //Construction / destruction
+ TGenericGlobalFuncCallVoid( TFuncTypeVoid aFunc )
+ : TMemFillBase( sizeof( TGenericGlobalFuncCallVoid ) ),
+ iFVoid( aFunc )
+ {}
+
+ TGenericGlobalFuncCallVoid( TFuncType1 aFunc, P1 aP1 )
+ : TMemFillBase( sizeof( TGenericGlobalFuncCallVoid ) ),
+ iF1( aFunc ),
+ iP1( aP1 )
+ {}
+
+ TGenericGlobalFuncCallVoid( TFuncType2 aFunc, P1 aP1, P2 aP2 )
+ : TMemFillBase( sizeof( TGenericGlobalFuncCallVoid ) ),
+ iF2( aFunc ),
+ iP1( aP1 ), iP2( aP2 )
+ {}
+
+ TGenericGlobalFuncCallVoid( TFuncType3 aFunc, P1 aP1 , P2 aP2, P3 aP3 )
+ : TMemFillBase( sizeof( TGenericGlobalFuncCallVoid ) ),
+ iF3( aFunc ),
+ iP1( aP1 ), iP2( aP2 ), iP3( aP3 )
+ {}
+
+ TGenericGlobalFuncCallVoid( TFuncType4 aFunc, P1 aP1 , P2 aP2, P3 aP3, P4 aP4 )
+ : TMemFillBase( sizeof( TGenericGlobalFuncCallVoid ) ),
+ iF4( aFunc ),
+ iP1( aP1 ), iP2( aP2 ), iP3( aP3 ), iP4( aP4 )
+ {}
+
+ ~TGenericGlobalFuncCallVoid()
+ {}
+
+ private: //From MFunctionCall
+
+ void InvokeL()
+ {
+ if( iFVoid )
+ {
+ (*iFVoid)();
+ }
+ else if( iF1 )
+ {
+ (*iF1)( iP1 );
+ }
+ else if( iF2 )
+ {
+ (*iF2)( iP1, iP2 );
+ }
+ else if( iF3 )
+ {
+ (*iF3)( iP1, iP2, iP3 );
+ }
+ else if( iF4 )
+ {
+ (*iF4)( iP1, iP2, iP3, iP4 );
+ }
+ }
+
+ MFunctionCall* TGenericGlobalFuncCallVoid::CloneLC() const
+ {
+ TAny* self = User::AllocL( sizeof( TGenericGlobalFuncCallVoid ) );
+ Mem::Copy( self, this, sizeof( TGenericGlobalFuncCallVoid ) );
+ TGenericGlobalFuncCallVoid* self2 = (TGenericGlobalFuncCallVoid*) self;
+ CleanupDeletePushL( self2 );
+ return (MFunctionCall*) self2;
+ }
+
+ private: //Call data
+
+ P1 iP1;
+ P2 iP2;
+ P3 iP3;
+ P4 iP4;
+ TFuncTypeVoid iFVoid;
+ TFuncType1 iF1;
+ TFuncType2 iF2;
+ TFuncType3 iF3;
+ TFuncType4 iF4;
+ };
+
+
+
+
+// CLASS DESCRIPTION
+
+
+/**
+ * Generic function call object to delete objects.
+ *
+ * This function call object doesn't own any of the
+ * parameters ==> the objects are deleted only when
+ * the DFC is executed.
+ *
+ * If deleted objects are provided as pointer reference ( Class*& ),
+ * the original pointer to object (e.g. class member)
+ * is set to NULL during the deletion.
+ */
+template< class C1,
+ class C2 = TAny*,
+ class C3 = TAny* >
+class TGenericObjDelete : public TMemFillBase, public MFunctionCall
+ {
+ public: //Construction / destruction
+ explicit TGenericObjDelete( C1 aObj1 )
+ : TMemFillBase( sizeof( TGenericObjDelete ) ),
+ iObj1( aObj1 )
+ {}
+
+ TGenericObjDelete( C1 aObj1, C2 aObj2 )
+ : TMemFillBase( sizeof( TGenericObjDelete ) ),
+ iObj1( aObj1 ),
+ iObj2( aObj2 )
+ {}
+
+ TGenericObjDelete( C1 aObj1, C2 aObj2, C3 aObj3 )
+ : TMemFillBase( sizeof( TGenericObjDelete ) ),
+ iObj1( aObj1 ),
+ iObj2( aObj2 ),
+ iObj3( aObj3 )
+ {}
+
+ ~TGenericObjDelete()
+ {}
+
+ private: //From MFunctionCall
+
+ void InvokeL()
+ {
+ delete iObj1;
+ iObj1 = NULL;
+
+ delete iObj2;
+ iObj2 = NULL;
+
+ delete iObj3;
+ iObj3 = NULL;
+ }
+
+ MFunctionCall* TGenericObjDelete::CloneLC() const
+ {
+ TAny* self = User::AllocL( sizeof( TGenericObjDelete ) );
+ Mem::Copy( self, this, sizeof( TGenericObjDelete ) );
+ TGenericObjDelete* self2 = (TGenericObjDelete*) self;
+ CleanupDeletePushL( self2 );
+ return (MFunctionCall*) self2;
+ }
+
+ private: //Call data
+
+ C1 iObj1;
+ C2 iObj2;
+ C3 iObj3;
+ };
+
+
+#endif // CDELAYEDFUNCTIONCALL_H__
+
+
+// End of File
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/LogoTools.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,115 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef LOGOTOOLS_H
+#define LOGOTOOLS_H
+
+#include <rphcltserver.h>
+//#include <phcltext.h>
+/*#include <CPhCltImageHandler.h>
+#include <CPhCltImageParams.h>
+#include <cphcltextbaseimageparams.h>*/
+#include <cphcltimagehandler.h>
+#include <cphcltimageparams.h>
+#include <cphcltbaseimageparams.h>
+#include <fbs.h>
+
+// Name of the Phone Client extension library.
+_LIT( KActiveIdlePhCltExtLibrary, "PhoneClientExt.dll" );
+
+// Ordinal of Phone Client extension factory method.
+const TInt KActiveIdlePhCltExtFactoryOrdinal = 1;
+
+
+
+LOCAL_C void StoreOTALogoL( TInt aMCC, TInt aMNC )
+ {
+ RPhCltServer server;
+ User::LeaveIfError( server.Connect() );
+ CleanupClosePushL( server );
+
+ RLibrary phCltExtLib;
+ User::LeaveIfError( phCltExtLib.Load( KActiveIdlePhCltExtLibrary ) );
+ CleanupClosePushL( phCltExtLib );
+
+ CPhCltImageHandler* imageHandler = CPhCltImageHandler::NewL();
+ CleanupStack::PushL( imageHandler );
+
+ CPhCltImageParams* params =
+ imageHandler->CPhCltBaseImageParamsL( EPhCltTypeOperatorLogo );
+ CleanupStack::PushL( params );
+
+ // opLogoParams not owned.
+ CPhCltExtOperatorLogoParams* opLogoParams =
+ static_cast<CPhCltExtOperatorLogoParams*>( params );
+
+ CFbsBitmap* bitmap = new( ELeave )CFbsBitmap;
+ CleanupStack::PushL( bitmap );
+ User::LeaveIfError( bitmap->Create( TSize( 97, 25 ), EColor256 ) );
+
+ opLogoParams->SetCodesL( aMCC, aMNC, EPhCltLogoTypeOTA );
+ opLogoParams->AddImageL( bitmap->Handle() );
+
+ User::LeaveIfError( imageHandler->SaveImages( *params ) );
+
+
+ CleanupStack::PopAndDestroy( bitmap );
+
+ CleanupStack::PopAndDestroy( params );
+ CleanupStack::PopAndDestroy( imageHandler );
+ CleanupStack::PopAndDestroy(); // CleanupClosePushL
+ CleanupStack::PopAndDestroy(); // CleanupClosePushL
+ }
+LOCAL_C void DeleteOTALogoL( TInt aMCC, TInt aMNC )
+ {
+ RPhCltServer server;
+ User::LeaveIfError( server.Connect() );
+ CleanupClosePushL( server );
+
+ RLibrary phCltExtLib;
+ User::LeaveIfError( phCltExtLib.Load( KActiveIdlePhCltExtLibrary ) );
+ CleanupClosePushL( phCltExtLib );
+
+ CPhCltImageHandler* imageHandler = CPhCltImageHandler::NewL();
+ CleanupStack::PushL( imageHandler );
+
+ CPhCltImageParams* params =
+ imageHandler->CPhCltBaseImageParamsL( EPhCltTypeOperatorLogo );
+ CleanupStack::PushL( params );
+
+ // opLogoParams not owned.
+ CPhCltExtOperatorLogoParams* opLogoParams =
+ static_cast<CPhCltExtOperatorLogoParams*>( params );
+
+ opLogoParams->SetCodesL( aMCC, aMNC, EPhCltLogoTypeOTA );
+ opLogoParams->AddImageL( KPhCltDeleteOperatorLogo );
+
+ User::LeaveIfError( imageHandler->SaveImages( *params ) );
+
+ CleanupStack::PopAndDestroy( params );
+ CleanupStack::PopAndDestroy( imageHandler );
+ CleanupStack::PopAndDestroy(); // CleanupClosePushL
+ CleanupStack::PopAndDestroy(); // CleanupClosePushL
+ }
+
+
+
+
+#endif // LOGOTOOLS_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/MT_DevStaPlg.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,1046 @@
+/*
+* 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "MT_DevStaPlg.h"
+#include "hscontentpublisher.h"
+#include "aidevicestatuscontentmodel.h"
+#include "caouserafter.h"
+#include "logotools.h"
+#include "testingtools.h"
+#include "contentobserver.h"
+#include "ainativeuiplugins.h"
+#include "aidevicestatusplugin.h"
+#include <aicontentrequest.h>
+#include <aidevstaplgres.rsg>
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/ceunitalloctestcasedecorator.h>
+#include <profile.hrh>
+#include <mprofilechangeobserver.h>
+#include <e32cmn.h>
+#include <gulicon.h>
+
+// INTERNAL INCLUDES
+
+const TInt KCountryCode = 244;
+const TInt KNetworkId = 91;
+
+// CONSTRUCTION
+MT_DevStaPlg* MT_DevStaPlg::NewL()
+ {
+ MT_DevStaPlg* self = MT_DevStaPlg::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+MT_DevStaPlg* MT_DevStaPlg::NewLC()
+ {
+ MT_DevStaPlg* self = new( ELeave ) MT_DevStaPlg();
+ CleanupStack::PushL( self );
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+MT_DevStaPlg::~MT_DevStaPlg()
+ {
+ //iLibrary.Close();
+ }
+
+// Default constructor
+MT_DevStaPlg::MT_DevStaPlg()
+ {
+ }
+
+// Second phase construct
+void MT_DevStaPlg::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+
+ //User::LeaveIfError( iLibrary.Load( _L("AiDevStaPlg.dll") ) );
+
+ //create test cases;
+
+ }
+
+
+void MT_DevStaPlg::SetupL( )
+ {
+// __UHEAP_MARK;
+ CStubDataHolder::InstanceL();
+ iCache = &CContentObserver::InstanceL();
+
+ TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DEVSTAPLUGIN };
+
+ _LIT8( KNameSpace, "1" );
+
+ THsPublisherInfo pubInfo( uid, KDeviceStatusPluginName, KNameSpace );
+
+ iPublisher = CHsContentPublisher::NewL( pubInfo );
+
+ RAiSettingsItemArray settings;
+ iPublisher->ConfigureL( settings );
+ iPublisher->SubscribeL( *iCache );
+ iPublisher->Start( CHsContentPublisher::ESystemStartup );
+ }
+
+void MT_DevStaPlg::SetupEmptyL()
+ {
+// __UHEAP_MARK;
+ }
+
+
+
+
+void MT_DevStaPlg::Teardown( )
+ {
+ if( iPublisher )
+ {
+ iPublisher->Stop( CHsContentPublisher::ESystemShutdown );
+ delete iPublisher;
+ iPublisher = NULL;
+ }
+
+ /*if( iUtils )
+ {
+ delete iUtils;
+ iUtils =NULL;
+ }*/
+
+ if( iCache )
+ {
+ iCache->Reset();
+ iCache->Release();
+ iCache = NULL;
+ }
+
+ CStubDataHolder::Release();
+ //delete iTestObserver;
+ //REComSession::FinalClose();
+ #if _BullseyeCoverage
+ cov_write();
+ #endif
+ }
+
+void MT_DevStaPlg::TestPropertyL()
+ {
+ EUNIT_ASSERT( iPublisher );
+
+ TAny* result = iPublisher->GetProperty( CHsContentPublisher::EPublisherContent );
+ EUNIT_ASSERT( result );
+
+ MAiContentItemIterator* iter = static_cast<MAiContentItemIterator*>( result );
+ EUNIT_ASSERT( iter );
+ }
+
+void MT_DevStaPlg::TestOperatorLogoPublisherL()
+ {
+ RFbsSession::Connect();
+
+ // StoreOTALogoL( KCountryCode, KNetworkId );
+
+ //only OTA logo
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iCountryCode.Format( _L("%i"), KCountryCode );
+ nwInfo->iNetworkId.Format( _L("%i"), KNetworkId );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredRoaming;
+ //TNWInfo nwInfo;
+
+ // CStubDataHolder::Instance()->SetNWMessageObserver(*iTestObserver, nwInfo);
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+
+ //CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ // EUNIT_ASSERT(cache);
+
+ /*
+ TPckgBuf<CGulIcon*> logoBuf;
+ logoBuf.Copy( *cache->iData );
+
+ //EUNIT_ASSERT( cache.iId );
+ EUNIT_ASSERT( logoBuf()->Bitmap() );
+ EUNIT_ASSERT( logoBuf()->Mask() );
+ */
+
+ RFbsSession::Disconnect();
+ }
+
+
+void MT_DevStaPlg::TestOperatorProgNamePublisherL()
+ {
+ _LIT( KOperatorName, "ProgName" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameNitzFull;
+ nwInfo->iOperatorNameInfo.iName.Copy( KOperatorName );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredRoaming;
+ //TNWInfo nwInfo;
+ //CStubDataHolder::Instance()->SetNWMessageObserver(*iTestObserver, nwInfo);
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+ //CContentCache* cache = iCache->GetContent( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+
+ EUNIT_ASSERT(cache);
+
+ EUNIT_ASSERT( *cache->iText == KOperatorName );
+ }
+
+
+void MT_DevStaPlg::TestOperatorNetinfoNamePublisher_LongL()
+ {
+ // BUG IN THE CODE, WILL NOT WORK UNTIL IT'S FIXED
+ _LIT( KOperatorNameLong, "OPERATOR II" );
+ _LIT( KOperatorName, "KEKS" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iLongName.Copy( KOperatorName );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredRoaming;
+ //nwInfo->iOperatorNameInfo.iName=KOperatorNameLong;
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ EUNIT_ASSERT(cache);
+
+ EUNIT_ASSERT( *cache->iText == KOperatorNameLong );
+ }
+
+void MT_DevStaPlg::TestOperatorNetinfoNamePublisher_ShortL()
+ {
+ // BUG IN THE CODE, WILL NOT WORK UNTIL IT'S FIXED
+ _LIT( KOperatorNameShort, "OPERATOR" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iShortName.Copy( KOperatorNameShort );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredRoaming;
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+
+ CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentNetworkIdentity );
+
+ EUNIT_ASSERT(cache);
+
+ EUNIT_ASSERT( *cache->iText == KOperatorNameShort );
+ }
+
+void MT_DevStaPlg::TestOperatorNetinfoNamePublisher_TagL()
+ {
+ // BUG IN THE CODE, WILL NOT WORK UNTIL IT'S FIXED
+ _LIT( KOperatorNameTag, "OP2" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iDisplayTag.Copy( KOperatorNameTag );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredRoaming;
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ EUNIT_ASSERT(cache);
+
+ EUNIT_ASSERT( *cache->iText == KOperatorNameTag );
+ }
+
+
+void MT_DevStaPlg::TestOperatorProviderNamePublisher_InSPDINoPLMNL()
+ {
+ _LIT( KOperatorProviderName, "Provider" );
+
+ // Delete logo, so it will not be published.
+ // DeleteOTALogoL(KCountryCode, KNetworkId);
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iSPName.Copy( KOperatorProviderName );
+ nwInfo->iServiceProviderNameDisplayReq |= ENWDisplaySPNRequired;
+// nwInfo->iServiceProviderNameDisplayReq |= ENWDisplayPLMNRequired;
+ nwInfo->iCountryCode.Format( _L("%i"), KCountryCode );
+ nwInfo->iNetworkId.Format( _L("%i"), KNetworkId );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredOnHomeNetwork;
+ EncodePLMNField( nwInfo->iPLMNField, ETrue, KCountryCode, KNetworkId );
+
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 500000 );
+
+ //CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentNetworkIdentity );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ EUNIT_ASSERT( cache );
+
+ EUNIT_ASSERT( *cache->iText == KOperatorProviderName );
+
+ iPublisher->Suspend( CHsContentPublisher::EBackground );
+ }
+
+void MT_DevStaPlg::TestOperatorProviderNamePublisher_InSPDIPLMNL()
+ {
+ _LIT( KOperatorProviderName, "Provider" );
+
+ // Delete logo, so it will not be published.
+ // DeleteOTALogoL(KCountryCode, KNetworkId);
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iSPName.Copy( KOperatorProviderName );
+ nwInfo->iServiceProviderNameDisplayReq |= ENWDisplaySPNRequired;
+ nwInfo->iServiceProviderNameDisplayReq |= ENWDisplayPLMNRequired;
+ nwInfo->iCountryCode.Format( _L("%i"), KCountryCode );
+ nwInfo->iNetworkId.Format( _L("%i"), KNetworkId );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredOnHomeNetwork;
+ EncodePLMNField( nwInfo->iPLMNField, ETrue, KCountryCode, KNetworkId );
+
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 500000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ EUNIT_ASSERT(cache);
+
+ // EUNIT_ASSERT( *cache->iText == KOperatorProviderName );
+
+ iCache->Reset();
+
+ //wait for clean
+ CAOUserAfter::AfterLD( 3 * 1000000 );
+
+ /*
+ cache = iCache->GetLastContent( EAiDeviceStatusContentNetworkIdentity, ETrue );
+ EUNIT_ASSERT( cache->iClean );
+ */
+
+ iPublisher->Suspend( CHsContentPublisher::EBackground );
+ }
+
+
+
+
+void MT_DevStaPlg::TestBTSAPPublisherL()
+ {
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ //fake BTSAP change
+
+ ChangeBTSAPValueL( EBTSapConnected );
+
+ CAOUserAfter::AfterLD( 1000000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ EUNIT_ASSERT( cache );
+
+ EUNIT_ASSERT( cache->iResource == R_ACTIVEIDLE_BT_SIM_ACCESS_PROFILE_STRING );
+
+ iCache->Reset();
+
+ DeleteBTSAPKey();
+
+ CAOUserAfter::AfterLD( 1000000 );
+
+ cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity, ETrue );
+
+ EUNIT_ASSERT( cache );
+
+ iPublisher->Suspend( CHsContentPublisher::EBackground );
+ }
+
+
+void MT_DevStaPlg::TestSimRegPublisherL()
+ {
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ EmulateSimRegFailEvent();
+
+ CAOUserAfter::AfterLD( 1000000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentSIMRegStatus );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ EUNIT_ASSERT( cache->iResource == EAiDeviceStatusResourceSIMRegFail );
+
+ iCache->Reset();
+
+ iPublisher->Suspend( CHsContentPublisher::EBackground );
+ }
+
+void MT_DevStaPlg::TestHCZPublisherL()
+ {
+ _LIT( KZoneName, "ZoneName" );
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ EmulateHCZEvent( KZoneName );
+
+ CAOUserAfter::AfterLD( 1000000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentVHZText );
+
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ EUNIT_ASSERT( *cache->iText == KZoneName );
+
+ iCache->Reset();
+
+ iPublisher->Suspend( CHsContentPublisher::EBackground );
+ }
+
+void MT_DevStaPlg::TestCUGPublisherL()
+ {
+ _LIT( KCUGMessage, "Group 7" );
+ const TInt KCUGIndex = 7;
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ EmulateCUGEvent( KCUGIndex );
+
+ CAOUserAfter::AfterLD( 1000000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentCUGIndicator );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ EUNIT_ASSERT( *cache->iText == KCUGMessage );
+
+ iCache->Reset();
+
+ iPublisher->Suspend( CHsContentPublisher::EBackground );
+ }
+
+void MT_DevStaPlg::TestMCNPublisherL()
+ {
+ _LIT( KMCNMessage, "MCN" );
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ EmulateMCNEvent( KMCNMessage );
+
+ CAOUserAfter::AfterLD( 1000000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentMCNIndicator );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ EUNIT_ASSERT( *cache->iText == KMCNMessage );
+
+ iCache->Reset();
+
+ iPublisher->Suspend( CHsContentPublisher::EBackground );
+ }
+
+/*
+void MT_DevStaPlg::TestContentRequest1L()
+ {
+ _LIT( KProfile, "Outdoor" );
+
+ RFbsSession::Connect();
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ CStubDataHolder::Instance()->SetCurrentProfileL( KProfile, EProfileGeneralId );
+
+ StoreOTALogoL( KCountryCode, KNetworkId );
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iCountryCode.Format( _L("%i"), KCountryCode );
+ nwInfo->iNetworkId.Format( _L("%i"), KNetworkId );
+
+ TAny* ptr = iPublisher->GetProperty( CHsContentPublisher::EContentRequest );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ptr );
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+
+
+ iCache->Reset();
+ RFbsSession::Disconnect();
+ }
+*/
+
+void MT_DevStaPlg::TestContentRequest2L()
+ {
+ _LIT( KOperatorProviderName, "Provider" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iSPName.Copy( KOperatorProviderName );
+ nwInfo->iServiceProviderNameDisplayReq |= ENWDisplaySPNRequired;
+ nwInfo->iCountryCode.Format( _L("%i"), KCountryCode );
+ nwInfo->iNetworkId.Format( _L("%i"), KNetworkId );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredOnHomeNetwork;
+ EncodePLMNField( nwInfo->iPLMNField, ETrue, KCountryCode, KNetworkId );
+
+ TAny* ptr = iPublisher->GetProperty( CHsContentPublisher::EContentRequest );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ptr );
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+ */
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest3L()
+ {
+ _LIT( KOperatorName, "ProgName" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameNitzFull;
+ nwInfo->iOperatorNameInfo.iName.Copy( KOperatorName );
+ nwInfo->iStatus = ENWStatusCurrent;
+ nwInfo->iRegistrationStatus = ENWRegisteredOnHomeNetwork;
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ // shouldn't have content...
+ // EUNIT_ASSERT( !cache );
+
+ // ...until now:
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+
+ TAny* ptr = iPublisher->GetProperty( CHsContentPublisher::EContentRequest );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ptr );
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+
+ // request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+ cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ EUNIT_ASSERT( cache );
+
+ // EUNIT_ASSERT( *cache->iText == KOperatorName );
+ iCache->Reset();
+ }
+
+/*
+void MT_DevStaPlg::TestContentRequest4L()
+ {
+ _LIT( KOperatorNameTag, "NetInfo" );
+ _LIT( KProfGeneral, "General" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iDisplayTag.Copy( KOperatorNameTag );
+
+ CStubDataHolder::Instance()->SetCurrentProfileL( KProfGeneral, EProfileGeneralId );
+
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ EUNIT_ASSERT( cache );
+
+ iCache->Reset();
+ }
+ */
+
+void MT_DevStaPlg::TestContentRequest5L()
+ {
+ _LIT( KOperatorName, "ProgName" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameNitzFull;
+ nwInfo->iOperatorNameInfo.iName.Copy( KOperatorName );
+
+ TAny* ptr = iPublisher->GetProperty( CHsContentPublisher::EContentRequest );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ptr );
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+ */
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ // shouldn't have content...
+ // EUNIT_ASSERT( !cache );
+
+ // ...until now:
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+
+ cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest6L()
+ {
+ _LIT( KProfile, "Outdoor" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ CStubDataHolder::Instance()->SetCurrentProfileL( KProfile, EProfileOutdoorId );
+
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentProfileName );
+ */
+ CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentProfileName );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest7L()
+ {
+ _LIT( KProfile, "General" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ CStubDataHolder::Instance()->SetCurrentProfileL( KProfile, EProfileGeneralId );
+
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentGeneralProfileName );
+ */
+ CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentGeneralProfileName );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest8L()
+ {
+ _LIT( KProfile, "Offline" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ CStubDataHolder::Instance()->SetCurrentProfileL( KProfile, EProfileOffLineId );
+
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+ */
+ CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentNetworkIdentity );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest9L()
+ {
+ TAny* ptr = iPublisher->GetProperty( CHsContentPublisher::EContentRequest );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ptr );
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+ */
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ request->RefreshContent( EAiDeviceStatusContentDate );
+ // request->RefreshContent( EAiDeviceStatusContentDate );
+ CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentDate );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest10L()
+ {
+ _LIT( KProfile, "Silent" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ CStubDataHolder::Instance()->SetCurrentProfileL( KProfile, EProfileSilentId );
+
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+ */
+
+ // EAiDeviceStatusContentProfileName and EAiDeviceStatusContentSilentIndicator
+ // are published in same class
+ // request->RefreshContent( EAiDeviceStatusContentProfileName );
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentSilentIndicator );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest13L()
+ {
+ _LIT( KZoneName, "ZoneName" );
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ EmulateHCZEvent( KZoneName );
+
+ TAny* ptr = iPublisher->GetProperty( CHsContentPublisher::EContentRequest );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ptr );
+ request->RefreshContent( EAiDeviceStatusContentVHZIndicator );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentVHZText );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest14L()
+ {
+ _LIT( KCUGMessage, "Group 7" );
+ const TInt KCUGIndex = 7;
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ EmulateCUGEvent( KCUGIndex );
+
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentCUGIndicator );
+ */
+ TAny* ptr = iPublisher->GetProperty( CHsContentPublisher::EContentRequest );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ptr );
+ request->RefreshContent( EAiDeviceStatusContentCUGIndicator );
+
+ CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentCUGIndicator );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ EUNIT_ASSERT( *cache->iText == KCUGMessage );
+
+ iCache->Reset();
+ }
+
+
+void MT_DevStaPlg::TestContentRequest15L()
+ {
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ ChangeBTSAPValueL( EBTSapConnected );
+
+ /*
+ MAiPropertyExtension* ext = static_cast<MAiPropertyExtension*>( iPublisher->Extension( KExtensionUidProperty ) );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ext->GetPropertyL( EAiContentRequest ) );
+
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+ */
+ TAny* ptr = iPublisher->GetProperty( CHsContentPublisher::EContentRequest );
+ MAiContentRequest* request = static_cast<MAiContentRequest*>( ptr );
+ request->RefreshContent( EAiDeviceStatusContentNetworkIdentity );
+
+ CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentNetworkIdentity );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ iCache->Reset();
+ DeleteBTSAPKey();
+ }
+
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_DevStaPlg,
+ "Device Status Plugin test cases",
+ "MODULE" )
+
+/*
+EUNIT_TEST(
+ "Test initializing",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupEmptyL, TestL, Teardown)
+*/
+
+EUNIT_TEST(
+ "Operator log publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestOperatorLogoPublisherL, Teardown)
+
+EUNIT_TEST(
+ "Test plugin property",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestPropertyL, Teardown)
+
+/*
+EUNIT_TEST(
+ "Publisher - silent & offline",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestProfilePublisher2L, Teardown)
+*/
+
+EUNIT_TEST(
+ "Test SimReg publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestSimRegPublisherL, Teardown)
+
+EUNIT_TEST(
+ "Test HCZ publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestHCZPublisherL, Teardown)
+
+EUNIT_TEST(
+ "Test CUG publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestCUGPublisherL, Teardown)
+
+EUNIT_TEST(
+ "Test MCN publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestMCNPublisherL, Teardown)
+
+EUNIT_TEST(
+ "Cont. Request 2",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestContentRequest2L, Teardown)
+
+EUNIT_TEST(
+ "Cont. Request 3",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestContentRequest3L, Teardown)
+
+EUNIT_TEST(
+ "Cont. Request 5",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestContentRequest5L, Teardown)
+
+EUNIT_TEST(
+ "Cont. Request 9",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestContentRequest9L, Teardown)
+
+EUNIT_TEST(
+ "Cont. Request 13",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestContentRequest13L, Teardown)
+
+EUNIT_TEST(
+ "Cont. Request 14",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestContentRequest14L, Teardown)
+
+EUNIT_TEST(
+ "Cont. Request 15",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestContentRequest15L, Teardown)
+
+EUNIT_TEST(
+ "SPDI show PLMN",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestOperatorProviderNamePublisher_InSPDIPLMNL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/MT_DevStaPlg.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,136 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef __MT_DEVSTAPLG_H__
+#define __MT_DEVSTAPLG_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// INTERNAL INCLUDES
+#include "aicontentobserver.h"
+#include "stubdataholder.h"
+#include "ccontentcache.h"
+
+// FORWARD DECLARATIONS
+class CHsContentPublisher;
+class CContentObserver;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_DevStaPlg )
+ : public CEUnitTestSuiteClass//, public MAiContentObserver
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_DevStaPlg* NewL();
+ static MT_DevStaPlg* NewLC();
+ /**
+ * Destructor
+ */
+ ~MT_DevStaPlg();
+
+ private: // Constructors and destructors
+
+ MT_DevStaPlg();
+ void ConstructL();
+
+ public: // From observer interface
+
+/*
+ TInt StartTransaction(TInt aTxId);
+ TInt Commit(TInt aTxId);
+ TInt Rollback(TInt aTxId);
+ TInt Publish(MAiPropertyExtension& aPlugin, TInt aContent, TInt aResource, TInt aIndex );
+ TInt Publish(MAiPropertyExtension& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex );
+ TInt Publish(MAiPropertyExtension& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex );
+ TInt Publish(MAiPropertyExtension& aPlugin, TInt aContent, RFile& aFile, TInt aIndex );
+ TInt Clean(MAiPropertyExtension& aPlugin, TInt aContent, TInt aIndex);
+ TAny* Extension(TUid aUid);
+ */
+
+
+ private: // New methods
+
+ void SetupL();
+ void SetupEmptyL();
+
+ void Teardown();
+
+ // void TestL();
+
+ void TestPropertyL();
+ // void TestProfilePublisher1L();
+ // void TestProfilePublisher2L();
+ void TestOperatorLogoPublisherL();
+ void TestOperatorProgNamePublisherL();
+ void TestOperatorNetinfoNamePublisher_LongL();
+ void TestOperatorNetinfoNamePublisher_ShortL();
+ void TestOperatorNetinfoNamePublisher_TagL();
+ void TestOperatorProviderNamePublisher_InSPDINoPLMNL();
+ void TestOperatorProviderNamePublisher_InSPDIPLMNL();
+ void TestBTSAPPublisherL();
+ void TestSimRegPublisherL();
+ void TestHCZPublisherL();
+ void TestCUGPublisherL();
+ void TestMCNPublisherL();
+ void TestContentRequest1L();
+ void TestContentRequest2L();
+ void TestContentRequest3L();
+ void TestContentRequest4L();
+ void TestContentRequest5L();
+ void TestContentRequest6L();
+ void TestContentRequest7L();
+ void TestContentRequest8L();
+ void TestContentRequest9L();
+ void TestContentRequest10L();
+ void TestContentRequest13L();
+ void TestContentRequest14L();
+ void TestContentRequest15L();
+
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ CHsContentPublisher* iPublisher;
+
+ CContentObserver* iCache;
+
+ RLibrary iLibrary;
+
+
+
+ };
+
+#endif // __MT_DEVSTAPLG_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/MT_DevStaPlgDllMain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "MT_DevStaPlg.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return MT_DevStaPlg::NewL();
+ }
+
+
+
+// END OF FILE
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/contentobserver.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,225 @@
+/*
+* Copyright (c) 2009 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 <e32svr.h>
+#include "contentobserver.h"
+
+
+CContentObserver& CContentObserver::InstanceL()
+ {
+ CContentObserver* self = static_cast<CContentObserver*>( Dll::Tls() );
+ if( self )
+ {
+ return *self;
+ }
+
+ self = new( ELeave )CContentObserver;
+ CleanupStack::PushL( self );
+ User::LeaveIfError( Dll::SetTls( self ) );
+ CleanupStack::Pop( self );
+ return *self;
+ }
+
+
+void CContentObserver::Release()
+ {
+ CContentObserver* self = static_cast<CContentObserver*>( Dll::Tls() );
+ delete self;
+ Dll::SetTls( NULL );
+ }
+
+
+void CContentObserver::Reset()
+ {
+ CContentObserver* self = static_cast<CContentObserver*>( Dll::Tls() );
+ if( self )
+ {
+ self->iCache.ResetAndDestroy();
+ }
+ }
+
+
+CContentCache* CContentObserver::GetContent( TInt aContentId, TBool aClean )
+ {
+ const TInt count( iCache.Count() );
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ if( iCache[i]->iId == aContentId )
+ {
+ if( !aClean && iCache[i]->iClean)
+ {
+ continue;
+ }
+ return iCache[i];
+ }
+ }
+
+ return NULL;
+ }
+
+
+CContentCache* CContentObserver::GetLastContent( TInt aContentId, TBool aClean )
+ {
+ const TInt count( iCache.Count() );
+ for( TInt i( count - 1 ); i >= 0; i-- )
+ {
+ if( iCache[i]->iId != aContentId )
+ {
+ return NULL;
+ }
+ if( !aClean && iCache[i]->iClean)
+ {
+ continue;
+ }
+ return iCache[i];
+ }
+ return NULL;
+ }
+
+
+CContentObserver::~CContentObserver()
+ {
+ iCache.ResetAndDestroy();
+ }
+
+
+TInt CContentObserver::StartTransaction(TInt aTxId)
+ {
+ return 0;
+ }
+
+
+TInt CContentObserver::Commit(TInt aTxId)
+ {
+ return 0;
+ }
+
+
+TInt CContentObserver::CancelTransaction(TInt aTxId)
+ {
+ return 0;
+ }
+
+
+TBool CContentObserver::CanPublish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aIndex*/ )
+ {
+ return EFalse;
+ }
+
+
+TInt CContentObserver::Publish(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex )
+ {
+ RDebug::Print( _L("Publish(%d, %d, %d)"), aContent, aResource, aIndex );
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iResource = aResource;
+ cache->iIndex = aIndex;
+ User::LeaveIfError( iCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+TInt CContentObserver::Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex )
+ {
+ RDebug::Print( _L("Publish(%d, \"%S\", %d)"), aContent, &aText, aIndex );
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iText = aText.AllocL();
+ cache->iIndex = aIndex;
+ User::LeaveIfError( iCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+
+TInt CContentObserver::Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex )
+ {
+ RDebug::Print( _L("Publish(%d, Buf.Len=%d, %d)"), aContent, aBuf.Length(), aIndex );
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iData = aBuf.AllocL();
+ cache->iIndex = aIndex;
+ User::LeaveIfError( iCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+
+TInt CContentObserver::Publish(CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex )
+ {
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iIndex = aIndex;
+ User::LeaveIfError( iCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+
+TInt CContentObserver::Clean(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex)
+ {
+ RDebug::Print( _L("Clean(%d, %d)"), aContent, aIndex );
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iIndex = aIndex;
+ cache->iClean = ETrue;
+ User::LeaveIfError( iCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+
+TAny* CContentObserver::Extension(TUid aUid)
+ {
+ return NULL;
+ }
+
+TBool CContentObserver::RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const
+ {
+ return EFalse;
+ }
+
+// ---------------------------------------------------------------------------
+// SetProperty
+// ---------------------------------------------------------------------------
+//
+TInt CContentObserver::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/ )
+{
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+// SetProperty
+// ---------------------------------------------------------------------------
+//
+TInt CContentObserver::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/,
+ MAiContentObserver::TValueType /*aValueType*/ )
+{
+ return KErrNone;
+}
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/contentobserver.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,77 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef C_CONTENTOBSERVER_H
+#define C_CONTENTOBSERVER_H
+
+#include <e32base.h>
+#include <aicontentobserver.h>
+
+#include "ccontentcache.h"
+
+class CContentObserver : public CBase, public MAiContentObserver
+ {
+public:
+
+ static CContentObserver& InstanceL();
+ static void Release();
+ static void Reset();
+ CContentCache* GetContent( TInt aContentId, TBool aClean = EFalse );
+ CContentCache* GetLastContent( TInt aContentId, TBool aClean = EFalse );
+
+ /**
+ *
+ */
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue );
+
+ /**
+ *
+ */
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue,
+ MAiContentObserver::TValueType aValueType);
+
+private:
+
+ ~CContentObserver();
+ TInt StartTransaction(TInt aTxId);
+ TInt Commit(TInt aTxId);
+ TInt CancelTransaction(TInt aTxId);
+ TBool CanPublish(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex );
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex );
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex );
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex );
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex );
+ TInt Clean(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex);
+ TAny* Extension(TUid aUid);
+ TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const;
+
+private:
+
+ RPointerArray<CContentCache> iCache;
+ };
+
+
+#endif // C_CONTENTOBSERVER_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/runtimetest.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,55 @@
+/*
+* Copyright (c) 2009 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 "runtimetest.h"
+
+
+CRuntimeTest::CRuntimeTest()
+ {
+ }
+CRuntimeTest::~CRuntimeTest()
+ {
+ delete iName;
+ }
+
+void CRuntimeTest::BaseConstructL( const TDesC& aName )
+ {
+ iName = CreateTestNameL( aName );
+ }
+
+const TDesC& CRuntimeTest::Name() const
+ {
+ return *iName;
+ }
+HBufC* CRuntimeTest::CreateTestNameL( const TDesC& aName ) const
+ {
+ HBufC* name = HBufC::NewL( aName.Length() + 200 ); //200 characters for rest of data
+ TPtr ptr( name->Des() );
+ ptr.Copy( aName );
+
+ ptr.Append( _L("\t") );
+ ptr.Append( _L("") ); //class name
+
+ ptr.Append( _L("\t") );
+ ptr.Append( _L("") ); //tested method
+
+ ptr.Append( _L("\t") );
+ ptr.Append( _L("FUNCTIONALITY") ); //test type
+
+
+ return name;
+ }
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/runtimetest.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef C_RUNTIMETEST_H
+#define C_RUNTIMETEST_H
+
+#include <digia/eunit/meunittestcase.h>
+#include <e32base.h>
+
+class CRuntimeTest : public CBase, public MEUnitTestCase
+ {
+protected:
+
+ CRuntimeTest();
+ virtual ~CRuntimeTest();
+
+ void BaseConstructL( const TDesC& aName );
+ virtual const TDesC& Name() const;
+ HBufC* CreateTestNameL( const TDesC& aName ) const;
+
+ virtual void SetupL() = 0;
+ virtual void RunTestL() = 0;
+ virtual void Teardown() = 0;
+
+private:
+
+ HBufC* iName;
+ };
+
+
+#endif // C_RUNTIMETEST_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/mt_devstaplg/testingtools.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef TESTINGTOOLS_H
+#define TESTINGTOOLS_H
+
+#include <btsapinternalpskeys.h>
+//#include <telephonyinternalpskeys.h>
+#include <activeidle2domainpskeys.h>
+#include <e32property.h>
+#include "stubdataholder.h"
+
+LOCAL_C void ChangeBTSAPValueL( TInt aValue )
+ {
+ RProperty::Define( KPSUidBluetoothSapConnectionState,
+ KBTSapConnectionState,
+ RProperty::EInt );
+
+ User::LeaveIfError( RProperty::Set( KPSUidBluetoothSapConnectionState,
+ KBTSapConnectionState,
+ aValue ) );
+
+ }
+
+LOCAL_C void DeleteBTSAPKey()
+ {
+ RProperty::Delete( KPSUidBluetoothSapConnectionState,
+ KBTSapConnectionState );
+ }
+
+
+LOCAL_C void EmulateSimRegFailEvent()
+ {
+
+ // Read capability: ReadUserData.
+ _LIT_SECURITY_POLICY_C1( KReadUserPolicy, ECapabilityReadUserData );
+ // Write capability: WriteDeviceData.
+ _LIT_SECURITY_POLICY_C1( KWriteDevicePolicy, ECapabilityWriteDeviceData );
+
+ RProperty::Define(
+ KPSUidAiInformation,
+ KActiveIdleState,
+ RProperty::EInt,
+ KReadUserPolicy,
+ KWriteDevicePolicy );
+
+
+ User::LeaveIfError( RProperty::Set( KPSUidAiInformation,
+ KActiveIdleState,
+ EPSAiForeground ) );
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iRegistrationStatus = ENWRegistrationDenied;
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkConnectionFailure );
+ }
+
+
+LOCAL_C void EmulateHCZEvent( const TDesC& aZoneName )
+ {
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iViagIndicatorType = ENWViagIndicatorTypeHomeZone;
+ nwInfo->iViagTextTag.Copy( aZoneName );
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageCurrentHomeZoneMessage );
+ }
+
+LOCAL_C void EmulateMCNEvent( const TDesC& aName )
+ {
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iMCNIndicatorType = ENWMCNIndicatorTypeActive;
+ nwInfo->iMCNName.Copy( aName );
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageCurrentCellInfoMessage );
+ }
+
+LOCAL_C void EmulateCUGEvent( TInt aIndex )
+ {
+ CStubDataHolder::Instance()->RemoveSSSetting( ESSSettingsCug );
+ CStubDataHolder::Instance()->SetSSSettingsValueL( ESSSettingsCug, aIndex );
+ RArray<MSSSettingsObserver*> observers = CStubDataHolder::Instance()->SSSettingsObservers();
+
+ for( TInt i( 0 ); i < observers.Count(); i++ )
+ {
+ observers[i]->PhoneSettingChanged( ESSSettingsCug, aIndex );
+ }
+ }
+
+
+LOCAL_C void EncodePLMNField( TDes& aBuf, TBool aShowSPN, TInt aMCC, TInt aMNC )
+ {
+ TPtr8 ptr( (TUint8*)aBuf.Ptr(), aBuf.MaxSize() );
+ ptr.Append( TChar( aShowSPN ) );
+
+ //one PLMN pair
+ ptr.Append( TChar( 1 ) );
+
+ TBuf8<3> mcc;
+ TBuf8<3> mnc;
+
+// mcc.Format( _L8("%d"), aMCC );
+ // mnc.Format( _L8("%d"), aMNC );
+ mcc.AppendNumFixedWidthUC( aMCC, EDecimal, 3 );//"241"
+ mnc.AppendNumFixedWidthUC( aMNC, EDecimal, 3 );//"091"
+
+ ptr.Append( TChar( ( mcc[0] - 48 ) | ( ( mcc[1] - 48 ) << 4 ) ) );
+ ptr.Append( TChar( ( mcc[2] - 48 ) | ( ( mnc[2] - 48 ) << 4 ) ) );
+ ptr.Append( TChar( ( mnc[0] - 48 ) | ( ( mnc[1] - 48 ) << 4 ) ) );
+
+ aBuf.SetLength( 3 );
+
+ }
+
+
+#endif // TESTINGTOOLS_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+devstaplg.mmp
+stub.mmp
+
+PRJ_TESTEXPORTS
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/group/devstaplg.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,106 @@
+/*
+* Copyright (c) 2002-2005 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:
+*
+*/
+
+
+/*
+ * Note!
+ *
+ * This separate .mmp is needed for creating instance of Device Status Plug-In
+ * that links against stub.lib instead of sssettings.lib, profileeng.lib and
+ * networkhandling.lib.
+ *
+ * Stub.lib contains dummy methods that are used in module tests.
+ */
+#include <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+#include <platform/mw/aisystemuids.hrh>
+
+TARGET aidevstaplg.dll
+TARGETTYPE PLUGIN
+UID 0x10009D8D AI_UID_ECOM_DLL_CONTENTPUBLISHER_DEVSTAPLUGIN
+
+CAPABILITY EUNIT_CAPS
+
+SOURCEPATH ../../../../plugins/devicestatus/src
+SOURCE aidevicestatusplugin.cpp
+SOURCE aidevicestatuspluginengine.cpp
+SOURCE aimulticontentobserver.cpp
+SOURCE aidatepublisher.cpp
+SOURCE aipublisherfactory.cpp
+SOURCE ainetworkinfolistener.cpp
+SOURCE aioperatorlogopublisher.cpp
+SOURCE aioperatornamepublisher.cpp
+SOURCE aibtsappublisher.cpp
+SOURCE aisimregpublisher.cpp
+SOURCE aimcnpublisher.cpp
+SOURCE aicugpublisher.cpp
+SOURCE aivhzpublisher.cpp
+SOURCE aipublishprioritizer.cpp
+SOURCE aicontentobserveroptimizer.cpp
+SOURCE ainwspublisher.cpp
+SOURCE aicugmcnpublisher.cpp
+
+SOURCEPATH ../../../../plugins/devicestatus/data
+START RESOURCE aidevstaplg.rss
+TARGET aidevstaplg.rsc
+END
+
+
+START RESOURCE aidevstaplgres.rss
+HEADER
+TARGET aidevstaplgres.rsc
+TARGETPATH APP_RESOURCE_DIR
+END
+
+USERINCLUDE ../../../../group
+USERINCLUDE ../../../../inc/common
+USERINCLUDE ../../../../plugins/devicestatus/inc
+USERINCLUDE ../../../../plugins/devicestatus/loc
+USERINCLUDE ../../../../cenrep
+USERINCLUDE ../../../../../../homescreen/idlehomescreen/inc
+USERINCLUDE /epoc32/include/platform/mw
+
+
+APP_LAYER_SYSTEMINCLUDE
+LIBRARY stub.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY avkon.lib
+LIBRARY sssettings.lib
+LIBRARY networkhandling.lib
+LIBRARY phoneclient.lib
+LIBRARY fbscli.lib
+LIBRARY cone.lib
+LIBRARY commonengine.lib
+LIBRARY featmgr.lib
+LIBRARY centralrepository.lib
+LIBRARY cenrepnotifhandler.lib
+LIBRARY egul.lib
+LIBRARY aknlayout2scalable.lib
+LIBRARY cdlengine.lib
+LIBRARY gdi.lib
+LIBRARY bitgdi.lib
+LIBRARY aiutils.lib
+LIBRARY flogger.lib
+LIBRARY bafl.lib
+LIBRARY profileengine.lib
+
+LANG SC
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/group/stub.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2002-2005 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET stub.dll
+TARGETTYPE dll
+UID 0x1000008D 0x10167668
+
+CAPABILITY EUNIT_CAPS
+
+EPOCSTACKSIZE 0x5000
+
+SOURCEPATH ../src
+SOURCE stub.cpp
+SOURCE stubdataholder.cpp
+SOURCE profileengine.cpp
+SOURCE networkhandling.cpp
+
+APP_LAYER_SYSTEMINCLUDE
+LIBRARY euser.lib
+
+LANG SC
+
+//EXPORTUNFROZEN
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/aidatepublishercontainer.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#define private public
+#include "aidatepublisher.cpp"
+#undef private
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/aioperatorlogopublishercontainer.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#define private public
+#include "aioperatorlogopublisher.cpp"
+#undef private
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/aioperatornamepublishercontainer.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#define private public
+#include "aioperatornamepublisher.cpp"
+#undef private
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/aiprofilepublishercontainer.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,20 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+#define private public
+#include "aiprofilepublisher.cpp"
+#undef private
\ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/networkhandling.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 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: ?Description
+*
+*/
+
+
+//#include <?include_file>
+#include "networkhandling.h"
+#include "stubdataholder.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CNWSession::CNWSession()
+ {
+ }
+CNWSession::~CNWSession()
+ {
+ }
+
+CNWSessionStub::CNWSessionStub( MNWMessageObserver& aObserver, TNWInfo& aInfo )
+ {
+ CStubDataHolder::Instance()->SetNWMessageObserver( aObserver, aInfo );
+ };
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/networkhandling.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,36 @@
+/*
+* Copyright (c) 2005 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: ?Description
+*
+*/
+
+
+#ifndef NETWORKHANDLING_H
+#define NETWORKHANDLING_H
+
+
+#include <e32base.h>
+#include <cnwsession.h>
+#include <nwhandlingengine.h>
+
+class MNWMessageObserver;
+
+
+class CNWSessionStub : public CNWSession
+ {
+ public:
+ CNWSessionStub( MNWMessageObserver& aObserver, TNWInfo& aInfo );
+ };
+
+#endif // NETWORKHANDLING_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/profileengine.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,226 @@
+/*
+* Copyright (c) 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: ?Description
+*
+*/
+
+
+//#include <?include_file>
+#include <profile.hrh>
+#include <cprofilechangenotifyhandler.h>
+#include "profileengine.h"
+#include "stubdataholder.h"
+
+// ======== MEMBER FUNCTIONS ========
+
+CProfileChangeNotifyHandler::CProfileChangeNotifyHandler(MProfileChangeObserver* /*aProfileChangeObserver*/)
+ {
+ }
+
+
+CProfileChangeNotifyHandler::~CProfileChangeNotifyHandler()
+ {
+ }
+
+
+CProfileChangeNotifyHandler* CProfileChangeNotifyHandler::NewL(MProfileChangeObserver* aProfileChangeObserver)
+ {
+ CProfileChangeNotifyHandler* _this = new( ELeave )CProfileChangeNotifyHandler( aProfileChangeObserver);
+ CleanupStack::PushL( _this );
+ CStubDataHolder::Instance()->AddProfileChangeObserverL( *aProfileChangeObserver, _this );
+ CleanupStack::Pop();
+ return _this;
+ }
+
+
+CProfile::~CProfile()
+ {
+ }
+
+
+void CProfile::Release()
+ {
+ delete this;
+ }
+
+
+const TArray<TContactItemId> CProfile::AlertForL()
+ {
+ RArray<TContactItemId> array;
+ return array.Array();
+ }
+
+
+TBool CProfile::IsSilent() const
+ {
+ return ( CStubDataHolder::Instance()->CurrentProfile()->Id() == EProfileSilentId );
+ }
+
+
+const MProfileName& CProfile::ProfileName() const
+ {
+ return *CStubDataHolder::Instance()->CurrentProfile();
+ }
+
+
+const MProfileTones& CProfile::ProfileTones() const
+ {
+ MProfileTones* ret = NULL;
+ return *ret;
+ }
+
+
+const MProfileExtraTones& CProfile::ProfileExtraTones() const
+ {
+ MProfileExtraTones* ret = NULL;
+ return *ret;
+ }
+
+
+const MProfileExtraSettings& CProfile::ProfileExtraSettings() const
+ {
+ MProfileExtraSettings* ret = NULL;
+ return *ret;
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CProfileEngine::CProfileEngine()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CProfileEngine::ConstructL()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CProfileEngine* CProfileEngine::NewL()
+ {
+ CProfileEngine* self = CProfileEngine::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CProfileEngine* CProfileEngine::NewLC()
+ {
+ CProfileEngine* self = new( ELeave ) CProfileEngine();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CProfileEngine::~CProfileEngine()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// From class ?base_class.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+void CProfileEngine::Release()
+ {
+ delete this;
+ }
+
+
+MProfile* CProfileEngine::ActiveProfileLC()
+ {
+ if( CStubDataHolder::Instance()->CurrentProfile()->Name().Length() == 0 )
+ {
+ User::Leave( KErrNotReady );
+ }
+ CProfile* profile = new( ELeave )CProfile;
+ CleanupStack::PushL( profile );
+ return profile;
+ }
+
+
+MProfile* CProfileEngine::ActiveProfileL()
+ {
+ CProfile* profile = new( ELeave )CProfile;
+ return profile;
+ }
+
+
+TInt CProfileEngine::ActiveProfileId()
+ {
+ return CStubDataHolder::Instance()->CurrentProfile()->Id();
+ }
+
+
+MProfilesNamesArray* CProfileEngine::ProfilesNamesArrayLC()
+ {
+ return NULL;
+ }
+
+
+void CProfileEngine::SetActiveProfileL( TInt /*aId*/ )
+ {
+ }
+
+
+void CProfileEngine::SetTempRingingVolumeL( TProfileRingingVolume /*aVolume*/ )
+ {
+ }
+
+
+TProfileRingingVolume CProfileEngine::TempRingingVolumeL() const
+ {
+ }
+
+
+void CProfileEngine::SetTempMediaVolumeL( TProfileRingingVolume /*aVolume*/ )
+ {
+ }
+
+
+TProfileRingingVolume CProfileEngine::TempMediaVolumeL() const
+ {
+ }
+
+
+TBool CProfileEngine::IsFeatureSupported( TProfileFeatureId /*aFeatureId*/ ) const
+ {
+ return EFalse;
+ }
+
+TBool CProfileEngine::IsActiveProfileTimedL()
+ {
+ return EFalse;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/profileengine.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2005 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: ?Description
+*
+*/
+
+
+#ifndef C_PROFILECHANGENOTIFYHANDLERSTUB_H
+#define C_PROFILECHANGENOTIFYHANDLERSTUB_H
+
+
+#include <e32base.h>
+#include <mprofileengine.h>
+#include <mprofile.h>
+
+
+class CProfile : public CBase, public MProfile
+ {
+ ~CProfile();
+public:
+ virtual void Release();
+ virtual const TArray<TContactItemId> AlertForL();
+ virtual TBool IsSilent() const;
+ virtual const MProfileName& ProfileName() const;
+ virtual const MProfileTones& ProfileTones() const;
+ virtual const MProfileExtraTones& ProfileExtraTones() const;
+ virtual const MProfileExtraSettings& ProfileExtraSettings() const;
+ };
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 ?S60_version *** for example, S60 v3.0
+ */
+class CProfileEngine : public CBase, public MProfileEngine
+ {
+public:
+
+ static CProfileEngine* NewL();
+
+ static CProfileEngine* NewLC();
+
+ virtual ~CProfileEngine();
+
+ void Release();
+ MProfile* ActiveProfileLC();
+ MProfile* ActiveProfileL();
+ TInt ActiveProfileId();
+ MProfilesNamesArray* ProfilesNamesArrayLC();
+ void SetActiveProfileL( TInt aId );
+ void SetTempRingingVolumeL( TProfileRingingVolume aVolume );
+ TProfileRingingVolume TempRingingVolumeL() const;
+ void SetTempMediaVolumeL( TProfileRingingVolume aVolume );
+ TProfileRingingVolume TempMediaVolumeL() const;
+ TBool IsFeatureSupported( TProfileFeatureId aFeatureId ) const;
+ TBool IsActiveProfileTimedL();
+
+private:
+
+ CProfileEngine();
+
+ void ConstructL();
+
+private: // data
+ };
+
+
+#endif // C_PROFILECHANGENOTIFYHANDLERSTUB_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/stub.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* Copyright (c) 2002-2005 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 "stub.h"
+#include "cprofilechangenotifyhandler.h"
+#include "stubdataholder.h"
+#include "profileengine.h"
+#include "networkhandling.h"
+
+
+EXPORT_C RSSSettings::RSSSettings()
+ {
+ }
+
+
+EXPORT_C TInt RSSSettings::Open()
+ {
+ TRAPD( err, CStubDataHolder::InstanceL() );
+ return err;
+ }
+
+
+TInt RSSSettings::Get( TSSSettingsSetting aSetting, TInt& aValue )
+ {
+ TRAPD( err, aValue = CStubDataHolder::Instance()->GetSSSettingsValueL( aSetting ) );
+ return err;
+ }
+
+
+TBool RSSSettings::IsValueValidCugIndex( const TInt& /*aValue*/ ) const
+ {
+ TRAPD( err, CStubDataHolder::Instance()->GetSSSettingsValueL( ESSSettingsCug ) );
+ return ( err == KErrNone );
+ }
+
+
+EXPORT_C MProfileEngine* CreateProfileEngineL(void)
+ {
+ CStubDataHolder::InstanceL();
+ return CProfileEngine::NewL();
+ }
+
+
+EXPORT_C void RSSSettings::CancelAll(MSSSettingsObserver &aObserver)
+ {
+ CStubDataHolder::Instance()->RemoveSSSettingsObserver( aObserver );
+ }
+
+
+EXPORT_C void RSSSettings::Close()
+ {
+ }
+
+
+EXPORT_C TInt RSSSettings::Register(TSSSettingsSetting /*aSetting*/, MSSSettingsObserver& aObserver)
+ {
+ TRAPD( err, CStubDataHolder::Instance()->AddSSSettingsObserverL( aObserver ) );
+ return err;
+ }
+
+
+EXPORT_C CNWSession* CreateL(class MNWMessageObserver& aObserver, struct TNWInfo& aInfo)
+ {
+ CStubDataHolder::InstanceL();
+ return new( ELeave )CNWSessionStub( aObserver, aInfo );
+ };
+
+
+GLDEF_C TInt E32Dll(TInt)
+ {
+ return KErrNone;
+ }
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/stub.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2002-2005 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:
+*
+*/
+
+
+#ifndef STUB_H
+#define STUB_H
+
+#include <e32std.h>
+#include <rsssettings.h>
+#include <mprofileengine.h>
+#include <cprofilechangenotifyhandler.h>
+#include <cnwsession.h>
+#include <rphcltserver.h>
+
+
+#endif
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/stubdataholder.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,301 @@
+/*
+* Copyright (c) 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: ?Description
+*
+*/
+
+
+#include "stubdataholder.h"
+
+
+CProfileName::~CProfileName()
+ {
+ delete iName;
+ }
+
+
+TInt CProfileName::Id() const
+ {
+ return iId;
+ }
+
+
+const TDesC& CProfileName::Name() const
+ {
+ if( iName )
+ {
+ return *iName;
+ }
+ return KNullDesC;
+ }
+
+const TDesC& CProfileName::NaviName() const
+ {
+ if( iNaviName )
+ {
+ return *iNaviName;
+ }
+ return KNullDesC;
+ }
+
+const TDesC& CProfileName::TitleName() const
+ {
+ if( iTitleName )
+ {
+ return *iTitleName;
+ }
+ return KNullDesC;
+ }
+
+
+void CProfileName::SetL( const TDesC& aName, TInt aId )
+ {
+ delete iName;
+ iName = NULL;
+ iName = aName.AllocL();
+ iId = aId;
+ }
+
+
+const TDesC& CProfileName::ShortName() const
+ {
+ if( iName )
+ {
+ return *iName;
+ }
+ return KNullDesC;
+ }
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CStubDataHolder::CStubDataHolder()
+ {
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+void CStubDataHolder::ConstructL()
+ {
+ iProfile = new( ELeave ) CProfileName;
+
+ User::LeaveIfError( Dll::SetTls( this ) );
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+EXPORT_C CStubDataHolder* CStubDataHolder::InstanceL()
+ {
+ CStubDataHolder* ptr = static_cast<CStubDataHolder*>( Dll::Tls() );
+
+ if( ptr )
+ {
+ return ptr;
+ }
+
+ CStubDataHolder* self = new( ELeave ) CStubDataHolder;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+
+EXPORT_C CStubDataHolder* CStubDataHolder::Instance()
+ {
+ CStubDataHolder* ptr = static_cast<CStubDataHolder*>( Dll::Tls() );
+
+ if( !ptr )
+ {
+ User::Panic( _L("StubDataHolder"), 1 );
+ }
+
+ return ptr;
+ }
+
+
+EXPORT_C void CStubDataHolder::Release()
+ {
+ CStubDataHolder* ptr = static_cast<CStubDataHolder*>( Dll::Tls() );
+
+ if( ptr )
+ {
+ delete ptr;
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+
+// ---------------------------------------------------------------------------
+// ?description_if_needed
+// ---------------------------------------------------------------------------
+//
+CStubDataHolder::~CStubDataHolder()
+ {
+ iSSSettingValues.Reset();
+ iSSSettingsObservers.Reset();
+ iProfileChangeObservers.Reset();
+ delete iProfile;
+ Dll::SetTls( NULL );
+ }
+
+
+// ---------------------------------------------------------------------------
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+EXPORT_C void CStubDataHolder::AddProfileChangeObserverL( MProfileChangeObserver& aObserver, CBase* aOwner )
+ {
+ TProfileObserver obs;
+ obs.iOwner = aOwner;
+ obs.iObserver = &aObserver;
+ User::LeaveIfError( iProfileChangeObservers.Append( obs ) );
+ }
+
+
+EXPORT_C void CStubDataHolder::RemoveProfileChangeObserver( CBase* aOwner )
+ {
+ const TInt count = iProfileChangeObservers.Count();
+
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ if( iProfileChangeObservers[i].iOwner == aOwner )
+ {
+ iProfileChangeObservers.Remove( i );
+ break;
+ }
+ }
+ }
+
+
+EXPORT_C RArray<TProfileObserver>& CStubDataHolder::ProfileChangeObservers()
+ {
+ return iProfileChangeObservers;
+ }
+
+
+EXPORT_C void CStubDataHolder::SetCurrentProfileL( const TDesC& aName, TInt aId )
+ {
+ iProfile->SetL( aName, aId );
+ }
+
+
+EXPORT_C MProfileName* CStubDataHolder::CurrentProfile()
+ {
+ return iProfile;
+ }
+
+
+EXPORT_C void CStubDataHolder::SetNWMessageObserver( MNWMessageObserver& aObserver, TNWInfo& aInfo )
+ {
+ iNWObserver = &aObserver;
+ iNWInfo = &aInfo;
+ }
+
+
+EXPORT_C MNWMessageObserver* CStubDataHolder::NWMessageObserver()
+ {
+ return iNWObserver;
+ }
+
+
+EXPORT_C TNWInfo* CStubDataHolder::NWInfo()
+ {
+ return iNWInfo;
+ }
+
+// ---------------------------------------------------------------------------
+// From class ?base_class.
+// ?implementation_description
+// ---------------------------------------------------------------------------
+//
+void CStubDataHolder::AddSSSettingsObserverL( MSSSettingsObserver& aObserver )
+ {
+ User::LeaveIfError( iSSSettingsObservers.Append( &aObserver ) );
+ };
+
+
+TInt CStubDataHolder::GetSSSettingsValueL( TSSSettingsSetting aSetting )
+ {
+ const TInt count = iSSSettingValues.Count();
+
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ if( iSSSettingValues[i].iSetting == aSetting )
+ {
+ return iSSSettingValues[i].iValue;
+ }
+ }
+
+ User::Leave( KErrNotFound );
+ return KErrNotFound;
+ }
+
+
+void CStubDataHolder::RemoveSSSettingsObserver( MSSSettingsObserver& aObserver )
+ {
+ const TInt count = iSSSettingsObservers.Count();
+
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ if( iSSSettingsObservers[i] == &aObserver )
+ {
+ iSSSettingsObservers.Remove( i );
+ break;
+ }
+ }
+ }
+
+
+EXPORT_C RArray<MSSSettingsObserver*>& CStubDataHolder::SSSettingsObservers()
+ {
+ return iSSSettingsObservers;
+ }
+
+
+EXPORT_C void CStubDataHolder::SetSSSettingsValueL( TSSSettingsSetting aSetting, TInt aValue )
+ {
+ TSSSettingsValue ss;
+ ss.iSetting = aSetting;
+ ss.iValue = aValue;
+ User::LeaveIfError( iSSSettingValues.Append( ss ) );
+ }
+
+
+EXPORT_C void CStubDataHolder::RemoveSSSetting( TSSSettingsSetting aSetting )
+ {
+ const TInt count = iSSSettingValues.Count();
+
+ for( TInt i( count - 1 ); i >= 0; i-- )
+ {
+ if( iSSSettingValues[i].iSetting == aSetting )
+ {
+ iSSSettingValues.Remove( i );
+ }
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/stub/src/stubdataholder.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,127 @@
+/*
+* Copyright (c) 2005 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: ?Description
+*
+*/
+
+
+#ifndef C_STUBDATAHOLDER_H
+#define C_STUBDATAHOLDER_H
+
+
+#include <e32base.h>
+#include <mprofilename.h>
+#include <nwhandlingengine.h>
+#include <rsssettings.h>
+#include <msssettingsobserver.h>
+
+
+class MProfileChangeObserver;
+
+class CProfileName : public CBase, public MProfileName
+ {
+public:
+
+ ~CProfileName();
+ TInt Id() const;
+ const TDesC& Name() const;
+ const TDesC& NaviName() const;
+ void SetL( const TDesC& aName, TInt aId );
+ const TDesC& ShortName() const;
+ const TDesC& TitleName() const;
+
+private:
+
+ HBufC* iName;
+ HBufC* iNaviName;
+ HBufC* iTitleName;
+ TInt iId;
+ };
+
+
+
+class TSSSettingsValue
+ {
+public:
+ TSSSettingsSetting iSetting;
+ TInt iValue;
+ };
+
+
+class TProfileObserver
+ {
+public:
+ CBase* iOwner;
+ MProfileChangeObserver* iObserver;
+ };
+
+/**
+ * ?one_line_short_description
+ *
+ * ?more_complete_description
+ *
+ * @lib ?library
+ * @since S60 ?S60_version *** for example, S60 v3.0
+ */
+class CStubDataHolder : public CBase
+ {
+public:
+
+ IMPORT_C static CStubDataHolder* InstanceL();
+ IMPORT_C static CStubDataHolder* Instance();
+ IMPORT_C static void Release();
+ virtual ~CStubDataHolder();
+
+
+
+ IMPORT_C void AddProfileChangeObserverL( MProfileChangeObserver& aObserver, CBase* aOwner );
+ IMPORT_C void RemoveProfileChangeObserver( CBase* aOwner );
+ IMPORT_C RArray<TProfileObserver>& ProfileChangeObservers();
+
+ IMPORT_C void SetCurrentProfileL( const TDesC& aName, TInt aId );
+ IMPORT_C MProfileName* CurrentProfile();
+
+ IMPORT_C void SetNWMessageObserver( MNWMessageObserver& aObserver, TNWInfo& aInfo );
+ IMPORT_C MNWMessageObserver* NWMessageObserver();
+ IMPORT_C TNWInfo* NWInfo();
+
+
+ void AddSSSettingsObserverL( MSSSettingsObserver& aObserver );
+ void RemoveSSSettingsObserver( MSSSettingsObserver& aObserver );
+ TInt GetSSSettingsValueL( TSSSettingsSetting aSetting );
+ IMPORT_C RArray<MSSSettingsObserver*>& SSSettingsObservers();
+ IMPORT_C void SetSSSettingsValueL( TSSSettingsSetting aSetting, TInt aValue );
+ IMPORT_C void RemoveSSSetting( TSSSettingsSetting aSetting );
+
+
+protected:
+
+private:
+
+ CStubDataHolder();
+
+ void ConstructL();
+
+private: // data
+
+ RArray<TProfileObserver> iProfileChangeObservers;
+ CProfileName* iProfile;
+ MNWMessageObserver* iNWObserver;
+ TNWInfo* iNWInfo;
+ RArray<TSSSettingsValue> iSSSettingValues;
+ RArray<MSSSettingsObserver*> iSSSettingsObservers;
+ };
+
+
+#endif // C_STUBDATAHOLDER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/ut_devstaplg/UT_DevStaPlg.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,334 @@
+/*
+* 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "aioperatornamepublisher.h"
+#include "UT_DevStaPlg.h"
+#include "aicontentpublisher.h"
+#include "aidevicestatuscontentmodel.h"
+#include "caouserafter.h"
+#include "logotools.h"
+#include "testingtools.h"
+#include "contentobserver.h"
+#include "ainativeuiplugins.h"
+#include <aicontentrequest.h>
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/ceunitalloctestcasedecorator.h>
+#include <profile.hrh>
+#include <mprofilechangeobserver.h>
+#include <e32cmn.h>
+#include <gulicon.h>
+
+#include "aidevicestatusplugin.h"
+
+// INTERNAL INCLUDES
+
+const TInt KCountryCode = 244;
+const TInt KNetworkId = 91;
+
+// CONSTRUCTION
+UT_DevStaPlg* UT_DevStaPlg::NewL()
+ {
+ UT_DevStaPlg* self = UT_DevStaPlg::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+UT_DevStaPlg* UT_DevStaPlg::NewLC()
+ {
+ UT_DevStaPlg* self = new( ELeave ) UT_DevStaPlg();
+ CleanupStack::PushL( self );
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+UT_DevStaPlg::~UT_DevStaPlg()
+ {
+ }
+
+// Default constructor
+UT_DevStaPlg::UT_DevStaPlg()
+ {
+ }
+
+// Second phase construct
+void UT_DevStaPlg::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+
+void UT_DevStaPlg::SetupL( )
+ {
+ CStubDataHolder::InstanceL();
+ iCache = &CContentObserver::InstanceL();
+
+ TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DEVSTAPLUGIN };
+
+ _LIT8( KNameSpace, "1" );
+
+ THsPublisherInfo pubInfo( uid, KDeviceStatusPluginName, KNameSpace );
+
+ iPublisher = CHsContentPublisher::NewL( pubInfo );
+
+ RAiSettingsItemArray settings;
+ iPublisher->ConfigureL( settings );
+ iPublisher->SubscribeL( *iCache );
+ iPublisher->Start( CHsContentPublisher::ESystemStartup );
+ }
+
+void UT_DevStaPlg::SetupEmptyL()
+ {
+// __UHEAP_MARK;
+ }
+
+
+
+
+void UT_DevStaPlg::Teardown( )
+ {
+ if( iPublisher )
+ {
+ iPublisher->Stop( EAiSystemStartup );
+ delete iPublisher;
+ iPublisher = NULL;
+ }
+
+ /*if( iUtils )
+ {
+ delete iUtils;
+ iUtils =NULL;
+ }*/
+
+ if( iCache )
+ {
+ iCache->Reset();
+ iCache->Release();
+ iCache = NULL;
+ }
+
+ CStubDataHolder::Release();
+ REComSession::FinalClose();
+ #if _BullseyeCoverage
+ cov_write();
+ #endif
+ }
+
+
+
+void UT_DevStaPlg::TestL()
+ {
+ CAiOperatorNamePublisher* namePub = CAiOperatorNamePublisher::NewL();
+ /*
+ namePub->Subscribe( *this,
+ *static_cast<MAiPropertyExtension*>(iPublisher->Extension( KExtensionUidProperty )),
+ *this,
+ *this );
+ */
+ namePub->Subscribe( *this,
+ *iPublisher,
+ *this,
+ *this );
+
+ MAiNetworkInfoObserver* name = namePub;
+ name->HandleNetworkInfoChange( MNWMessageObserver::ENWMessageNetworkInfoChange,
+ *CStubDataHolder::Instance()->NWInfo(),
+ ETrue );
+ name->HandleNetworkInfoChange( MNWMessageObserver::ENWMessageNetworkInfoChange,
+ *CStubDataHolder::Instance()->NWInfo(),
+ EFalse );
+ _LIT( KProfSilent, "Silent" );
+ _LIT( KProfOffline, "Offline" );
+
+ //when publisher is resumed, profile is updated
+ //wait for a while
+
+ CStubDataHolder::InstanceL()->SetCurrentProfileL( KProfSilent, EProfileSilentId );
+
+ //when publisher is resumed, profile update should be published
+ iPublisher->Resume( EAiSystemStartup );
+
+ CAOUserAfter::AfterLD( 100000 );
+
+ //iBuf should now contain TAiDeviceStatusContentProfile structure
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentSilentIndicator );
+ EUNIT_ASSERT( cache );
+
+ iCache->Reset();
+
+ //change profile
+ CStubDataHolder::InstanceL()->SetCurrentProfileL( KProfOffline, EProfileOffLineId );
+
+ RArray<TProfileObserver>& obs = CStubDataHolder::InstanceL()->ProfileChangeObservers();
+ const TInt count = obs.Count();
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ obs[i].iObserver->HandleActiveProfileEventL( EProfileActiveProfileModified , EProfileOffLineId );
+ }
+
+
+ //iBuf should now contain updated TAiDeviceStatusContentProfile structure
+
+ cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+
+ EUNIT_ASSERT( KProfOffline() == *cache->iText );
+
+ iCache->Reset();
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ UT_DevStaPlg,
+ "Device Status Plugin test cases",
+ "MODULE" )
+
+EUNIT_TEST(
+ "Test",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestL, Teardown)
+
+/*
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test initializing",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupEmptyL, TestL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test plugin property",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestPropertyL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test profile publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestProfilePublisherL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test operator logo publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestOperatorLogoPublisherL, Teardown)
+
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test operator prog name publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestOperatorProgNamePublisherL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test operator netinfo name publisher - long",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestOperatorNetinfoNamePublisher_LongL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test operator netinfo name publisher - short",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestOperatorNetinfoNamePublisher_ShortL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test operator netinfo name publisher - tag",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestOperatorNetinfoNamePublisher_TagL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test operator provider name publisher - in SPDI don't show PLMN",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestOperatorProviderNamePublisher_InSPDINoPLMNL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test operator provider name publisher - in SPDI show PLMN",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestOperatorProviderNamePublisher_InSPDIPLMNL, Teardown)
+
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test BTSAP publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestBTSAPPublisherL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test SimReg publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestSimRegPublisherL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test HCZ publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestHCZPublisherL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test CUG publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestCUGPublisherL, Teardown)
+
+EUNIT_ALLOC_TEST(
+ "(Alloc) Test MCN publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "ERRORHANDLING",
+ SetupL, TestMCNPublisherL, Teardown)
+*/
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/ut_devstaplg/UT_DevStaPlg.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,172 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef __UT_DEVSTAPLG_H__
+#define __UT_DEVSTAPLG_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// INTERNAL INCLUDES
+#include "aicontentobserver.h"
+#include "stubdataholder.h"
+#include "ccontentcache.h"
+#include "aiprioritizer.h"
+#include "aipublisherbroadcaster.h"
+
+// FORWARD DECLARATIONS
+class CHsContentPublisher;
+class CContentObserver;
+class CStubDataHolder;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( UT_DevStaPlg )
+ : public CEUnitTestSuiteClass,
+ public MAiPublishPrioritizer,
+ public MAiPublisherBroadcaster,
+ public MAiContentObserver
+
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_DevStaPlg* NewL();
+ static UT_DevStaPlg* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_DevStaPlg();
+
+ private: // Constructors and destructors
+
+ UT_DevStaPlg();
+ void ConstructL();
+
+ public: // MAiPublishPrioritizer
+
+ void TryToPublishL( MAiPublisherBroadcaster& aBroadcaster,
+ TInt aContent,
+ TInt aResource,
+ TInt aPriority )
+ {
+ };
+
+ void TryToPublishL( MAiPublisherBroadcaster& aBroadcaster,
+ TInt aContent,
+ const TDesC16& aText,
+ TInt aPriority )
+ {
+ };
+
+ void TryToPublishL( MAiPublisherBroadcaster& aBroadcaster,
+ TInt aContent,
+ const TDesC8& aBuf,
+ TInt aPriority )
+ {
+ };
+
+ void TryToCleanL( MAiPublisherBroadcaster& aBroadcaster,
+ TInt aContent,
+ TInt aPriority )
+ {
+ };
+
+
+ TInt NextPriority() const
+ {
+ return 0;
+ };
+
+ public: // MAiPublisherBroadcaster
+
+ TBool RefreshPriorizedPublishersL( TInt aContentId, TInt aPriority )
+ {
+ return ETrue;
+ };
+
+ public: // MAiContentObserver
+
+ virtual TInt StartTransaction( TInt aTxId )
+ {
+ };
+ TInt Commit( TInt aTxId )
+ {
+ };
+ TInt CancelTransaction( TInt aTxId )
+ {
+ };
+ TBool CanPublish( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex )
+ {
+ };
+ TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex )
+ {
+ };
+ TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex )
+ {
+ };
+ TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex )
+ {
+ };
+ TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex )
+ {
+ };
+ TInt Clean( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex )
+ {
+ };
+ TAny* Extension( TUid aUid )
+ {
+ };
+
+ private: // New methods
+
+ void SetupL();
+ void SetupEmptyL();
+
+ void Teardown();
+
+ void TestL();
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ // CAiContentPublisher* iPublisher;
+ CHsContentPublisher* iPublisher;
+
+ CContentObserver* iCache;
+
+ CStubDataHolder* iStubDataHolder;
+
+ };
+
+#endif // __UT_DEVSTAPLG_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/ut_devstaplg/UT_DevStaPlg2.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,877 @@
+/*
+* 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:
+*
+*/
+
+
+// CLASS HEADER
+#define private public
+#include "aioperatornamepublisher.h"
+#undef private
+#define protected public
+#include "aibtsappublisher.h"
+#include "aimulticontentobserver.h"
+#include "aicontentobserveroptimizer.h"
+#include "aioperatorlogopublisher.h"
+#define private public
+#include "aiprofilepublisher.h"
+#include "aidatepublisher.h"
+#undef private
+#undef protected
+#include "UT_DevStaPlg2.h"
+#include <hscontentpublisher.h>
+#include "aidevicestatuscontentmodel.h"
+#include "caouserafter.h"
+#include "logotools.h"
+#include "testingtools.h"
+#include "contentobserver.h"
+#include "ainativeuiplugins.h"
+#include <aicontentrequest.h>
+#include "ainwidpriorities.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/ceunitalloctestcasedecorator.h>
+#include <settingsinternalcrkeys.h>
+#include <profile.hrh>
+#include <mprofilechangeobserver.h>
+#include <e32cmn.h>
+#include <gulicon.h>
+
+#include "aidevicestatusplugin.h"
+
+// INTERNAL INCLUDES
+
+
+const TInt KCountryCode = 244;
+const TInt KNetworkId = 91;
+
+
+
+
+// CONSTRUCTION
+UT_DevStaPlg2* UT_DevStaPlg2::NewL()
+ {
+ UT_DevStaPlg2* self = UT_DevStaPlg2::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+UT_DevStaPlg2* UT_DevStaPlg2::NewLC()
+ {
+ UT_DevStaPlg2* self = new( ELeave ) UT_DevStaPlg2();
+ CleanupStack::PushL( self );
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+UT_DevStaPlg2::~UT_DevStaPlg2()
+ {
+ }
+
+// Default constructor
+UT_DevStaPlg2::UT_DevStaPlg2()
+ {
+ }
+
+// Second phase construct
+void UT_DevStaPlg2::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+
+void UT_DevStaPlg2::SetupL( )
+ {
+ // __UHEAP_MARK;
+ CStubDataHolder::InstanceL();
+ iCache = this;
+
+ TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DEVSTAPLUGIN };
+
+ _LIT8( KNameSpace, "1" );
+
+ THsPublisherInfo pubInfo( uid, KDeviceStatusPluginName, KNameSpace );
+
+ iPublisher = CHsContentPublisher::NewL( pubInfo );
+
+ RAiSettingsItemArray settings;
+ iPublisher->ConfigureL( settings );
+ iPublisher->SubscribeL( *iCache );
+ iPublisher->Start( CHsContentPublisher::ESystemStartup );
+ /*
+// __UHEAP_MARK;
+ CStubDataHolder::InstanceL();
+ iCache = this;
+
+ TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DEVSTAPLUGIN };
+ iPublisher = CAiContentPublisher::NewL( uid );
+ //User::LeaveIfError( err );
+
+ TAny* temp = NULL;
+ MAiPropertyExtension* extension = NULL;
+ TRAPD( err, temp = iPublisher->Extension( KExtensionUidProperty ) );
+
+ if( temp /*&& err == KErrNone )
+ {
+ TAiPublisherInfo publisher;
+ publisher.iUid = KDeviceStatusPluginUid;
+ publisher.iName.Copy( KDeviceStatusPluginName );
+
+ extension = static_cast<MAiPropertyExtension*>(temp);
+ extension->SetPropertyL( EAiPublisherInfo, (TAny*)&publisher );
+
+ const TAiPublisherInfo* result = NULL;
+
+ TRAPD( err2, result = extension->PublisherInfoL() );
+
+ }
+
+ */
+
+ /*
+ else
+ {
+ EUNIT_PRINT( _L("Publisher extension not found, cannot set logger") );
+ User::Leave( KErrNotFound );
+ }
+*/
+ iPublisher->SubscribeL( *iCache );
+
+ iLogoPublisher = CAiOperatorLogoPublisher::NewL();
+
+ iNamePublisher = CAiOperatorNamePublisher::NewL();
+
+ iMultiObserver = CAiMultiContentObserver::NewL();
+
+ iBTSAP = CAiBTSAPPublisher::NewL();
+
+ iDatePublisher = CAiDatePublisher::NewL();
+ }
+
+void UT_DevStaPlg2::SetupEmptyL()
+ {
+// __UHEAP_MARK;
+ }
+
+
+
+
+void UT_DevStaPlg2::Teardown( )
+ {
+ delete iDatePublisher;
+
+ delete iMultiObserver;
+
+ delete iBTSAP;
+
+ iInternalCache.ResetAndDestroy();
+
+ delete iLogoPublisher;
+
+ delete iNamePublisher;
+
+ if( iPublisher )
+ {
+ iPublisher->Stop( CHsContentPublisher::ESystemShutdown );
+ delete iPublisher;
+ iPublisher = NULL;
+ }
+
+ /*if( iUtils )
+ {
+ delete iUtils;
+ iUtils =NULL;
+ }*/
+
+ if( iCache )
+ {
+ iCache->Reset();
+ iCache = NULL;
+ }
+
+ CStubDataHolder::Release();
+ #if _BullseyeCoverage
+ cov_write();
+ #endif
+ }
+
+void UT_DevStaPlg2::TestOperatorLogoPublisherL()
+ {
+ iLogoPublisher->Subscribe( *this,
+ *iPublisher,
+ *this,
+ *this );
+
+ RFbsSession::Connect();
+
+ // StoreOTALogoL( KCountryCode, KNetworkId );
+
+ //only OTA logo
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iCountryCode.Format( _L("%i"), KCountryCode );
+ nwInfo->iNetworkId.Format( _L("%i"), KNetworkId );
+ nwInfo->iRegistrationStatus = ENWRegisteredOnHomeNetwork;
+
+ nwInfo->iStatus = ENWStatusCurrent;
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+
+ CContentCache* cache = iCache->GetContent( EAiDeviceStatusContentNetworkIdentity );
+
+ /*
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+
+ TPckgBuf<CGulIcon*> logoBuf;
+ logoBuf.Copy( *cache->iData );
+
+ EUNIT_ASSERT( logoBuf()->Bitmap() );
+ EUNIT_ASSERT( logoBuf()->Mask() );
+ */
+
+ nwInfo->iRegistrationStatus = ENWNotRegisteredNoService;
+ nwInfo->iStatus = ENWStatusCurrent;
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ //TODO Assert
+
+ nwInfo->iRegistrationStatus = ENWRegistrationUnknown ;
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ //TODO Assert
+
+ RFbsSession::Disconnect();
+ }
+
+void UT_DevStaPlg2::TestOperatorProgNamePublisherL()
+ {
+#if defined(WINSCW) || defined(__WINS__)
+ _LIT( KOperatorName, "Operator" );
+#else
+ _LIT( KOperatorName, "ProgName" );
+#endif
+
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameNitzFull;
+ nwInfo->iOperatorNameInfo.iName.Copy( KOperatorName );
+ nwInfo->iRegistrationStatus = ENWRegisteredOnHomeNetwork;
+ nwInfo->iServiceProviderNameDisplayReq |= ENWDisplayPLMNRequired;
+ nwInfo->iServiceProviderNameDisplayReq |= ENWDisplaySPNRequired;
+ nwInfo->iStatus = ENWStatusCurrent;
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ /*
+ CContentCache* cache = iCache->GetLastContent( EAiDeviceStatusContentNetworkIdentity );
+
+ if( !cache )
+ {
+ User::Leave( KErrNoMemory );
+ }
+ */
+
+ // EUNIT_ASSERT( *cache->iText == KOperatorName );
+
+ CAOUserAfter::AfterLD( 100000 );
+
+ nwInfo->iNPName.Copy( _L("NpName") );
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ CAOUserAfter::AfterLD( 100000 );
+
+ nwInfo->iNPName.Copy( _L("") );
+ nwInfo->iSPName.Copy( _L("OpName") );
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ CAOUserAfter::AfterLD( 100000 );
+
+ nwInfo->iRegistrationStatus = ENWRegisteredRoaming;
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ CAOUserAfter::AfterLD( 100000 );
+
+ nwInfo->iServiceProviderNameDisplayReq &= !ENWDisplayPLMNRequired;
+ nwInfo->iRegistrationStatus = ENWRegisteredOnHomeNetwork;
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+ CAOUserAfter::AfterLD( 100000 );
+
+ nwInfo->iOperatorNameInfo.iName.Copy( _L("") );
+
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkRegistrationStatusChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageProgrammableOperatorInfoChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageNetworkProviderNameChange );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameUpdating );
+ CStubDataHolder::Instance()->NWMessageObserver()->HandleNetworkMessage( MNWMessageObserver::ENWMessageServiceProviderNameChange );
+
+
+ //wait for publish
+ CAOUserAfter::AfterLD( 2 * 1000000 );
+
+ TInt prio;
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameFlexiblePlmn;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameNitzFull;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameNitzShort;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameProgrammableUcs2;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameProgrammableLatin;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameHardcodedUcs2;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameHardcodedLatin;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameCountryMcn;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameMccMnc;
+ EUNIT_ASSERT( iNamePublisher->OperatorNamePriority( prio ) );
+
+ nwInfo->iOperatorNameInfo.iType = (RMmCustomAPI::TOperatorNameType)0xdeafdead;
+ EUNIT_ASSERT( !iNamePublisher->OperatorNamePriority( prio ) );
+ }
+
+void UT_DevStaPlg2::TestMultiObserverL()
+ {
+ /*
+ RFs fss;
+ fss.Connect();
+ RFile file;
+ iMultiObserver->AddObserverL( *this );
+ iMultiObserver->AddObserverL( *this );
+ iMultiObserver->Publish( *static_cast<CHsContentPublisher*>(iPublisher->Extension( KExtensionUidProperty )), 0,
+ file, 0 );
+ iMultiObserver->Publish( *static_cast<CHsContentPublisher*>(iPublisher->Extension( KExtensionUidProperty )), 0,
+ _L8("dkorks"), 0 );
+ iMultiObserver->Extension( TUid::Uid( 0 ) );
+ iMultiObserver->CanPublish( *static_cast<CHsContentPublisher*>(iPublisher->Extension( KExtensionUidProperty )),
+ 0, 0 );
+ fss.Close();
+ EUNIT_ASSERT( iBufPublished )
+ EUNIT_ASSERT( iFilePublished )
+ */
+ }
+
+void UT_DevStaPlg2::TestBTSAPPublisherL()
+ {
+ /*
+ iBTSAP->Subscribe( *this,
+ *static_cast<CHsContentPublisher*>(iPublisher->Extension( KExtensionUidProperty )),
+ *this,
+ *this );
+ iBTSAP->RefreshL( 0, ETrue );
+ iBTSAP->RefreshL( EAiDeviceStatusContentNetworkIdentity, EFalse );
+ iBTSAP->RefreshL( EAiDeviceStatusContentNetworkIdentity, ETrue );
+ iBTSAP->RefreshL( 0, EFalse );
+ iBTSAP->RefreshL( ETrue );
+ iBTSAP->RefreshL( EFalse );
+ iBTSAP->RefreshContentWithPriorityL( EAiDeviceStatusContentNetworkIdentity,
+ EAiBTSAP );
+ iBTSAP->RefreshContentWithPriorityL( 0,
+ EAiBTSAP );
+ iBTSAP->RefreshContentWithPriorityL( EAiDeviceStatusContentNetworkIdentity,
+ 0 );
+ */
+ }
+
+/*
+void UT_DevStaPlg2::TestProfilePublisherL()
+ {
+
+ iProfilePublisher = CAiProfilePublisher::NewL();
+
+ CStubDataHolder::Instance()->SetCurrentProfileL(_L("General"),EProfileGeneralId);
+ iProfilePublisher->Subscribe( *this,
+ *static_cast<CHsContentPublisher*>(iPublisher->Extension( KExtensionUidProperty )),
+ *this,
+ *this );
+ iProfilePublisher->RefreshL( ETrue );
+ iProfilePublisher->RefreshL( EFalse );
+
+ iProfilePublisher->RefreshProfileL( ETrue );
+ iProfilePublisher->RefreshProfileL( EFalse );
+
+ iProfilePublisher->RefreshL( EAiDeviceStatusContentProfileName, ETrue );
+ iProfilePublisher->RefreshL( EAiDeviceStatusContentGeneralProfileName, EFalse );
+ iProfilePublisher->RefreshL( EAiDeviceStatusContentNetworkIdentity, ETrue );
+
+ iProfilePublisher->RefreshContentWithPriorityL( EAiDeviceStatusContentNetworkIdentity,
+ EAiOfflineProfile );
+ iProfilePublisher->RefreshContentWithPriorityL( 0,
+ EAiOfflineProfile );
+ iProfilePublisher->RefreshContentWithPriorityL( EAiDeviceStatusContentNetworkIdentity,
+ 0 );
+ delete iProfilePublisher;
+
+ }
+ */
+
+void UT_DevStaPlg2::TestDatePublisherL()
+ {
+ /*
+ iDatePublisher->Subscribe( *this,
+ *static_cast<CHsContentPublisher*>(iPublisher->Extension( KExtensionUidProperty )),
+ *this,
+ *this );
+ HBufC* string;
+ string = iDatePublisher->GetDayNameStringLC( EMonday, *CCoeEnv::Static() );
+ EUNIT_ASSERT( string )
+ CleanupStack::PopAndDestroy( string );
+ string = iDatePublisher->GetDayNameStringLC( ETuesday, *CCoeEnv::Static() );
+ EUNIT_ASSERT( string )
+ CleanupStack::PopAndDestroy( string );
+ string = iDatePublisher->GetDayNameStringLC( EWednesday, *CCoeEnv::Static() );
+ EUNIT_ASSERT( string )
+ CleanupStack::PopAndDestroy( string );
+ string = iDatePublisher->GetDayNameStringLC( EThursday, *CCoeEnv::Static() );
+ EUNIT_ASSERT( string )
+ CleanupStack::PopAndDestroy( string );
+ string = iDatePublisher->GetDayNameStringLC( EFriday, *CCoeEnv::Static() );
+ EUNIT_ASSERT( string )
+ CleanupStack::PopAndDestroy( string );
+ string = iDatePublisher->GetDayNameStringLC( ESaturday, *CCoeEnv::Static() );
+ EUNIT_ASSERT( string )
+ CleanupStack::PopAndDestroy( string );
+ string = iDatePublisher->GetDayNameStringLC( ESunday, *CCoeEnv::Static() );
+ EUNIT_ASSERT( string )
+ CleanupStack::PopAndDestroy( string );
+ */
+ }
+
+void UT_DevStaPlg2::TestPluginL()
+ {
+ iLogoPublisher->Subscribe( *this,
+ *iPublisher,
+ *this,
+ *this );
+ iDatePublisher->Subscribe( *this,
+ *iPublisher,
+ *this,
+ *this );
+ iNamePublisher->Subscribe( *this,
+ *iPublisher,
+ *this,
+ *this );
+
+ iPublisher->SubscribeL( *this );
+ iPublisher->Resume( CHsContentPublisher::EForeground );
+
+ EUNIT_ASSERT( !iPublisher->Extension( TUid::Uid(0xdeafd0de) ) );
+ // EUNIT_ASSERT( iPublisher->Extension( KExtensionUidProperty ) );
+
+ EUNIT_ASSERT( iPublisher->GetProperty( CHsContentPublisher::EPublisherResources ) );
+
+ iPublisher->SetProperty( CHsContentPublisher::EPublisherResources, NULL );
+ iLogoPublisher->RefreshL( 0xdee, ETrue );
+ iLogoPublisher->RefreshL( 0xdee, EFalse );
+ iLogoPublisher->RefreshL( EAiDeviceStatusContentNetworkIdentity, EFalse );
+ iLogoPublisher->RefreshL( EAiDeviceStatusContentNetworkIdentity, ETrue );
+ iLogoPublisher->HandleNotifyInt( 0xd00, 6 );
+ iLogoPublisher->HandleNotifyInt( 0, 6 );
+ iLogoPublisher->HandleNotifyInt( KSettingsDisplayOperatorLogo, 6 );
+
+ _LIT( KOperatorName, "ProgName" );
+
+ TNWInfo* nwInfo = CStubDataHolder::Instance()->NWInfo();
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameNitzFull;
+ nwInfo->iOperatorNameInfo.iName.Copy( KOperatorName );
+ nwInfo->iRegistrationStatus = ENWRegisteredOnHomeNetwork;
+ nwInfo->iServiceProviderNameDisplayReq |= ENWDisplayPLMNRequired;
+ nwInfo->iServiceProviderNameDisplayReq |= ENWDisplaySPNRequired;
+ nwInfo->iStatus = ENWStatusCurrent;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iNPName.Copy(_L("NPN"));
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameFlexiblePlmn;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameNitzFull;
+ nwInfo->iRegistrationStatus = ENWRegisteredRoaming;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iNPName.Copy(_L(""));
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameFlexiblePlmn;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameMccMnc;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameCountryMcn;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameProgrammableUcs2;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameProgrammableLatin;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameHardcodedUcs2;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameHardcodedLatin;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+ nwInfo->iOperatorNameInfo.iType = RMmCustomAPI::EOperatorNameMccMnc;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+ nwInfo->iOperatorNameInfo.iType = (RMmCustomAPI::TOperatorNameType)0xdeafdead;
+ iNamePublisher->ShowNetworkIdentityNameL( ETrue );
+ }
+
+#include "contentobserver.h"
+
+
+void UT_DevStaPlg2::Reset()
+ {
+ iInternalCache.ResetAndDestroy();
+ }
+
+
+CContentCache* UT_DevStaPlg2::GetContent( TInt aContentId, TBool aClean )
+ {
+ const TInt count( iInternalCache.Count() );
+ for( TInt i( 0 ); i < count; i++ )
+ {
+ if( iInternalCache[i]->iId == aContentId )
+ {
+ if( !aClean && iInternalCache[i]->iClean)
+ {
+ continue;
+ }
+ return iInternalCache[i];
+ }
+ }
+
+ return NULL;
+ }
+
+
+CContentCache* UT_DevStaPlg2::GetLastContent( TInt aContentId, TBool aClean )
+ {
+ const TInt count( iInternalCache.Count() );
+ for( TInt i( count - 1 ); i >= 0; i-- )
+ {
+ if( iInternalCache[i]->iId != aContentId )
+ {
+ return NULL;
+ }
+ if( !aClean && iInternalCache[i]->iClean)
+ {
+ continue;
+ }
+ return iInternalCache[i];
+ }
+ return NULL;
+ }
+
+
+TInt UT_DevStaPlg2::StartTransaction(TInt /*aTxId*/)
+ {
+ return 0;
+ }
+
+
+TInt UT_DevStaPlg2::Commit(TInt /*aTxId*/)
+ {
+ return 0;
+ }
+
+
+TInt UT_DevStaPlg2::CancelTransaction(TInt /*aTxId*/)
+ {
+ return 0;
+ }
+
+
+TBool UT_DevStaPlg2::CanPublish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aIndex*/ )
+ {
+ return EFalse;
+ }
+
+ void UT_DevStaPlg2::TryToPublishL( MAiPublisherBroadcaster& /*aBroadcaster*/,
+ TInt aContent,
+ TInt aResource,
+ TInt aPriority )
+ {
+ Publish( *((CHsContentPublisher*)(0x0)),
+ aContent,
+ aResource,
+ aPriority );
+ }
+ void UT_DevStaPlg2::TryToPublishL( MAiPublisherBroadcaster& /*aBroadcaster*/,
+ TInt aContent,
+ const TDesC16& aText,
+ TInt aPriority )
+ {
+ Publish( *((CHsContentPublisher*)(0x0)),
+ aContent,
+ aText,
+ aPriority );
+ }
+ void UT_DevStaPlg2::TryToPublishL( MAiPublisherBroadcaster& /*aBroadcaster*/,
+ TInt aContent,
+ const TDesC8& aBuf,
+ TInt aPriority )
+ {
+ Publish( *((CHsContentPublisher*)(0x0)),
+ aContent,
+ aBuf,
+ aPriority );
+ }
+ void UT_DevStaPlg2::TryToCleanL( MAiPublisherBroadcaster& /*aBroadcaster*/,
+ TInt aContent,
+ TInt aPriority )
+ {
+ Clean( *((CHsContentPublisher*)(0x0)),
+ aContent,
+ aPriority );
+ }
+
+TInt UT_DevStaPlg2::Publish(CHsContentPublisher& /*aPlugin*/, TInt aContent, TInt aResource, TInt aIndex )
+ {
+ RDebug::Print( _L("Publish(%d, %d, %d)"), aContent, aResource, aIndex );
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iResource = aResource;
+ cache->iIndex = aIndex;
+ User::LeaveIfError( iInternalCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+TInt UT_DevStaPlg2::Publish(CHsContentPublisher& /*aPlugin*/, TInt aContent, const TDesC16& aText, TInt aIndex )
+ {
+ RDebug::Print( _L("Publish(%d, \"%S\", %d)"), aContent, &aText, aIndex );
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iText = aText.AllocL();
+ cache->iIndex = aIndex;
+ User::LeaveIfError( iInternalCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+
+TInt UT_DevStaPlg2::Publish(CHsContentPublisher& /*aPlugin*/, TInt aContent, const TDesC8& aBuf, TInt aIndex )
+ {
+ iBufPublished = ETrue;
+ RDebug::Print( _L("Publish(%d, Buf.Len=%d, %d)"), aContent, aBuf.Length(), aIndex );
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iData = aBuf.AllocL();
+ cache->iIndex = aIndex;
+ User::LeaveIfError( iInternalCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+
+TInt UT_DevStaPlg2::Publish(CHsContentPublisher& /*aPlugin*/, TInt aContent, RFile& /*aFile*/, TInt aIndex )
+ {
+ iFilePublished = ETrue;
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iIndex = aIndex;
+ User::LeaveIfError( iInternalCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+
+TInt UT_DevStaPlg2::Clean(CHsContentPublisher& /*aPlugin*/, TInt aContent, TInt aIndex)
+ {
+ RDebug::Print( _L("Clean(%d, %d)"), aContent, aIndex );
+ CContentCache* cache = new( ELeave )CContentCache;
+ CleanupStack::PushL( cache );
+ cache->iId = aContent;
+ cache->iIndex = aIndex;
+ cache->iClean = ETrue;
+ User::LeaveIfError( iInternalCache.Append( cache ) );
+ CleanupStack::Pop( cache );
+ return 0;
+ }
+
+// ---------------------------------------------------------------------------
+// SetProperty
+// ---------------------------------------------------------------------------
+//
+TInt UT_DevStaPlg2::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/ )
+{
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+// SetProperty
+// ---------------------------------------------------------------------------
+//
+TInt UT_DevStaPlg2::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/,
+ MAiContentObserver::TValueType /*aValueType*/ )
+{
+ return KErrNone;
+}
+
+
+TAny* UT_DevStaPlg2::Extension(TUid /*aUid*/)
+ {
+ return NULL;
+ }
+
+TBool UT_DevStaPlg2::RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const
+ {
+ return EFalse;
+ }
+
+
+// END OF FILE
+
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ UT_DevStaPlg2,
+ "Device Status Plugin test cases",
+ "MODULE" )
+
+EUNIT_TEST(
+ "Test op logo publish",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestOperatorLogoPublisherL, Teardown)
+
+EUNIT_TEST(
+ "Test op name publish",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestOperatorProgNamePublisherL, Teardown)
+
+EUNIT_TEST(
+ "Test multiobserver",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestMultiObserverL, Teardown)
+
+EUNIT_TEST(
+ "Test BTSAP",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestBTSAPPublisherL, Teardown)
+
+EUNIT_TEST(
+ "Test date publisher",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestDatePublisherL, Teardown)
+
+EUNIT_TEST(
+ "Test date plugin",
+ "Add tested class name here",
+ "Add tested function name here",
+ "FUNCTIONALITY",
+ SetupL, TestPluginL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/ut_devstaplg/UT_DevStaPlg2.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,194 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef __UT_DEVSTAPLG_H__
+#define __UT_DEVSTAPLG_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <hscontentpublisher.h>
+
+// INTERNAL INCLUDES
+#include "aicontentobserver.h"
+#include "stubdataholder.h"
+#include "ccontentcache.h"
+#include "aiprioritizer.h"
+#include "aipublisherbroadcaster.h"
+#include "ccontentcache.h"
+
+// FORWARD DECLARATIONS
+class CAiContentPublisher;
+class CContentObserver;
+class CStubDataHolder;
+class CAiOperatorLogoPublisher;
+class CAiOperatorNamePublisher;
+class CAiMultiContentObserver;
+class CAiBTSAPPublisher;
+class CAiProfilePublisher;
+class CAiDatePublisher;
+
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+ #define NONSHARABLE_CLASS(x) class x
+#endif
+
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( UT_DevStaPlg2 )
+ : public CEUnitTestSuiteClass,
+ public MAiPublishPrioritizer,
+ public MAiPublisherBroadcaster,
+ public MAiContentObserver
+
+ {
+ public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_DevStaPlg2* NewL();
+ static UT_DevStaPlg2* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_DevStaPlg2();
+
+ private: // Constructors and destructors
+
+ UT_DevStaPlg2();
+ void ConstructL();
+
+ public: // MAiPublishPrioritizer
+
+ void TryToPublishL( MAiPublisherBroadcaster& aBroadcaster,
+ TInt aContent,
+ TInt aResource,
+ TInt aPriority );
+ void TryToPublishL( MAiPublisherBroadcaster& aBroadcaster,
+ TInt aContent,
+ const TDesC16& aText,
+ TInt aPriority );
+ void TryToPublishL( MAiPublisherBroadcaster& aBroadcaster,
+ TInt aContent,
+ const TDesC8& aBuf,
+ TInt aPriority );
+ void TryToCleanL( MAiPublisherBroadcaster& aBroadcaster,
+ TInt aContent,
+ TInt aPriority );
+
+
+ TInt NextPriority() const
+ {
+ return 0;
+ };
+
+ public: // MAiPublisherBroadcaster
+
+ TBool RefreshPriorizedPublishersL( TInt , TInt )
+ {
+ return ETrue;
+ };
+
+ public: // MAiContentObserver
+ void Reset();
+ CContentCache* GetContent( TInt aContentId, TBool aClean = EFalse );
+ CContentCache* GetLastContent( TInt aContentId, TBool aClean = EFalse );
+
+ TInt StartTransaction(TInt aTxId);
+ TInt Commit(TInt aTxId);
+ TInt CancelTransaction(TInt aTxId);
+ TBool CanPublish(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex );
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex );
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex );
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex );
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex );
+ TInt Clean(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex);
+ TAny* Extension(TUid aUid);
+ TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const;
+
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue );
+
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue,
+ MAiContentObserver::TValueType aValueType);
+
+ private: // New methods
+
+ void SetupL();
+ void SetupEmptyL();
+
+ void Teardown();
+
+ void TestOperatorLogoPublisherL();
+
+ void TestOperatorProgNamePublisherL();
+
+ void TestMultiObserverL();
+
+ void TestBTSAPPublisherL();
+
+ // void TestProfilePublisherL();
+
+ void TestDatePublisherL();
+
+ void TestPluginL();
+
+ private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ CHsContentPublisher* iPublisher;
+
+ UT_DevStaPlg2* iCache;
+
+ CStubDataHolder* iStubDataHolder;
+
+ CAiOperatorLogoPublisher* iLogoPublisher;
+
+ CAiOperatorNamePublisher* iNamePublisher;
+
+ CAiMultiContentObserver* iMultiObserver;
+
+ CAiBTSAPPublisher* iBTSAP;
+
+ CAiProfilePublisher* iProfilePublisher;
+
+ CAiDatePublisher* iDatePublisher;
+
+ RPointerArray<CContentCache> iInternalCache;
+
+ TBool iFilePublished;
+
+ TBool iBufPublished;
+
+ };
+
+#endif // __UT_DEVSTAPLG_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/ut_devstaplg/UT_DevStaPlg2DllMain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "UT_DevStaPlg2.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_DevStaPlg2::NewL();
+ }
+
+
+
+// END OF FILE
+
+
+
+
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/devicestatusplugin/ut_devstaplg/UT_DevStaPlgDllMain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,41 @@
+/*
+* 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "UT_DevStaPlg.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_DevStaPlg::NewL();
+ }
+
+
+
+// END OF FILE
+
+
+
+
+
+
--- a/idlefw/tsrc/framework/ut_aifw/coverage/bld.inf Thu Jul 15 18:59:18 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-/*
-* Copyright (c) 2010 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: Inf for coverage testing
-*
-*/
-
-
-#include <platform_paths.hrh>
-
-PRJ_PLATFORMS
-DEFAULT
-
-PRJ_EXPORTS
-
-PRJ_MMPFILES
-
-PRJ_TESTMMPFILES
-
-PRJ_TESTEXPORTS
-#include "../group/bld.inf"
\ No newline at end of file
--- a/idlefw/tsrc/framework/ut_aifw/coverage/generate_armv5.cmd Thu Jul 15 18:59:18 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-@rem
-@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This component and the accompanying materials are made available
-@rem under the terms of "Eclipse Public License v1.0"
-@rem which accompanies this distribution, and is available
-@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem
-@rem Description:
-@rem
-@rem
-
-
-
-@ECHO OFF
-
-ECHO ********** Build coverage report **********
-
-call "C:\Apps\ctc\Sym_armv5\ctcrecvr.exe" -i ctcdata.txt
-call ctcpost -p profile.txt
-call ctc2html -i profile.txt
--- a/idlefw/tsrc/framework/ut_aifw/coverage/generate_winscw.cmd Thu Jul 15 18:59:18 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-@rem
-@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This component and the accompanying materials are made available
-@rem under the terms of "Eclipse Public License v1.0"
-@rem which accompanies this distribution, and is available
-@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem
-@rem Description:
-@rem
-@rem
-
-
-@ECHO OFF
-
-ECHO ********** Build coverage report **********
-
-call ctcpost -p profile.txt
-call ctc2html -i profile.txt
--- a/idlefw/tsrc/framework/ut_aifw/coverage/instrument_armv5_decision.cmd Thu Jul 15 18:59:18 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-@rem
-@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This component and the accompanying materials are made available
-@rem under the terms of "Eclipse Public License v1.0"
-@rem which accompanies this distribution, and is available
-@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem
-@rem Description:
-@rem
-@rem
-
-
-
-@ECHO OFF
-setlocal
-
-ECHO ********** Clean the environment **********
-
-call sbs -c armv5_urel reallyclean -k
-call del profile.txt
-call del mon.sym
-call del mon.dat
-
-ECHO ********** Build module tests and Instrument test subjects **********
-
-call ctcwrap -i d -2comp sbs -c armv5_urel
-
-ECHO Generate image now. When you're done, copy ctcdata.txt into this directory
-ECHO and call generate.cmd
\ No newline at end of file
--- a/idlefw/tsrc/framework/ut_aifw/coverage/instrument_armv5_function.cmd Thu Jul 15 18:59:18 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,36 +0,0 @@
-@rem
-@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This component and the accompanying materials are made available
-@rem under the terms of "Eclipse Public License v1.0"
-@rem which accompanies this distribution, and is available
-@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem
-@rem Description:
-@rem
-@rem
-
-
-
-@ECHO OFF
-setlocal
-
-ECHO ********** Clean the environment **********
-
-call sbs -c armv5_urel reallyclean -k
-call del profile.txt
-call del mon.sym
-call del mon.dat
-
-ECHO ********** Build module tests and Instrument test subjects **********
-
-call ctcwrap -i f -2comp sbs -c armv5_urel
-
-ECHO Generate image now. When you're done, copy ctcdata.txt into this directory
-ECHO and call generate.cmd
--- a/idlefw/tsrc/framework/ut_aifw/coverage/instrument_winscw_decision.cmd Thu Jul 15 18:59:18 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,35 +0,0 @@
-@rem
-@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This component and the accompanying materials are made available
-@rem under the terms of "Eclipse Public License v1.0"
-@rem which accompanies this distribution, and is available
-@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem
-@rem Description:
-@rem
-@rem
-
-
-@ECHO OFF
-setlocal
-
-ECHO ********** Clean the environment **********
-
-call sbs -c winscw_udeb reallyclean -k
-call del profile.txt
-call del mon.sym
-call del mon.dat
-
-ECHO ********** Build module tests and Instrument test subjects **********
-
-call ctcwrap -i d -2comp sbs -c winscw_udeb
-
-ECHO Start the emulator and run your tests now. Call "generate.cmd" when you're done.
-ECHO NOTE! Close the emulator before calling generate.cmd
--- a/idlefw/tsrc/framework/ut_aifw/coverage/instrument_winscw_function.cmd Thu Jul 15 18:59:18 2010 +0300
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,37 +0,0 @@
-@rem
-@rem Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-@rem All rights reserved.
-@rem This component and the accompanying materials are made available
-@rem under the terms of "Eclipse Public License v1.0"
-@rem which accompanies this distribution, and is available
-@rem at the URL "http://www.eclipse.org/legal/epl-v10.html".
-@rem
-@rem Initial Contributors:
-@rem Nokia Corporation - initial contribution.
-@rem
-@rem Contributors:
-@rem
-@rem
-@rem Description:
-@rem
-@rem
-
-
-
-@ECHO OFF
-setlocal
-
-ECHO ********** Clean the environment **********
-
-call sbs -c winscw_udeb reallyclean -k
-call del profile.txt
-call del mon.sym
-call del mon.dat
-
-ECHO ********** Build module tests and Instrument test subjects **********
-
-call ctcwrap -i f -2comp sbs -c winscw_udeb
-
-ECHO Start the emulator and run your tests now. Call "generate.cmd" when you're done.
-ECHO NOTE! Close the emulator before calling generate.cmd
-
--- a/idlefw/tsrc/group/bld.inf Thu Jul 15 18:59:18 2010 +0300
+++ b/idlefw/tsrc/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -23,3 +23,24 @@
// AI Framework
#include "../framework/group/bld.inf"
+
+//Device status plugin
+#include "../devicestatusplugin/group/bld.inf"
+
+// Window Server plug-in
+#include "../wsplugin/group/bld.inf"
+
+// Profile plug-in
+#include "../profileplugin/group/bld.inf"
+
+// MCSPlugin
+#include "../mcsplugin/group/bld.inf"
+
+// AI Utilities API
+#include "../ai_utilities_api/group/bld.inf"
+
+// Sapidataplugin
+#include "../sapidataplugin/group/bld.inf"
+
+// WRT data plug-in
+#include "../wrtdataplugin/group/bld.inf"
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/bwins/MT_mcspluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/bwins/UT_mcssettingsu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/bwins/ut_mcspluginhandleru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/bwins/ut_mcspluginpublisheru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/eabi/MT_mcspluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _ZTI8Observer @ 2 NONAME
+ _ZTV8Observer @ 3 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/eabi/UT_mcssettingsu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,18 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _Z24ImplementationGroupProxyRi @ 2 NONAME
+ _ZTI17CMCSPluginWatcher @ 3 NONAME
+ _ZTI18CMCSPluginSettings @ 4 NONAME
+ _ZTI23CMCSPluginSettingsModel @ 5 NONAME
+ _ZTI25CMCSPluginSettingsAppList @ 6 NONAME
+ _ZTI25CMCSPluginSettingsBkmList @ 7 NONAME
+ _ZTI27CMCSPluginSettingsContainer @ 8 NONAME
+ _ZTIN25CMCSPluginSettingsBkmList12CBkmListItemE @ 9 NONAME
+ _ZTV17CMCSPluginWatcher @ 10 NONAME
+ _ZTV18CMCSPluginSettings @ 11 NONAME
+ _ZTV23CMCSPluginSettingsModel @ 12 NONAME
+ _ZTV25CMCSPluginSettingsAppList @ 13 NONAME
+ _ZTV25CMCSPluginSettingsBkmList @ 14 NONAME
+ _ZTV27CMCSPluginSettingsContainer @ 15 NONAME
+ _ZTVN25CMCSPluginSettingsBkmList12CBkmListItemE @ 16 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/eabi/ut_mcspluginhandleru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _Z24ImplementationGroupProxyRi @ 2 NONAME
+ _ZTI17CMCSPluginWatcher @ 3 NONAME
+ _ZTV17CMCSPluginWatcher @ 4 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/eabi/ut_mcspluginpublisheru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _Z24ImplementationGroupProxyRi @ 2 NONAME
+ _ZTI17CMCSPluginWatcher @ 3 NONAME
+ _ZTV17CMCSPluginWatcher @ 4 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,34 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+mt_mcsplugin.mmp
+ut_mcssettings.mmp
+ut_mcspluginhandler.mmp
+ut_mcspluginpublisher.mmp
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/group/mt_mcsplugin.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2009 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET mt_mcsplugin.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700afa
+
+CAPABILITY EUNIT_CAPS
+
+SOURCEPATH ../MT_mcsplugin
+SOURCE MT_mcspluginDllMain.cpp
+SOURCE MT_mcsplugin.cpp
+SOURCE observer.cpp
+
+USERINCLUDE ../mt_mcsplugin
+USERINCLUDE ../../../inc/common
+
+SYSTEMINCLUDE ../../../plugins/mcsplugin/commoninc
+SYSTEMINCLUDE ../../../plugins/mcsplugin/publisher/inc
+SYSTEMINCLUDE ../../../plugins/mcsplugin/data
+SYSTEMINCLUDE ../../../inc/utility
+SYSTEMINCLUDE /epoc32/include/internal // for gsprivatepluginproviderids.h
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY eikdlg.lib
+LIBRARY aiutils.lib
+LIBRARY EUnit.lib
+LIBRARY EUnitUtil.lib
+LIBRARY euser.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib
+LIBRARY avkon.lib
+LIBRARY commonengine.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY ecom.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikctl.lib
+LIBRARY bafl.lib
+LIBRARY apgrfx.lib
+LIBRARY egul.lib
+LIBRARY fbscli.lib
+LIBRARY aknskins.lib
+LIBRARY aknicon.lib
+LIBRARY centralrepository.lib
+LIBRARY msgs.lib
+LIBRARY ws32.lib
+LIBRARY GSEcomPlugin.lib
+LIBRARY cenrepnotifhandler.lib // CCenRepNotifyHandler
+LIBRARY gsframework.lib // For base classes
+LIBRARY gslistbox.lib // For CGSListBoxItemTextArray
+LIBRARY inetprotutil.lib // For TUriParser
+LIBRARY platformenv.lib // For PathInfo
+LIBRARY hlplch.lib // for HlpLauncher
+LIBRARY featmgr.lib // For feature manager
+LIBRARY hspluginsettings.lib
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/group/t_mcsplugin.pkg Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,39 @@
+;
+; Copyright (c) 2009 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:
+;
+
+; Supported languages
+&en
+
+; Package header (one name for each supported language)
+#{"T_MCSPlugin"},(0x01700000),0,1,0
+
+%{"Nokia"}
+:"Nokia"
+
+; Package signature
+
+; Options line not supported currently
+
+; Conditions blocks not supported currently
+
+; Language independent files that are always installed
+"\epoc32\release\armv5\urel\mt_mcsplugin.dll"-"!:\sys\bin\mt_mcsplugin.dll"
+"\epoc32\release\armv5\urel\ut_mcssettings.dll"-"!:\sys\bin\ut_mcssettings.dll"
+
+; Language dependent files
+
+; Requisites (of type: (UID),Major,Minor,Build-Number,{"Requisite Name1", "Requisite Name2"})
+; (0x101F6F88), 0, 0, 0, {"Series60ProductID"}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/group/ut_mcspluginhandler.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,79 @@
+/*
+* Copyright (c) 2010 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET ut_mcspluginhandler.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700aff
+
+CAPABILITY EUNIT_CAPS
+//VENDORID 0x00000000
+
+EPOCALLOWDLLDATA
+
+SOURCEPATH ../ut_mcsplugin
+SOURCE ut_mcspluginhandlerdllmain.cpp
+SOURCE ut_mcspluginhandler.cpp
+
+// Sources needed by the test
+SOURCEPATH ../../../plugins/mcsplugin/handler/src
+SOURCE mcspluginhandler.cpp
+SOURCE mcsplugincompletedoperation.cpp
+SOURCEPATH ../../../plugins/mcsplugin/commonsrc
+SOURCE mcspluginwatcher.cpp
+
+
+
+USERINCLUDE ../../../plugins/mcsplugin/handler/inc
+USERINCLUDE ../../../plugins/mcsplugin/commoninc
+USERINCLUDE ../../../plugins/mcsplugin/data
+USERINCLUDE ../../../inc/common
+USERINCLUDE ../ut_mcsplugin
+
+SYSTEMINCLUDE /epoc32/include/internal
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY cone.lib
+LIBRARY efsrv.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY centralrepository.lib
+
+LIBRARY msgs.lib // For Message Server
+
+LIBRARY favouritesengine.lib
+LIBRARY EUnit.lib
+LIBRARY CdlEngine.lib
+LIBRARY ws32.lib
+
+LIBRARY mcsmenu.lib
+LIBRARY aiutils.lib
+LIBRARY mcsmenuutils.lib
+LIBRARY sendui.lib
+LIBRARY viewcli.lib
+LIBRARY apparc.lib
+LIBRARY apgrfx.lib
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/group/ut_mcspluginpublisher.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2010 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+
+TARGET ut_mcspluginpublisher.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700b03
+
+CAPABILITY EUNIT_CAPS
+//VENDORID 0x00000000
+
+SOURCEPATH ../ut_mcsplugin
+SOURCE ut_mcspluginpublisherdllmain.cpp
+SOURCE ut_mcspluginpublisher.cpp
+
+// Sources needed by the test
+SOURCEPATH ../../../plugins/mcsplugin/publisher/src
+SOURCE mcsplugin.cpp
+SOURCE mcspluginengine.cpp
+SOURCE mcsplugindata.cpp
+SOURCEPATH ../../../plugins/mcsplugin/commonsrc
+SOURCE mcspluginwatcher.cpp
+
+
+
+USERINCLUDE ../../../plugins/mcsplugin/publisher/inc
+USERINCLUDE ../../../plugins/mcsplugin/commoninc
+USERINCLUDE ../../../plugins/mcsplugin/data
+USERINCLUDE ../../../inc/common
+USERINCLUDE ../ut_mcsplugin
+
+SYSTEMINCLUDE /epoc32/include/internal
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY cone.lib
+LIBRARY efsrv.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY centralrepository.lib
+
+LIBRARY msgs.lib // For Message Server
+
+LIBRARY favouritesengine.lib
+LIBRARY EUnit.lib
+LIBRARY CdlEngine.lib
+LIBRARY ws32.lib
+
+LIBRARY mcsmenu.lib
+LIBRARY aiutils.lib
+LIBRARY mcsmenuutils.lib
+LIBRARY sendui.lib
+LIBRARY viewcli.lib
+LIBRARY apparc.lib
+LIBRARY apgrfx.lib
+LIBRARY hspluginsettings.lib
+LIBRARY commonengine.lib
+LIBRARY gslauncher.lib
+LIBRARY aknicon.lib
+LIBRARY gfxtrans.lib
+LIBRARY egul.lib
+LIBRARY mcsextendedmenu.lib
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/group/ut_mcssettings.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,87 @@
+/*
+* Copyright (c) 2009 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET ut_mcssettings.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700afe
+
+CAPABILITY EUNIT_CAPS
+//VENDORID 0x00000000
+
+SOURCEPATH ../UT_mcssettings
+SOURCE UT_mcssettingsDllMain.cpp
+SOURCE UT_mcssettings.cpp
+
+// Sources needed by the test
+SOURCEPATH ../../../plugins/mcsplugin/settings/src
+SOURCE mcspluginsettings.cpp
+SOURCE mcspluginsettingscontainer.cpp
+SOURCE mcspluginsettingsmodel.cpp
+SOURCE mcspluginsettingsapplist.cpp
+SOURCE mcspluginsettingsbkmlist.cpp
+
+SOURCEPATH ../../../plugins/mcsplugin/commonsrc
+SOURCE mcspluginwatcher.cpp
+
+
+
+USERINCLUDE ../../../plugins/mcsplugin/settings/inc
+USERINCLUDE ../../../plugins/mcsplugin/commoninc
+USERINCLUDE ../../../plugins/mcsplugin/data
+USERINCLUDE ../../../inc/common
+USERINCLUDE ../UT_mcssettings
+
+SYSTEMINCLUDE /epoc32/include/internal
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY cone.lib
+LIBRARY efsrv.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY centralrepository.lib
+LIBRARY cenrepnotifhandler.lib // CCenRepNotifyHandler
+LIBRARY gsframework.lib // For base classes
+LIBRARY gslistbox.lib // For CGSListBoxItemTextArray
+LIBRARY gsecomplugin.lib
+LIBRARY commonengine.lib // For RConeResourceLoader
+LIBRARY inetprotutil.lib // For TUriParser
+LIBRARY apgrfx.lib // For RApaLsSession
+LIBRARY apparc.lib // For TApaAppInfo
+LIBRARY msgs.lib // For Message Server
+LIBRARY platformenv.lib // For PathInfo
+LIBRARY hlplch.lib // for HlpLauncher
+LIBRARY featmgr.lib // For feature manager
+LIBRARY favouritesengine.lib
+LIBRARY EUnit.lib
+LIBRARY CdlEngine.lib
+LIBRARY javaregistryclient.lib // For JavaRegistry
+LIBRARY ws32.lib
+
+LIBRARY mcsmenu.lib
+LIBRARY hspluginsettings.lib
+LIBRARY aiutils.lib
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/mt_mcsplugin/caouserafter.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __CAOUSERAFTER_H__
+#define __CAOUSERAFTER_H__
+
+// INCLUDES
+#include <E32base.h>
+#include <E32svr.h>
+#include <CoeMain.h>
+
+
+/**
+ * Active object version of User::After()
+ */
+class CAOUserAfter : public CTimer
+ {
+ private:
+ CActiveSchedulerWait iWait;
+ TInt iLength;
+
+
+ public: //new functions
+
+ /**
+ * Constructs the waiting timer, executes
+ * it and when timer expires, deletes self.
+ * @param aLength The lenghth of wait in micro
+ * seconds.
+ */
+ static void AfterLD( TInt aLenght )
+ {
+ CAOUserAfter* wait= new ( ELeave ) CAOUserAfter( aLenght );
+ CleanupStack::PushL( wait );
+ wait->ConstructL();
+ CleanupStack::Pop();
+
+ RDebug::Print( _L("CAOUserAfter - Starting time consuming...") );
+ wait->StartWaitD();
+ RDebug::Print( _L("CAOUserAfter - completed.") );
+ }
+
+ private:
+ CAOUserAfter( TInt aLenght )
+ : CTimer( CActive::EPriorityStandard ),
+ iLength( aLenght )
+ {
+ }
+
+ void ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add( this );
+ }
+
+ virtual ~CAOUserAfter()
+ {
+ }
+
+ void StartWaitD()
+ {
+ After( iLength );
+ iWait.Start();
+ }
+
+ void RunL()
+ {
+ iWait.AsyncStop();
+ Cancel();
+ delete this;
+ }
+ };
+
+#endif // __CAOUSERAFTER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/mt_mcsplugin/mt_mcsplugin.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,313 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+// CLASS HEADER
+
+#include "MT_mcsplugin.h"
+// EXTERNAL INCLUDES
+
+#include <aiutility.h>
+#include <w32std.h>
+#include <eikenv.h>
+#include <ecom/ecom.h>
+#include <ecom/implementationproxy.h>
+#include <centralrepository.h>
+#include <aicontentobserver.h>
+#include <aipluginsettings.h>
+#include <mcsplugin.h>
+#include <apgtask.h>
+#include <aknenv.h>
+// #include <aicontentpublisher.h>
+#include <ecom/implementationinformation.h>
+
+// #include <aipropertyextension.h>
+// #include <aieventhandlerextension.h>
+#include <centralrepository.h>
+#include <msvids.h>
+#include <senduimtmuids.h>
+
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/ceunitalloctestcasedecorator.h>
+
+#include <hspluginsettings.h>
+
+using namespace HSPluginSettingsIf;
+
+// INTERNAL INCLUDES
+
+#include "observer.h"
+#include "caouserafter.h"
+#include <mcspluginuids.hrh>
+
+_LIT( KEventNameLaunchByIndex, "LaunchByIndex" );
+const TInt KWait_1_secs = 1 * 1000000;
+const TInt KWait_2_secs = 2 * 1000000;
+const TInt KWait_5_secs = 5 * 1000000;
+const TInt KWait_10_secs = 10 * 1000000;
+const TInt KWait_15_secs = 15 * 1000000;
+const TInt KWait_20_secs = 20 * 1000000;
+
+_LIT( KMcsPluginName, "mcsplugin" );
+_LIT8( KNameSpace, "1" );
+
+// CONSTRUCTION
+
+/*EXPORT_C*/ MT_mcsplugin* MT_mcsplugin::NewL()
+{
+ MT_mcsplugin* self = MT_mcsplugin::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+/*EXPORT_C*/ MT_mcsplugin* MT_mcsplugin::NewLC()
+{
+ MT_mcsplugin* self = new(ELeave) MT_mcsplugin();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+// Destructor (virtual by CBase)
+// ---------------------------------------------------------------------------
+//
+MT_mcsplugin::~MT_mcsplugin()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+MT_mcsplugin::MT_mcsplugin()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Second phase construct
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::ConstructL()
+{
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+}
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::HandleSessionEventL(TMsvSessionEvent /*aEvent*/, TAny* /*aArg1*/, TAny* /*aArg2*/, TAny* /*aArg3*/)
+{
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::SetupL()
+{
+ __UHEAP_MARK;
+ _LIT8( KAppUid, "271012080" );
+ CHomescreenSettings::InitializeL( KAppUid );
+
+ iContentObserver = Observer::NewL();
+
+ TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_MCSPLUGIN };
+ THsPublisherInfo pubInfo( uid, KMcsPluginName, KNameSpace );
+
+ EUNIT_ASSERT(iContentObserver);
+
+ iPlugin = CHsContentPublisher::NewL( pubInfo );
+ EUNIT_ASSERT( iPlugin );
+
+ // Array owned by the plugin
+ RAiSettingsItemArray settings;
+ //Content Item
+ MAiPluginSettings* setting = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting );
+ MAiPluginContentItem& item = setting->AiPluginContentItem();
+ item.SetTypeL( _L("image") );
+ item.SetNameL( _L("widget/icon"));
+ settings.AppendL( setting );
+ CleanupStack::Pop( setting );
+
+ MAiPluginSettings* setting1 = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting1 );
+ MAiPluginContentItem& item1 = setting1->AiPluginContentItem();
+ item1.SetTypeL( _L("image") );
+ item1.SetNameL( _L("widget/presenceicon"));
+ settings.AppendL( setting1 );
+ CleanupStack::Pop( setting1 );
+
+ MAiPluginSettings* setting2 = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting2 );
+ MAiPluginContentItem& item2 = setting2->AiPluginContentItem();
+ item2.SetTypeL( _L("text") );
+ item2.SetNameL( _L("widget/longname"));
+ settings.AppendL( setting2 );
+ CleanupStack::Pop( setting2 );
+
+ MAiPluginSettings* setting3 = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting3 );
+ MAiPluginContentItem& item3 = setting3->AiPluginContentItem();
+ item3.SetTypeL( _L("text") );
+ item3.SetNameL( _L("widget/shortname"));
+ settings.AppendL( setting3 );
+ CleanupStack::Pop( setting3 );
+
+ iPlugin->ConfigureL( settings );
+ iPlugin->SubscribeL( *iContentObserver );
+ iPlugin->Start( CHsContentPublisher::ESystemStartup );
+
+ iPlugin->Resume( CHsContentPublisher::EForeground );
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::EmptySetupL()
+{
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::Teardown()
+{
+ delete iPlugin;
+ iPlugin = NULL;
+
+ delete iContentObserver;
+ iContentObserver = NULL;
+
+ CHomescreenSettings::UnInitialize();
+ __UHEAP_MARKEND;
+}
+
+
+// ---------------------------------------------------------------------------
+// Tests Resume, plugin is resumed correctly.
+// If plugin is working correctly it should be able to launch app
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::TestResumeL()
+{
+ // Frees engine, because shortcuts needs to be recreated when theme is changed
+ iPlugin->Resume( CHsContentPublisher::EForeground );
+
+ // Free engine one more time...
+ iPlugin->Stop( CHsContentPublisher::ESystemShutdown );
+
+ // ... to test last decicions.
+ iPlugin->Resume( CHsContentPublisher::EForeground );
+}
+
+// ---------------------------------------------------------------------------
+// Tests Suspend, plugin is suspended.
+// When plugin is suspended it shouldn't launch apps
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::TestSuspendL()
+{
+ TRAPD(err1, iPlugin->Suspend( CHsContentPublisher::EBackground));
+
+// EUNIT_ASSERT_NO_LEAVE(LaunchAppFailsL(0x00000001, KScutCalculatorUid));
+
+ iPlugin->Stop( CHsContentPublisher::ESystemShutdown );
+
+ TRAPD(err2, iPlugin->Suspend( CHsContentPublisher::EBackground));
+}
+
+// ---------------------------------------------------------------------------
+// Tests SubscribeL, adding observer.
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::TestSubscribeL()
+{
+ EUNIT_ASSERT_NO_LEAVE(iPlugin->SubscribeL(*iContentObserver));
+}
+
+// ---------------------------------------------------------------------------
+// Tests GetPropertyL
+// Return values shouldn't be null
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::TestGetPropertyL()
+{
+ TAny* anyPtr = iPlugin->GetProperty( CHsContentPublisher::EPublisherContent );
+ EUNIT_ASSERT( anyPtr );
+
+ MAiContentItemIterator* iter = static_cast<MAiContentItemIterator*>( anyPtr );
+ EUNIT_ASSERT( iter );
+}
+
+// ---------------------------------------------------------------------------
+// Free engine, ensure that plugin won't launch apps.
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::TestFreeEngineL()
+{
+ iPlugin->Stop( CHsContentPublisher::ESystemShutdown );
+
+ iPlugin->Start( CHsContentPublisher::ESystemStartup );
+
+ iPlugin->Resume( CHsContentPublisher::EForeground );
+
+// LaunchAppFailsL(0x00000001, KScutCalculatorUid);
+}
+
+
+
+// ---------------------------------------------------------------------------
+// Send invalid parameters to plugin, no crash should occur
+// ---------------------------------------------------------------------------
+//
+void MT_mcsplugin::TestHandleEventErrorHandling()
+{
+ iPlugin->HandleEvent(_L("invalid"), KNullDesC);
+ iPlugin->HandleEvent(KEventNameLaunchByIndex, KNullDesC);
+ iPlugin->HandleEvent(KEventNameLaunchByIndex, _L("0x"));
+ iPlugin->HandleEvent(KEventNameLaunchByIndex, _L("99999999"));
+ iPlugin->HandleEvent(KEventNameLaunchByIndex, _L("-1"));
+}
+
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(MT_mcsplugin, "MCSPlugin module tests", "MODULE")
+
+EUNIT_TEST("Resume", "MCSPlugin", "Resume", "FUNCTIONALITY", SetupL, TestResumeL, Teardown)
+EUNIT_TEST("Suspend", "MCSPlugin", "Suspend", "FUNCTIONALITY", SetupL, TestSuspendL, Teardown)
+EUNIT_TEST("Subscribe", "MCSPlugin", "SubscribeL", "FUNCTIONALITY", SetupL, TestSubscribeL, Teardown)
+//EUNIT_TEST("Get property", "MCSPlugin", "GetPropertyL", "FUNCTIONALITY", SetupL, TestGetPropertyL, Teardown)
+//EUNIT_TEST("Free engine", "MCSPlugin", "FreeEngineL", "FUNCTIONALITY", SetupL, TestFreeEngineL, Teardown)
+EUNIT_TEST("Test different events", "MCSPlugin", "HandleEvent", "FUNCTIONALITY", SetupL, TestHandleEventErrorHandling, Teardown)
+
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/mt_mcsplugin/mt_mcsplugin.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,149 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __MT_MCSPLUGIN_H__
+#define __MT_MCSPLUGIN_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// #include <aiscutdefs.h>
+#include <hscontentpublisher.h>
+// #include <aipropertyextension.h>
+// #include <aieventhandlerextension.h>
+#include <apgcli.h>
+#include <aknappui.h>
+#include <aiutility.h>
+#include <aknkeylock.h>
+#include <mcsplugin.h>
+
+// INTERNAL INCLUDES
+
+// FORWARD DECLARATIONS
+class MAiPluginSettings;
+class MAiPluginSettingsItem;
+class CRepository;
+class CAiContentPublisher;
+class Observer;
+// class MAiPropertyExtension;
+class CAiCallStatusObserver;
+class CAiFw;
+class CAiSystemStateManager;
+class CAiPluginActivityRegistry;
+class CAiBackupRestoreStatusObserver;
+class CAiSystemStateManager;
+
+typedef RPointerArray<MAiPluginSettings> RAiSettingsItemArray;
+
+#include <e32def.h>
+#include <msvapi.h>
+
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_mcsplugin )
+ : public CEUnitTestSuiteClass,
+ public MMsvSessionObserver //, public CAknAppUi
+{
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ /*IMPORT_C*/ static MT_mcsplugin* NewL();
+
+ /*IMPORT_C*/ static MT_mcsplugin* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~MT_mcsplugin();
+
+private: // Constructors and destructors
+
+ MT_mcsplugin();
+
+ void ConstructL();
+
+public: // From observer interface
+
+private: // New methods
+
+ void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
+
+ /*################# SetupL ####################
+ Called everytime at first
+ to prepare plugin for test
+ #############################################*/
+ void SetupL();
+
+ void EmptySetupL();
+
+ /*############### TeardownL ###################
+ Called everytime to deconstruct the plugin
+ #############################################*/
+ void Teardown();
+
+ /*############### TestResumeL #################
+ Tests ResumeL from caiscutplugin,
+ ResumeL is called in SetupL but in this
+ function plugin is suspended before
+ #############################################*/
+ void TestResumeL();
+
+ /*############## TestSuspendL ################
+ Tests if SuspendL pass
+ #############################################*/
+ void TestSuspendL();
+
+ /*############## TestSubscribeL ###############
+ Tests SubscribeL
+ #############################################*/
+ void TestSubscribeL();
+
+ /*############# TestGetPropertyL ##############
+ Tests getting property information from plugin
+ #############################################*/
+ void TestGetPropertyL();
+
+ void TestFreeEngineL();
+
+ void TestHandleEventErrorHandling();
+
+private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ // CAiContentPublisher* iPlugin;
+ CHsContentPublisher* iPlugin;
+
+ Observer* iContentObserver;
+
+ // MAiEventHandlerExtension* iPluginEventHandler;
+};
+
+#endif // __MT_MCSPLUGIN_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/mt_mcsplugin/mt_mcsplugindllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,54 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "MT_mcsplugin.h"
+
+
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ //There is a suite contraction error if use belong codes
+ CEUnitTestSuite* rootSuite = CEUnitTestSuite::NewLC( _L("Wizard generated") );
+
+ rootSuite->AddL( MT_mcsplugin::NewLC() );
+ CleanupStack::Pop();
+
+
+ CleanupStack::Pop( rootSuite ); // rootSuite
+
+ return rootSuite;
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/mt_mcsplugin/observer.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,256 @@
+/*
+* Copyright (c) 2009 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 <coemain.h>
+#include <f32file.h>
+#include <gulicon.h>
+#include <aicontentmodel.h>
+
+#include "observer.h"
+//#include "caiplugintesterview.h"
+
+
+const char KAiShortcutCaption[] = "ShortcutCaption";
+const char KAiShortcutIcon[] = "ShortcutIcon";
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+Observer::Observer()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void Observer::ConstructL()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+Observer* Observer::NewL()
+{
+ Observer* self = new(ELeave) Observer();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+Observer::~Observer()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that it initiates content publishing transaction
+// ---------------------------------------------------------------------------
+//
+TInt Observer::StartTransaction(TInt aTxId)
+{
+ if (iTransactionId != 0)
+ {
+ //TODO: report error
+ }
+
+ iTransactionId = aTxId;
+ return KErrNone;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to request framework that content publishing is committed
+// ---------------------------------------------------------------------------
+//
+TInt Observer::Commit(TInt aTxId)
+{
+ TRAPD(err, DoCommitL(aTxId));
+ return err;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by plug-in to indicate that content publishing transaction is cancelled
+// ---------------------------------------------------------------------------
+//
+TInt Observer::Rollback(TInt aTxId)
+{
+ if (iTransactionId == 0)
+ {
+ //TODO: report error
+ }
+ else if (iTransactionId != aTxId)
+ {
+ //TODO: report error
+ }
+
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+// Invoked by plug-in to test if content can be published.
+// ---------------------------------------------------------------------------
+//
+TBool Observer::CanPublish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aIndex*/)
+{
+ return ETrue;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be published
+// ---------------------------------------------------------------------------
+//
+TInt Observer::Publish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aResource*/, TInt /*aIndex*/)
+{
+ //TRAPD(err, DoPublishL(aPlugin, aContent, aResource, aIndex));
+ TInt err( KErrNone );
+ return err;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be published
+// ---------------------------------------------------------------------------
+//
+TInt Observer::Publish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, const TDesC16& /*aText*/, TInt /*aIndex*/)
+{
+ //TRAPD(err, DoPublishL(aPlugin, aContent, aText, aIndex));
+ TInt err( KErrNone );
+ return err;
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TInt Observer::Publish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, const TDesC8& aBuf, TInt /*aIndex*/)
+ {
+ CGulIcon* icon = UnpackPtr<CGulIcon>(aBuf);
+ if (icon != NULL)
+ {
+ delete icon;
+ }
+ else
+ {
+ //TODO report error
+ }
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be published
+// ---------------------------------------------------------------------------
+//
+TInt Observer::Publish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, RFile& /*aFile*/, TInt /*aIndex*/)
+{
+ return KErrNotSupported;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be cleaned in UI
+// ---------------------------------------------------------------------------
+//
+TInt Observer::Clean(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aIndex*/)
+{
+ // TODO: clean content.
+ iTransactionId = 0;
+ return 0;
+}
+
+
+// ---------------------------------------------------------------------------
+// Returns interface extension. Not used in Series 60 v3.2 release.
+// ---------------------------------------------------------------------------
+//
+TAny* Observer::Extension(TUid /*aUid*/)
+{
+ return NULL;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool Observer::RequiresSubscription( const THsPublisherInfo& /*aPublisherInfo*/ ) const
+{
+ return EFalse;
+}
+
+
+// ---------------------------------------------------------------------------
+// Leaving version of the commit operation
+// ---------------------------------------------------------------------------
+//
+void Observer::DoCommitL(TInt aTxId)
+{
+ if (iTransactionId == 0)
+ {
+ //TODO: report error
+ }
+ else if (iTransactionId != aTxId)
+ {
+ //TODO: report error
+ }
+
+ iTransactionId = 0;
+}
+
+// ---------------------------------------------------------------------------
+// SetProperty
+// ---------------------------------------------------------------------------
+//
+TInt Observer::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/ )
+{
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+// SetProperty
+// ---------------------------------------------------------------------------
+//
+TInt Observer::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/,
+ MAiContentObserver::TValueType /*aValueType*/ )
+{
+ return KErrNone;
+}
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/mt_mcsplugin/observer.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,279 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef OBSERVER_H
+#define OBSERVER_H
+
+#include <e32base.h>
+#include <aicontentobserver.h>
+#include <hscontentpublisher.h>
+
+//class CAiPluginTesterView;
+class RFile;
+
+/**
+ *
+ */
+class Observer : public CBase, public MAiContentObserver
+{
+
+public:
+
+ static Observer* NewL();
+
+ virtual ~Observer();
+
+ /**
+ * Invoked by the plug-in to inform that it initiates content publishing
+ * transaction.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is started.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * @since S60 v3.2
+ */
+ TInt StartTransaction(TInt aTxId);
+
+ inline TInt CancelTransaction(TInt /*aTxId*/)
+ {
+ return 10000000000;
+ };
+
+ /**
+ * Invoked by the plug-in to request framework that content publishing
+ * transaction must be finalized and content should be rendered to the
+ * screen.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is over.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * KErrNotFound - transaction with matching id has not been
+ * started.
+ * @since S60 v3.2
+ */
+ TInt Commit(TInt aTxId);
+
+ /**
+ * Invoked by plug-in to indicate that content publishing transaction
+ * must be cancelled.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is cancelled.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * KErrNotFound - transaction with matching id has not been
+ * started.
+ * @since S60 v3.2
+ */
+ TInt Rollback(TInt aTxId);
+
+ /**
+ * Invoked by plug-in to test if content can be published.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aIndex - index of the content item.
+ * @return ETrue - if content could be published.
+ * @since S60 3.2
+ */
+ TBool CanPublish(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that content identified by reference
+ * aResource must be published to UI control\element identified by selector
+ * aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aResource - identification of content reference, MUST correspond
+ * single content reference supported by plug-in. The framework
+ * utilizes the reference if to match for cid and MIME type of the
+ * content supplied with in UI definition.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * @since S60 v3.2
+ */
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that textual content provided within
+ * parameter aText must be published to UI control\element identified by
+ * selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aText - Textual content in UNICODE.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that content provided within buffer
+ * aBuf must be published to UI control\element identified by selector
+ * aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aBuf - instance of content.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that content from file handle aFile
+ * must be published to UI control\element identified by selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aFile - file handle from where content can be obtained by UI
+ * framework.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that content must be cleaned in UI
+ * control\element identified by selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * @since S60 v3.2
+ */
+ TInt Clean(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex);
+
+ /**
+ * Returns interface extension. Not used in Series 60 3.1 release.
+ *
+ * @param aUid - UID of the extension interface to access.
+ * @return the extension interface. Actual type depends on the passed aUid
+ * argument.
+ * @since S60 v3.2
+ */
+ TAny* Extension(TUid aUid) ;
+
+ /**
+ *
+ */
+ TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const;
+
+ /**
+ *
+ */
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue );
+
+ /**
+ *
+ */
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue,
+ MAiContentObserver::TValueType aValueType);
+
+protected:
+
+private:
+
+ Observer();
+
+ void ConstructL();
+
+ /**
+ * Leaving version of the commit operation
+ *
+ * @since S60 3.1
+ */
+ void DoCommitL(TInt aTxId);
+
+private: // Data
+
+ /**
+ * Transaction id
+ */
+ TInt iTransactionId;
+
+ /**
+ * Flag indicating if transaction is ongoing
+ */
+ TBool iTransactionOngoing;
+
+ /**
+ * Pointer to tester application view
+ * Not own.
+ */
+// CAiPluginTesterView* iView;
+
+};
+
+#endif // OBSERVER_H
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcsplugin/caouserafter.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __CAOUSERAFTER_H__
+#define __CAOUSERAFTER_H__
+
+// INCLUDES
+#include <E32base.h>
+#include <E32svr.h>
+#include <CoeMain.h>
+
+
+/**
+ * Active object version of User::After()
+ */
+class CAOUserAfter : public CTimer
+ {
+ private:
+ CActiveSchedulerWait iWait;
+ TInt iLength;
+
+
+ public: //new functions
+
+ /**
+ * Constructs the waiting timer, executes
+ * it and when timer expires, deletes self.
+ * @param aLength The lenghth of wait in micro
+ * seconds.
+ */
+ static void AfterLD( TInt aLenght )
+ {
+ CAOUserAfter* wait= new ( ELeave ) CAOUserAfter( aLenght );
+ CleanupStack::PushL( wait );
+ wait->ConstructL();
+ CleanupStack::Pop();
+
+ RDebug::Print( _L("CAOUserAfter - Starting time consuming...") );
+ wait->StartWaitD();
+ RDebug::Print( _L("CAOUserAfter - completed.") );
+ }
+
+ private:
+ CAOUserAfter( TInt aLenght )
+ : CTimer( CActive::EPriorityStandard ),
+ iLength( aLenght )
+ {
+ }
+
+ void ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add( this );
+ }
+
+ virtual ~CAOUserAfter()
+ {
+ }
+
+ void StartWaitD()
+ {
+ After( iLength );
+ iWait.Start();
+ }
+
+ void RunL()
+ {
+ iWait.AsyncStop();
+ Cancel();
+ delete this;
+ }
+ };
+
+#endif // __CAOUSERAFTER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcsplugin/ut_mcspluginhandler.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,343 @@
+/*
+* Copyright (c) 2010 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: unit test for the mcsplugin handler
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_mcspluginhandler.h"
+
+
+// EXTERNAL INCLUDES
+#include <mcsmenu.h>
+#include <mcsmenuitem.h>
+#include <mcsmenufilter.h>
+#include <mcsdef.h>
+#include <digia/eunit/eunitmacros.h>
+#include <e32cmn.h>
+
+// INTERNAL INCLUDES
+#include "mcspluginhandler.h"
+#include "mcsplugincompletedoperation.h"
+#include "mcspluginparamval.h"
+#include "mcspluginwatcher.h"
+#include "caouserafter.h"
+
+
+const TInt KWait_05_secs = 0.5 * 1000000;
+const TInt KWait_1_secs = 1 * 1000000;
+const TInt KWait_2_secs = 2 * 1000000;
+const TInt KWait_3_secs = 3 * 1000000;
+
+TInt32 KMCSCmailMtmUidValue = 0x2001F406;
+
+_LIT( KUrl, "http://www.nokia.com" );
+_LIT( KUrlInvalid, "services://nothingcanbeworse" );
+_LIT( KDialed, "logs:dialed" );
+_LIT( KBookmarkIconFile, "aimcsplugin.mif" );
+_LIT( KBookmarkIconId, "16386" );
+_LIT( KBookmarkIconMaskId, "16387" );
+
+_LIT( KMyMenuData, "matrixmenudata" );
+_LIT( KMenuUrl, "menu:url" );
+_LIT( KMenuShortcut, "menu:shortcut" );
+_LIT( KMenuWrong, "menu:failingmenu" );
+_LIT( KMenuAttrParam, "param" );
+_LIT8( KCmdOpen, "open" );
+
+// CONSTRUCTION
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_McsPluginHandler* UT_McsPluginHandler::NewL()
+{
+ UT_McsPluginHandler* self = UT_McsPluginHandler::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_McsPluginHandler* UT_McsPluginHandler::NewLC()
+{
+ UT_McsPluginHandler* self = new(ELeave) UT_McsPluginHandler();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+// Destructor (virtual by CBase)
+// ---------------------------------------------------------------------------
+//
+UT_McsPluginHandler::~UT_McsPluginHandler()
+{
+ iMenu.Close();
+}
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+UT_McsPluginHandler::UT_McsPluginHandler()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Second phase construct
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::ConstructL()
+{
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+}
+
+
+// ---------------------------------------------------------------------------
+// void UT_McsPluginHandler::HandleSessionEventL
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::HandleSessionEventL(
+ TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/,
+ TAny* /*aArg2*/,
+ TAny* /*aArg3*/ )
+ {
+ // No event handling
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_McsPluginHandler::SetupL()
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::SetupL()
+{
+ iMenu.OpenL( KMyMenuData );
+ iHandler = CMCSPluginHandler::NewL( iMenu );
+ iWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation );
+}
+
+// ---------------------------------------------------------------------------
+// void UT_McsPluginHandler::Teardown()
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::Teardown()
+{
+ if ( iWatcher )
+ {
+ iWatcher->Cancel();
+ delete iWatcher;
+ iWatcher = NULL;
+ }
+ if ( iHandler )
+ {
+ delete iHandler;
+ iHandler = NULL;
+ }
+ iMenu.Close();
+}
+
+// ---------------------------------------------------------------------------
+// void UT_McsPluginHandler::SupportedTypesTestL()
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::SupportedTypesTestL()
+ {
+ // Checks all supported types (excludes unsupported)
+ // Change if added/removed
+ EUNIT_ASSERT( iHandler->SupportsType( KMenuTypeFolder ) );
+ EUNIT_ASSERT( iHandler->SupportsType( KMenuTypeSuite ) );
+ EUNIT_ASSERT( iHandler->SupportsType( KMenuShortcut ) );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_McsPluginHandler::CommandHandlingL()
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::CommandHandlingL()
+ {
+ CMenuItem* menuItem = NULL;
+
+ /**
+ * Test 1 - incorrect command to handle
+ */
+ // Try with incorrect settings
+ menuItem = CMenuItem::CreateL( iMenu, KMenuWrong, 0, 0 );
+ CleanupStack::PushL( menuItem );
+ menuItem->SetAttributeL( KMenuAttrLongName, KUrlInvalid );
+ menuItem->SetAttributeL( KMenuAttrParam, KUrlInvalid );
+ menuItem->SetAttributeL( KMenuAttrIconFile, KBookmarkIconFile );
+ menuItem->SetAttributeL( KMenuAttrIconId, KBookmarkIconId );
+ menuItem->SetAttributeL( KMenuAttrMaskId, KBookmarkIconMaskId );
+ EUNIT_ASSERT_LEAVE
+ (
+ // Should leave here!!!
+ CMCSPluginCompletedOperation* opl = NULL;
+ opl = static_cast<CMCSPluginCompletedOperation*> (
+ iHandler->HandleCommandL(
+ *menuItem, KNullDesC8, KNullDesC8, iWatcher->iStatus ) );
+ );
+
+ CleanupStack::PopAndDestroy( menuItem ); // iWatcher is not incorporated
+ }
+
+// ---------------------------------------------------------------------------
+// UT_McsPluginHandler::LaunchShortcutL()
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::LaunchShortcutL()
+ {
+ CMenuItem* menuItem = NULL;
+
+ /**
+ * Test 1 - correct command to handle, incorrect menu data
+ */
+ menuItem = CMenuItem::CreateL( iMenu, KMenuShortcut, 0, 0 );
+ CleanupStack::PushL( menuItem );
+ menuItem->SetAttributeL( KMenuAttrLongName, KDialed );
+ // KMenuAttrParam is omitted - shortcut cannot be launched
+ //menuItem->SetAttributeL( KMenuAttrParam, KDialed );
+ menuItem->SetAttributeL( KMenuAttrIconFile, KBookmarkIconFile );
+ menuItem->SetAttributeL( KMenuAttrIconId, KBookmarkIconId );
+ menuItem->SetAttributeL( KMenuAttrMaskId, KBookmarkIconMaskId );
+
+ EUNIT_ASSERT_LEAVE
+ (
+ // Should leave here!!!
+ CMCSPluginCompletedOperation* opl = NULL;
+ opl = static_cast<CMCSPluginCompletedOperation*>
+ ( iHandler->HandleCommandL( *menuItem, KCmdOpen, KNullDesC8,
+ iWatcher->iStatus ) );
+ );
+
+ CleanupStack::PopAndDestroy( menuItem ); // iWatcher is not incorporated
+ }
+
+// ---------------------------------------------------------------------------
+// UT_McsPluginHandler::LaunchItemL()
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::LaunchItemL()
+ {
+ //ToDo: Is shortcut launching the best way to test the function? In case
+ // when launched cannot be killed
+
+ CMenuOperation* op = NULL;
+ CMenuItem* menuItem = NULL;
+
+ menuItem = CMenuItem::CreateL( iMenu, KMenuShortcut, 0, 0 );
+ CleanupStack::PushL( menuItem );
+ menuItem->SetAttributeL( KMenuAttrLongName, KParamValueEmail );
+ menuItem->SetAttributeL( KMenuAttrParam, KParamValueEmail );
+ menuItem->SetAttributeL( KMenuAttrIconFile, KBookmarkIconFile );
+ menuItem->SetAttributeL( KMenuAttrIconId, KBookmarkIconId );
+ menuItem->SetAttributeL( KMenuAttrMaskId, KBookmarkIconMaskId );
+
+ op = iHandler->HandleCommandL( *menuItem, KCmdOpen, KNullDesC8,
+ iWatcher->iStatus );
+ iWatcher->Watch( op );
+
+ // checks CActive iStatus
+ TInt tcs = 0;
+ while ( iWatcher->GetStatus() == KRequestPending )
+ {
+ CAOUserAfter::AfterLD( 1000000 );
+ if ( ( tcs++ ) > 20 )
+ break;
+ }
+ iWatcher->Cancel();
+
+ CleanupStack::Pop( menuItem ); // destroyed by iWatcher
+ //ToDo: Is it necessary to test all possibilities?
+ }
+
+// ---------------------------------------------------------------------------
+// UT_McsPluginHandler::SessionEventL()
+// ---------------------------------------------------------------------------
+//
+void UT_McsPluginHandler::SessionEventL()
+ {
+ // Test HandleSessionEventL
+ // The funciton is empty now, so it tests leave only
+ EUNIT_ASSERT_NO_LEAVE( iHandler->HandleSessionEventL(
+ MMsvSessionObserver::EMsvEntriesCreated, NULL, NULL, NULL ) );
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE
+ (
+ UT_McsPluginHandler,
+ "MCS plugin handler tests",
+ "UNIT"
+ )
+
+EUNIT_TEST
+ (
+ "Tests supported types for the mcs plugina handler",
+ "CMcsPluginHandler",
+ "SupportsType",
+ "FUNCTIONALITY",
+ SetupL, SupportedTypesTestL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Tests command handling",
+ "CMcsPluginHandler",
+ "HandleCommandL",
+ "FUNCTIONALITY",
+ SetupL, CommandHandlingL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Tests command handling & shortcut launching",
+ "CMcsPluginHandler",
+ "HandleCommandL, LaunchShortcutL",
+ "FUNCTIONALITY",
+ SetupL, LaunchShortcutL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Tests command handling & shortcut launching 2",
+ "CMcsPluginHandler",
+ "HandleCommandL, LaunchShortcutL",
+ "FUNCTIONALITY",
+ SetupL, LaunchItemL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Tests HandleSessionEventL",
+ "CMcsPluginHandler",
+ "HandleSessionEventL",
+ "FUNCTIONALITY",
+ SetupL, SessionEventL, Teardown
+ )
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcsplugin/ut_mcspluginhandler.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,118 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __UT_MCSPLUGINHANDLER_H__
+#define __UT_MCSPLUGINHANDLER_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <mcsmenu.h>
+#include <msvapi.h>
+
+// INTERNAL INCLUDES
+
+// FORWARD DECLARATIONS
+class CMCSPluginHandler;
+class CMCSPluginWatcher;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * Unit test for the mcspluginhandler
+ *
+ */
+NONSHARABLE_CLASS( UT_McsPluginHandler ) :
+ public CEUnitTestSuiteClass,
+ public MMsvSessionObserver
+ {
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_McsPluginHandler* NewL();
+ static UT_McsPluginHandler* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_McsPluginHandler();
+
+private: // Constructors and destructors
+
+ UT_McsPluginHandler();
+ void ConstructL();
+
+private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ /**
+ * Test supported types function for correct output
+ */
+ void SupportedTypesTestL();
+
+ /**
+ * Tests command handling and spoectial shortcuts launching
+ * functins for basic functionality
+ */
+ void CommandHandlingL();
+
+ /**
+ * Tests pure shortcut launching
+ */
+ void LaunchShortcutL();
+
+ /**
+ * Tests launch of a specific shortcut
+ */
+ void LaunchItemL();
+
+ /**
+ * Tests HandleSessionEvent function
+ */
+ void SessionEventL();
+
+ /**
+ * From class MMsvSessionObserver,
+ * Handles an event from the message server.
+ */
+ void HandleSessionEventL(
+ TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/,
+ TAny* /*aArg2*/,
+ TAny* /*aArg3*/ );
+
+private: // Data
+
+ CMCSPluginHandler* iHandler;
+ RMenu iMenu;
+ CMCSPluginWatcher* iWatcher;
+
+ EUNIT_DECLARE_TEST_TABLE;
+ };
+
+#endif // __UT_MCSPLUGINHANDLER_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcsplugin/ut_mcspluginhandlerdllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_mcspluginhandler.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_McsPluginHandler::NewL();
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcsplugin/ut_mcspluginpublisher.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,518 @@
+/*
+* Copyright (c) 2010 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: unit test for the mcsplugin publisher
+*
+*/
+
+#include "ut_mcspluginpublisher.h"
+
+#define protected public
+#define private public
+
+#include "mcsplugin.h"
+#include "mcspluginengine.h"
+#include "mcsplugindata.h"
+
+#undef private
+#undef protected
+
+#include <e32cmn.h>
+#include <digia/eunit/eunitmacros.h>
+#include <mcspluginuids.hrh>
+#include <mcsdef.h>
+
+#include <hscontentpublisher.h>
+#include <hspluginsettings.h>
+
+
+using namespace HSPluginSettingsIf;
+
+_LIT( KMcsPluginName, "mcsplugin" );
+_LIT8( KNameSpace, "3" );
+
+_LIT( KMenuIconFile, "aimcsplugin.mif" );
+_LIT( KMenuBookmarkIconId, "16386" );
+_LIT( KMenuBookmarkMaskId, "16387" );
+_LIT( KMenuMailboxIconId, "16388" );
+_LIT( KMenuMailboxMaskId, "16389" );
+_LIT( KMenuTypeMailbox, "menu:mailbox" );
+_LIT( KIcon, "icon" );
+
+_LIT8( KProperNameType, "type" );
+_LIT8( KProperNameParam, "param" );
+_LIT8( KProperNameUid, "uid" );
+_LIT8( KProperNameView, "view" );
+_LIT8( KProperNameLocked, "locked" );
+_LIT8( KProperValueBookmark, "bookmark" );
+_LIT8( KProperValueFolder, "folder" );
+_LIT8( KProperValueMailbox, "mailbox" );
+_LIT8( KMenuAttrUndefUid, "0x99999991" );
+_LIT8( KMenuAttrViewTest, "view:test" );
+_LIT8( KMenuAttrParamTest, "param:test" );
+
+_LIT( KTestName, "test:name" );
+_LIT( KTestIconAttr, "icon_attributes" );
+_LIT( KTestIconValue, "skin(270501603 9361):mif(icon.mif 16384 16385)" );
+
+
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroy()
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroy( TAny* aObj )
+ {
+ if( aObj )
+ {
+ static_cast<T*>( aObj )->ResetAndDestroy();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroyPushL
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroyPushL(T& aArray)
+ {
+ CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) );
+ }
+
+
+// CONSTRUCTION
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_MCSPluginPublisher* UT_MCSPluginPublisher::NewL()
+{
+ UT_MCSPluginPublisher* self = UT_MCSPluginPublisher::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_MCSPluginPublisher* UT_MCSPluginPublisher::NewLC()
+{
+ UT_MCSPluginPublisher* self = new(ELeave) UT_MCSPluginPublisher();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+// Destructor (virtual by CBase)
+// ---------------------------------------------------------------------------
+//
+UT_MCSPluginPublisher::~UT_MCSPluginPublisher()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+UT_MCSPluginPublisher::UT_MCSPluginPublisher()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Second phase construct
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::ConstructL()
+{
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+}
+
+// ---------------------------------------------------------------------------
+// void UT_McsPluginPublisher::HandleSessionEventL
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::HandleSessionEventL(
+ TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/,
+ TAny* /*aArg2*/,
+ TAny* /*aArg3*/ )
+{
+// No event handling
+}
+
+
+// ---------------------------------------------------------------------------
+// void UT_McsPluginPublisher::SetupL()
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::SetupL()
+{
+ _LIT8( KAppUid, "271012080" );
+ CHomescreenSettings::InitializeL( KAppUid );
+
+ TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_MCSPLUGIN };
+
+ THsPublisherInfo pubInfo( uid, KMcsPluginName, KNameSpace );
+
+ iMCSPlugin = static_cast<CMCSPlugin*>
+ (CHsContentPublisher::NewL( pubInfo ));
+
+ EUNIT_ASSERT( iMCSPlugin );
+
+ RAiSettingsItemArray settings;
+ iMCSPlugin->ConfigureL( settings );
+
+
+ // MCS plugin settings
+ iPluginSettings = CHomescreenSettings::Instance();
+ if( iPluginSettings == NULL )
+ {
+ User::Leave( KErrUnknown );
+ }
+
+ User::LeaveIfError( iPluginSettings->GetSettingsL( KNameSpace, iSettings ));
+ if ( iSettings.Count() <= 0 )
+ {
+ User::Leave( KErrNotFound );
+ }
+}
+
+// ---------------------------------------------------------------------------
+// void UT_McsPluginPublisher::Teardown()
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::Teardown()
+{
+ User::LeaveIfError( iPluginSettings->SetSettingsL( KNameSpace,
+ iSettings, ETrue ));
+
+ iSettings.ResetAndDestroy();
+
+ CHomescreenSettings::UnInitialize();
+
+ if( iMCSPlugin )
+ {
+ delete iMCSPlugin;
+ iMCSPlugin = NULL;
+ }
+}
+
+// ---------------------------------------------------------------------------
+// Test CMCSData class
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::TestMCSDataL()
+{
+ _LIT( KTestName, "test:name" );
+ _LIT( KTestValue, "test:value" );
+
+ CMCSData* data = new ( ELeave ) CMCSData();
+ CleanupStack::PushL( data );
+
+ data->SetNameL( KTestName );
+ data->SetValueL( KTestValue );
+
+ EUNIT_ASSERT_EQUALS( data->Name(), KTestName );
+ EUNIT_ASSERT_EQUALS( data->Value(), KTestValue );
+
+ CleanupStack::PopAndDestroy( data );
+}
+
+// ---------------------------------------------------------------------------
+// Test CMCSPluginData::RemoveDataL
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::TestMCSPluginData_RemoveDataL()
+{
+ CMCSData& data = iMCSPlugin->iEngine->iPluginData->DataItemL( 0 );
+
+ data.MenuItem().SetType( KMenuTypeMailbox );
+ data.MenuItem().SetId( 0 );
+
+ iMCSPlugin->iEngine->iPluginData->RemoveDataL( 0 );
+
+ EUNIT_ASSERT_EQUALS( data.MenuItem().Id(), KErrNotFound );
+ EUNIT_ASSERT_EQUALS( data.IsDirty(), ETrue );
+}
+
+// ---------------------------------------------------------------------------
+// Test CMCSPluginData::GetBkmDataL
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::TestMCSPluginData_GetBkmDataL()
+{
+ RPointerArray<CItemMap> settings;
+ CleanupResetAndDestroyPushL( settings );
+
+ User::LeaveIfError( iPluginSettings->GetSettingsL( KNameSpace , settings ));
+
+ CItemMap* itemMap = settings[0];
+ RPointerArray<HSPluginSettingsIf::CPropertyMap>&
+ properties = itemMap->Properties();
+
+ for ( TInt i = 0; i < properties.Count(); i++ )
+ {
+ if ( properties[i]->Name() == KProperNameType )
+ properties[i]->SetValueL( KProperValueBookmark );
+ if ( properties[i]->Name() == KProperNameUid )
+ properties[i]->SetValueL( KMenuAttrUndefUid );
+ }
+
+ User::LeaveIfError( iPluginSettings->SetSettingsL( KNameSpace, settings,
+ ETrue) );
+ iMCSPlugin->iEngine->iPluginData->UpdateDataL();
+
+ CMCSData& itemData = iMCSPlugin->iEngine->iPluginData->DataItemL( 0 );
+ EUNIT_ASSERT_EQUALS(itemData.MenuItem().Type(), KMenuTypeUrl );
+
+ CleanupStack::PopAndDestroy();
+}
+
+// ---------------------------------------------------------------------------
+// Test CMCSPluginData::GetFolderData
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::TestMCSPluginData_GetFolderDataL()
+{
+ RPointerArray<CItemMap> settings;
+ CleanupResetAndDestroyPushL( settings );
+
+ User::LeaveIfError( iPluginSettings->GetSettingsL( KNameSpace , settings ));
+
+ CItemMap* itemMap = settings[0];
+ RPointerArray<HSPluginSettingsIf::CPropertyMap>&
+ properties = itemMap->Properties();
+
+ for ( TInt i = 0; i < properties.Count(); i++ )
+ {
+ if ( properties[i]->Name() == KProperNameType )
+ properties[i]->SetValueL( KProperValueFolder );
+ }
+
+ User::LeaveIfError( iPluginSettings->SetSettingsL( KNameSpace, settings,
+ ETrue ));
+ iMCSPlugin->iEngine->iPluginData->UpdateDataL();
+
+ CMCSData& itemData = iMCSPlugin->iEngine->iPluginData->DataItemL( 0 );
+ EUNIT_ASSERT_EQUALS(itemData.MenuItem().Type(), KMenuTypeFolder );
+
+ CleanupStack::PopAndDestroy();
+}
+
+// ---------------------------------------------------------------------------
+// Test CMCSPluginData::GetMailboxDataL
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::TestMCSPluginData_GetMailboxDataL()
+{
+ RPointerArray<CItemMap> settings;
+ CleanupResetAndDestroyPushL( settings );
+
+ User::LeaveIfError( iPluginSettings->GetSettingsL( KNameSpace , settings ));
+
+ CItemMap* itemMap = settings[ 0 ];
+ RPointerArray<HSPluginSettingsIf::CPropertyMap>&
+ properties = itemMap->Properties();
+
+ for ( TInt i = 0; i < properties.Count(); i++ )
+ {
+ if ( properties[i]->Name() == KProperNameType )
+ properties[i]->SetValueL( KProperValueMailbox );
+ }
+
+ User::LeaveIfError( iPluginSettings->SetSettingsL( KNameSpace, settings,
+ ETrue));
+ iMCSPlugin->iEngine->iPluginData->UpdateDataL();
+
+ CMCSData& itemData = iMCSPlugin->iEngine->iPluginData->DataItemL(0);
+ EUNIT_ASSERT_EQUALS( itemData.MenuItem().Type(), KMenuTypeMailbox );
+
+ CleanupStack::PopAndDestroy();
+}
+
+// ---------------------------------------------------------------------------
+// CMCSPluginEngine::CreateBkmItemL
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::TestMCSPluginEngine_CreateBkmItemL()
+{
+ CMCSData* data = new ( ELeave ) CMCSData();
+ CleanupStack::PushL( data );
+
+ data->MenuItem().SetType( KMenuTypeUrl );
+ data->MenuItem().SetId( 0 );
+ data->SetNameL( KTestName );
+
+ CMenuItem *menuItem = iMCSPlugin->iEngine->FetchMenuItemL( *data );
+ CleanupStack::PushL( menuItem );
+
+ TBool attrExists = ETrue;
+
+ EUNIT_ASSERT_EQUALS( menuItem->GetAttributeL( KMenuAttrLongName,
+ attrExists ), KTestName );
+ EUNIT_ASSERT_EQUALS( menuItem->GetAttributeL( KMenuAttrIconFile,
+ attrExists ), KMenuIconFile );
+ EUNIT_ASSERT_EQUALS( menuItem->GetAttributeL( KMenuAttrIconId,
+ attrExists ), KMenuBookmarkIconId );
+ EUNIT_ASSERT_EQUALS( menuItem->GetAttributeL( KMenuAttrMaskId,
+ attrExists ), KMenuBookmarkMaskId );
+
+ CleanupStack::PopAndDestroy( menuItem );
+ CleanupStack::PopAndDestroy( data );
+}
+
+// ---------------------------------------------------------------------------
+// CMCSPluginEngine::CreateMailboxItemL
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::TestMCSPluginEngine_CreateMailboxItemL()
+{
+ CMCSData* data = new ( ELeave ) CMCSData();
+ CleanupStack::PushL( data );
+
+ data->MenuItem().SetType( KMenuTypeMailbox );
+ data->MenuItem().SetId( 0 );
+ data->SetNameL( KTestName );
+
+ CMenuItem *menuItem = iMCSPlugin->iEngine->FetchMenuItemL( *data );
+ CleanupStack::PushL( menuItem );
+
+ TBool attrExists = ETrue;
+
+ EUNIT_ASSERT_EQUALS( menuItem->GetAttributeL( KMenuAttrLongName,
+ attrExists ), KTestName );
+ EUNIT_ASSERT_EQUALS( menuItem->GetAttributeL( KMenuAttrIconFile,
+ attrExists ), KMenuIconFile );
+ EUNIT_ASSERT_EQUALS( menuItem->GetAttributeL( KMenuAttrIconId,
+ attrExists ), KMenuMailboxIconId );
+ EUNIT_ASSERT_EQUALS( menuItem->GetAttributeL( KMenuAttrMaskId,
+ attrExists ), KMenuMailboxMaskId );
+
+ CleanupStack::PopAndDestroy( menuItem );
+ CleanupStack::PopAndDestroy( data );
+}
+
+// ---------------------------------------------------------------------------
+// CMCSPluginEngine::ItemIconL
+// ---------------------------------------------------------------------------
+//
+void UT_MCSPluginPublisher::TestMCSPluginEngine_ItemIconL()
+{
+ CMCSData* data = new ( ELeave ) CMCSData();
+ CleanupStack::PushL( data );
+
+ data->MenuItem().SetType( KMenuTypeUrl );
+ data->MenuItem().SetId( 0 );
+ data->SetNameL( KTestName );
+
+ CMenuItem *menuItem = iMCSPlugin->iEngine->FetchMenuItemL( *data );
+ CleanupStack::PushL( menuItem );
+
+ menuItem->SetAttributeL( KTestIconAttr, KTestIconValue );
+
+ CGulIcon* icon = iMCSPlugin->iEngine->ItemIconL( menuItem, KTestIconAttr );
+ CleanupStack::PushL( icon );
+
+ EUNIT_ASSERT( icon );
+
+ CleanupStack::PopAndDestroy( icon );
+ CleanupStack::PopAndDestroy( menuItem );
+ CleanupStack::PopAndDestroy( data );
+}
+
+
+// TEST TABLE
+EUNIT_BEGIN_TEST_TABLE
+ (
+ UT_MCSPluginPublisher,
+ "MCS plugin publisher tests",
+ "UNIT"
+ )
+
+EUNIT_TEST
+ (
+ "Test MCS data",
+ "CMCSData",
+ "VariablesSettings",
+ "FUNCTIONALITY",
+ SetupL, TestMCSDataL, Teardown )
+
+EUNIT_TEST
+ (
+ "Test remove data",
+ "CMCSPluginData",
+ "RemoveDataL",
+ "FUNCTIONALITY",
+ SetupL, TestMCSPluginData_RemoveDataL, Teardown )
+
+EUNIT_TEST
+ (
+ "Test create bookmark data item",
+ "CMCSPluginData",
+ "GetBkmDataL",
+ "FUNCTIONALITY",
+ SetupL, TestMCSPluginData_GetBkmDataL, Teardown )
+
+EUNIT_TEST
+ (
+ "Test create folder data item",
+ "CMCSPluginData",
+ "GetFolderData",
+ "FUNCTIONALITY",
+ SetupL, TestMCSPluginData_GetFolderDataL, Teardown )
+
+EUNIT_TEST
+ (
+ "Test create mailbox data item",
+ "CMCSPluginData",
+ "GetMailboxDataL",
+ "FUNCTIONALITY",
+ SetupL, TestMCSPluginData_GetMailboxDataL, Teardown )
+
+EUNIT_TEST
+ (
+ "Test create bookmark item ",
+ "CMCSPluginEngine",
+ "CreateBkmItemL",
+ "FUNCTIONALITY",
+ SetupL, TestMCSPluginEngine_CreateBkmItemL, Teardown )
+
+EUNIT_TEST
+ (
+ "Test create mailbox item ",
+ "CMCSPluginEngine",
+ "CreateMailboxItemL",
+ "FUNCTIONALITY",
+ SetupL, TestMCSPluginEngine_CreateMailboxItemL, Teardown )
+
+EUNIT_TEST
+ (
+ "Test icon for given menu item ",
+ "CMCSPluginEngine",
+ "ItemIconL",
+ "FUNCTIONALITY",
+ SetupL, TestMCSPluginEngine_ItemIconL, Teardown )
+
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcsplugin/ut_mcspluginpublisher.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,113 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __UT_MCSSETTINGS_H__
+#define __UT_MCSSETTINGS_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// INTERNAL INCLUDES
+#include <e32def.h>
+#include <msvapi.h>
+#include <itemmap.h>
+#include <hspluginsettings.h>
+
+// FORWARD DECLARATIONS
+class CMCSPlugin;
+
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * Unit test for the mcspluginpublisher
+ *
+ */
+NONSHARABLE_CLASS( UT_MCSPluginPublisher ) :
+ public CEUnitTestSuiteClass,
+ public MMsvSessionObserver
+ {
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_MCSPluginPublisher* NewL();
+ static UT_MCSPluginPublisher* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~UT_MCSPluginPublisher();
+
+ /**
+ * From class MMsvSessionObserver,
+ * Handles an event from the message server.
+ */
+ void HandleSessionEventL(
+ TMsvSessionEvent /*aEvent*/,
+ TAny* /*aArg1*/,
+ TAny* /*aArg2*/,
+ TAny* /*aArg3*/ );
+
+
+
+private: // Constructors and destructors
+
+ UT_MCSPluginPublisher();
+
+ void ConstructL();
+
+private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void TestMCSDataL();
+
+ void TestMCSPluginData_RemoveDataL();
+
+ void TestMCSPluginData_GetBkmDataL();
+
+ void TestMCSPluginData_GetFolderDataL();
+
+ void TestMCSPluginData_GetMailboxDataL();
+
+ void TestMCSPluginEngine_CreateBkmItemL();
+
+ void TestMCSPluginEngine_CreateMailboxItemL();
+
+ void TestMCSPluginEngine_ItemIconL();
+
+private: // Data
+ CMCSPlugin* iMCSPlugin;
+
+ RPointerArray<HSPluginSettingsIf::CItemMap> iSettings;
+
+ HSPluginSettingsIf::CHomescreenSettings* iPluginSettings;
+
+ EUNIT_DECLARE_TEST_TABLE;
+ };
+
+#endif // __UT_McsPluginpublisher_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcsplugin/ut_mcspluginpublisherdllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_mcspluginpublisher.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_MCSPluginPublisher::NewL();
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcssettings/caouserafter.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __CAOUSERAFTER_H__
+#define __CAOUSERAFTER_H__
+
+// INCLUDES
+#include <E32base.h>
+#include <E32svr.h>
+#include <CoeMain.h>
+
+
+/**
+ * Active object version of User::After()
+ */
+class CAOUserAfter : public CTimer
+ {
+ private:
+ CActiveSchedulerWait iWait;
+ TInt iLength;
+
+
+ public: //new functions
+
+ /**
+ * Constructs the waiting timer, executes
+ * it and when timer expires, deletes self.
+ * @param aLength The lenghth of wait in micro
+ * seconds.
+ */
+ static void AfterLD( TInt aLenght )
+ {
+ CAOUserAfter* wait= new ( ELeave ) CAOUserAfter( aLenght );
+ CleanupStack::PushL( wait );
+ wait->ConstructL();
+ CleanupStack::Pop();
+
+ RDebug::Print( _L("CAOUserAfter - Starting time consuming...") );
+ wait->StartWaitD();
+ RDebug::Print( _L("CAOUserAfter - completed.") );
+ }
+
+ private:
+ CAOUserAfter( TInt aLenght )
+ : CTimer( CActive::EPriorityStandard ),
+ iLength( aLenght )
+ {
+ }
+
+ void ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add( this );
+ }
+
+ virtual ~CAOUserAfter()
+ {
+ }
+
+ void StartWaitD()
+ {
+ After( iLength );
+ iWait.Start();
+ }
+
+ void RunL()
+ {
+ iWait.AsyncStop();
+ Cancel();
+ delete this;
+ }
+ };
+
+#endif // __CAOUSERAFTER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcssettings/ut_mcssettings.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,1293 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "UT_mcssettings.h"
+
+// EXTERNAL INCLUDES
+
+#define protected public
+#define private public
+#include "mcspluginsettingsapplist.h"
+#include "mcspluginsettingsbkmlist.h"
+#include <gsbaseview.h>
+#undef private
+#undef protected
+
+#include <msvuids.h> // For KMsvRootIndexEntryIdValue
+#include <senduimtmuids.h>
+
+#include <digia/eunit/eunitmacros.h>
+#include <GSPrivatePluginProviderIds.h>
+#include <aknappui.h>
+#include <aknviewappui.h>
+#include <eikenv.h>
+#include <CentralRepository.h>
+#include <apgcli.h> //RApaLsSession
+#include <w32std.h> // For RWsSession
+
+// INTERNAL INCLUDES
+#include "mcspluginsettings.h"
+#include "mcspluginsettingsapplist.h"
+#include "mcspluginsettingscontainer.h"
+#include "mcspluginsettingsmodel.h"
+#include "mcspluginsettingsbkmlist.h"
+
+#include "caouserafter.h"
+#include "mcspluginuids.hrh"
+#include "mcspluginsettings.hrh"
+
+#include <favouritesitemlist.h>
+#include <mcsmenuitem.h>
+#include <mcsmenufilter.h>
+#include <hspluginsettings.h>
+#include <apgtask.h>
+#include <hlplch.h>
+
+
+const TUid KCRUidAvkon = { 0x101F876E };
+const TUint32 KAknMiddleSoftkeyEnabled = 0x0000000A;
+
+const TInt KWait_05_secs = 0.5 * 1000000;
+const TInt KWait_1_secs = 1 * 1000000;
+const TInt KWait_2_secs = 2 * 1000000;
+const TInt KWait_3_secs = 3 * 1000000;
+
+_LIT8( KEmpty, "" );
+_LIT( KMyMenuData, "matrixmenudata" );
+_LIT( KMenuUrl, "menu:url" );
+_LIT8( KPluginId, "3" );
+_LIT(KUid, "0x99999985");
+_LIT(KName, "TEST");
+_LIT( KUrl, "http://test" );
+_LIT8( KUidMCSB8, "0xeeeeffff" );
+_LIT( KUidMCSB16, "0xeeeeffff" );
+
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroy()
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroy( TAny* aObj )
+ {
+ if( aObj )
+ {
+ static_cast<T*>( aObj )->ResetAndDestroy();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// CleanupResetAndDestroyPushL
+// ----------------------------------------------------------------------------
+//
+template<class T>
+static void CleanupResetAndDestroyPushL(T& aArray)
+ {
+ CleanupStack::PushL( TCleanupItem( &CleanupResetAndDestroy<T>, &aArray ) );
+ }
+
+
+// CONSTRUCTION
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_mcssettings* UT_mcssettings::NewL()
+{
+ UT_mcssettings* self = UT_mcssettings::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_mcssettings* UT_mcssettings::NewLC()
+{
+ UT_mcssettings* self = new(ELeave) UT_mcssettings();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+// Destructor (virtual by CBase)
+// ---------------------------------------------------------------------------
+//
+UT_mcssettings::~UT_mcssettings()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+UT_mcssettings::UT_mcssettings()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Second phase construct
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::ConstructL()
+{
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+}
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::SetupL()
+ {
+ //__UHEAP_MARK;
+ iGs = CGSPluginInterface::NewL(TUid::Uid(AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN), NULL);
+ iSettingsView = static_cast<CGSBaseView*>(iGs);
+
+ iAppUi = reinterpret_cast< CAknViewAppUi* >(CEikonEnv::Static()->EikAppUi());
+
+ iModel = CMCSPluginSettingsModel::NewL(*(CMCSPluginSettings::NewL(NULL)),CEikonEnv::Static());
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::Teardown()
+ {
+ delete iSettingsView;
+ iSettingsView = NULL;
+
+ if ( iGs )
+ {
+ iGs = NULL;
+ }
+
+ if ( iAppList )
+ {
+ delete iAppList;
+ iAppList = NULL;
+ if ( iBkmList )
+ {
+ delete iBkmList;
+ iBkmList = NULL;
+ }
+
+ iContainer = NULL;
+ }
+ else
+ {
+ if ( iBkmList )
+ {
+ delete iBkmList;
+ iBkmList = NULL;
+ iContainer = NULL;
+ }
+ else
+ {
+ if( iContainer )
+ {
+ delete iContainer;
+ iContainer = NULL;
+ }
+ }
+ }
+
+ if ( iModel )
+ {
+ delete iModel;
+ iModel = NULL;
+ }
+
+ iItemArray.Reset();
+ //__UHEAP_MARKEND;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::emptySetup()
+{
+}
+
+//----------------------------------------------------------------------------
+// Tests for CMCSPluginSettings
+//----------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_Settings_FailL()
+{
+ TVwsViewId dummyId;
+
+ iSettingsView->DoActivateL(dummyId, KNullUid, KNullDesC8);
+ CAOUserAfter::AfterLD(KWait_05_secs);
+
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+
+ EUNIT_ASSERT(EFalse);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_Settings_NewLL()
+{
+ EUNIT_ASSERT(iSettingsView);
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_Settings_IdL()
+{
+ EUNIT_ASSERT_EQUALS(TUid::Uid(AI_UID_ECOM_IMPLEMENTATION_SETTINGS_MCSPLUGIN), iSettingsView->Id());
+
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_Settings_HandleCommandLL()
+{
+ TRAPD(err, iSettingsView->HandleCommandL(EAknSoftkeyExit));
+ EUNIT_ASSERT_EQUALS(err, KErrNone);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_Settings_DoDeactivateL()
+{
+ TVwsViewId dummyId;
+
+ iSettingsView->DoActivateL(dummyId, KNullUid, KNullDesC8);
+ CAOUserAfter::AfterLD(KWait_1_secs);
+
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_1_secs);
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_Settings_GetCaptionLL()
+{
+ TBuf<50> caption = _L("Shortcuts");
+ TBuf<50> desc;
+
+ iGs->GetCaptionL(desc);
+
+ EUNIT_ASSERT_EQUALS(caption, desc);
+
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_Settings_PluginProviderCategoryL()
+{
+ EUNIT_ASSERT_EQUALS(KGSPluginProviderInternal, iGs->PluginProviderCategory());
+
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_Settings_VisibleL()
+{
+ EUNIT_ASSERT_EQUALS(EFalse,iGs->Visible());
+
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::SetupAppListL()
+{
+ SetupL();
+
+ TVwsViewId dummyId;
+ iSettingsView->DoActivateL(dummyId, KNullUid, KNullDesC8);
+ CAOUserAfter::AfterLD(KWait_05_secs);
+
+ iContainer =
+ static_cast<CMCSPluginSettingsContainer*>( iSettingsView->Container() );
+ EUNIT_ASSERT(iContainer);
+
+ iAppList = CMCSPluginSettingsAppList::NewL();
+
+ iAppList->StartL();
+
+ //while (!iAppList->IsReady())
+ {
+ CAOUserAfter::AfterLD(KWait_05_secs);
+ }
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::TeardownAppList()
+{
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+ Teardown();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsAppList_NewLL()
+{
+ EUNIT_ASSERT(iAppList);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsAppList_MdcaCountL()
+{
+ TVwsViewId dummyId;
+ TInt count;
+
+ iSettingsView->DoActivateL(dummyId, KNullUid, KNullDesC8);
+ CAOUserAfter::AfterLD(KWait_05_secs);
+
+ iContainer =
+ static_cast<CMCSPluginSettingsContainer*>( iSettingsView->Container() );
+ EUNIT_ASSERT(iContainer);
+
+ iAppList = CMCSPluginSettingsAppList::NewL();
+ count = iAppList->MdcaCount();
+ iAppList->StartL();
+
+ //while (!iAppList->IsReady())
+ {
+ CAOUserAfter::AfterLD(KWait_05_secs);
+ }
+
+ EUNIT_ASSERT_NOT_EQUALS(count, iAppList->MdcaCount());
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsAppList_MdcaPointL()
+{
+ TPtrC ret(KNullDesC);
+ EUNIT_ASSERT_EQUALS(ret,iAppList->MdcaPoint(-1));
+
+ EUNIT_ASSERT_EQUALS(ret,iAppList->MdcaPoint(208));
+
+ TBufC<30> buf = iAppList->MdcaPoint(0);
+
+ EUNIT_ASSERT(buf.Length() > 0);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsAppList_HandleSessionEventLL()
+ {
+ TAny* dummy = NULL;
+
+ for (TInt i = 0; i < 10; i++)
+ {
+ TRAPD(err,
+ iAppList->HandleSessionEventL(
+ MMsvSessionObserver::TMsvSessionEvent(i),
+ dummy,
+ dummy,
+ dummy) );
+ EUNIT_ASSERT_EQUALS(err, KErrNone);
+ }
+ }
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::SetupBkmListL()
+{
+ SetupL();
+
+ TVwsViewId dummyId;
+ iSettingsView->DoActivateL(dummyId, KNullUid, KNullDesC8);
+ CAOUserAfter::AfterLD(KWait_05_secs);
+
+ iContainer =
+ static_cast<CMCSPluginSettingsContainer*>( iSettingsView->Container() );
+ EUNIT_ASSERT(iContainer);
+
+ iBkmList = CMCSPluginSettingsBkmList::NewL();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::TeardownBkmList()
+{
+ if ( iRemoveWatcher )
+ {
+ delete iRemoveWatcher;
+ iRemoveWatcher = NULL;
+ }
+ if ( iSaveWatcher )
+ {
+ delete iSaveWatcher;
+ iSaveWatcher = NULL;
+ }
+
+ iMenu.Close();
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+ Teardown();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsBkmList_NewLL()
+{
+ EUNIT_ASSERT(iBkmList);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsBkmList_MdcaCountL()
+{
+ TInt count1( -1 );
+ iBkmList->GetBookmarkListL();
+ count1 = iBkmList->MdcaCount();
+
+ RFavouritesSession bookmarkSess;
+ RFavouritesDb bookmarkDb;
+
+ User::LeaveIfError( bookmarkSess.Connect() );
+ User::LeaveIfError(bookmarkDb.Open( bookmarkSess, KBrowserBookmarks) );
+ iMenu.OpenL( KMyMenuData );
+
+ CMenuFilter* filter = CMenuFilter::NewL();
+ CleanupStack::PushL( filter );
+ filter->SetType( KMenuUrl );
+ const TInt rootId = iMenu.RootFolderL();
+
+ RArray<TMenuItem> itemArray;
+ CleanupClosePushL( itemArray );
+ iMenu.GetItemsL( itemArray, rootId, filter, ETrue );
+ TInt countmenu( itemArray.Count() );
+
+ CFavouritesItemList* favItems = new ( ELeave ) CFavouritesItemList();
+ CleanupStack::PushL( favItems );
+ TInt err = bookmarkDb.GetAll( *favItems, KFavouritesNullUid,
+ CFavouritesItem::EItem );
+ if( err != KErrNone )
+ {
+ EUNIT_ASSERT( 0 );
+ }
+ TInt countfav = favItems->Count();
+
+ EUNIT_ASSERT_EQUALS( countfav + countmenu, count1 );
+
+ CleanupStack::PopAndDestroy( favItems );
+ CleanupStack::PopAndDestroy( &itemArray );
+ CleanupStack::PopAndDestroy( filter );
+
+ bookmarkDb.Close();
+ bookmarkSess.Close();
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsBkmList_MdcaPointL()
+{
+ iBkmList->GetBookmarkListL();
+
+ TPtrC ret(KNullDesC);
+ EUNIT_ASSERT_EQUALS(ret,iBkmList->MdcaPoint(-1));
+
+ EUNIT_ASSERT_EQUALS(ret,iBkmList->MdcaPoint(200));
+
+ if ( iBkmList->MdcaCount() > 0 )
+ {
+ TBufC<30> buf = iBkmList->MdcaPoint(0);
+ EUNIT_ASSERT(buf.Length() > 0);
+ }
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsContainer_IsChangeDialogShowingL()
+{
+ TRAPD(err, iContainer = new (ELeave) CMCSPluginSettingsContainer);
+ EUNIT_ASSERT_EQUALS(err, KErrNone);
+
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsContainer_CloseChangeDialogL()
+{
+ TRAPD(err, iContainer = new (ELeave) CMCSPluginSettingsContainer);
+ EUNIT_ASSERT_EQUALS(err, KErrNone);
+
+ iContainer->CloseChangeDialog();
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+
+void UT_mcssettings::UT_SettingsModel_NewLL()
+{
+ EUNIT_ASSERT(iModel);
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsModel_MdcaCountL()
+{
+ EUNIT_ASSERT_NOT_EQUALS(NULL, iModel->MdcaCount());
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD(KWait_05_secs);
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsModel_MdcaPointL()
+ {
+ TInt outtaBounds = 2;
+
+ for ( TInt i = -1; i < iModel->MdcaCount() + outtaBounds; i++ )
+ {
+ if ( i < 0 || i >= iModel->MdcaCount() )
+ {
+ EUNIT_ASSERT_EQUALS( TPtrC( KNullDesC16 ),
+ iModel->MdcaPoint( i ) );
+ }
+ else
+ {
+ TPtrC desc = iModel->MdcaPoint( i );
+ EUNIT_ASSERT_NOT_EQUALS( desc.Length(), NULL );
+ }
+ }
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD( KWait_05_secs );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsAppList_ItemL()
+ {
+ CMenuItem* menuItem;
+ TInt maxIndex = iAppList->MdcaCount();
+
+ if ( maxIndex > 0 )
+ {
+ menuItem = iAppList->ItemL( maxIndex - 1 );
+ EUNIT_ASSERT( menuItem );
+ }
+
+ maxIndex = -1;
+ menuItem = iAppList->ItemL( maxIndex );
+
+ EUNIT_ASSERT_EQUALS( menuItem == NULL, ETrue );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsAppList_FindItemL()
+ {
+ RPointerArray<HSPluginSettingsIf::CPropertyMap> properties;
+ CleanupResetAndDestroyPushL( properties );
+ HSPluginSettingsIf::CPropertyMap* typePropertyMap =
+ HSPluginSettingsIf::CPropertyMap::NewL();
+ CleanupStack::PushL( typePropertyMap );
+ typePropertyMap->SetNameL( _L8( "type" ) );
+ typePropertyMap->SetValueL( _L8( "application" ) );
+ properties.AppendL( typePropertyMap );
+ CleanupStack::Pop( typePropertyMap );
+
+ HSPluginSettingsIf::CPropertyMap* uidPropertyMap =
+ HSPluginSettingsIf::CPropertyMap::NewL();
+ CleanupStack::PushL( uidPropertyMap );
+ uidPropertyMap->SetNameL( _L8( "uid" ) );
+ uidPropertyMap->SetValueL( _L8( "0xeeeebbbb" ) );
+ properties.AppendL( uidPropertyMap );
+ CleanupStack::Pop( uidPropertyMap );
+
+ TSettingItem setting = iAppList->FindItemL( properties );
+ EUNIT_ASSERT_EQUALS( setting.id == KErrNotFound, ETrue );
+
+ CleanupStack::PopAndDestroy(); //properties
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsBkmList_ItemL()
+ {
+ TInt maxIndex = iBkmList->MdcaCount();
+ CMenuItem* menu( NULL );
+ if ( maxIndex > 0 )
+ {
+ menu = iBkmList->ItemL( maxIndex - 1 );
+ EUNIT_ASSERT_EQUALS( menu != NULL, ETrue );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsBkmList_FindItemL()
+ {
+ RPointerArray<HSPluginSettingsIf::CPropertyMap> properties;
+ CleanupResetAndDestroyPushL( properties );
+
+ HSPluginSettingsIf::CPropertyMap* myCPropertyMap =
+ HSPluginSettingsIf::CPropertyMap::NewL();
+ CleanupStack::PushL( myCPropertyMap );
+ myCPropertyMap->SetNameL( _L8( "uid" ) );
+ myCPropertyMap->SetValueL( _L8( "0xeeeebbbb" ) );
+ properties.AppendL( myCPropertyMap );
+ CleanupStack::Pop( myCPropertyMap );
+
+ TSettingItem setting = iBkmList->FindItemL( properties );
+ EUNIT_ASSERT_EQUALS( setting.id == KErrNotFound, ETrue );
+ CleanupStack::PopAndDestroy(); //properties
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsContainer_ResetCurrrentListL()
+ {
+ TRAPD(err, iContainer->ResetCurrentListL( 0 ) );
+ EUNIT_ASSERT_EQUALS( err, KErrNone );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsModel_AppList()
+ {
+ EUNIT_ASSERT( iModel->AppList() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsModel_BkmList()
+ {
+ EUNIT_ASSERT( iModel->BkmList() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsModel_ItemId()
+ {
+ TInt indexMax = iModel->MdcaCount();
+ TInt indexID( 0 );
+
+ if ( indexMax > 0 )
+ {
+ indexID = iModel->ItemId( indexMax - 1 );
+ EUNIT_ASSERT_EQUALS( indexID != KErrNotFound, ETrue );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsModel_Item()
+ {
+ TSettingItem setting;
+ TInt indexMax = iModel->MdcaCount();
+ if ( indexMax > 0 )
+ {
+ setting = iModel->Item( indexMax - 1 );
+ EUNIT_ASSERT_EQUALS( setting.id != KErrNotFound, ETrue );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsModel_ReplaceItemL()
+ {
+ TInt indexMax = iModel->MdcaCount();
+ TSettingItem setting;
+
+ if ( indexMax > 0 )
+ {
+ setting = iModel->Item( indexMax - 1 );
+ if ( setting.id != KErrNotFound )
+ {
+ TBool err = iModel->ReplaceItemL( indexMax - 1,
+ setting.id,
+ setting.type );
+ EUNIT_ASSERT( err );
+ }
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::SetupModelL()
+ {
+ SetupL();
+
+ iModel->SetPluginIdL( KPluginId );
+ iModel->UpdateAppListL();
+ iModel->UpdateBkmListL();
+ CAOUserAfter::AfterLD( KWait_05_secs );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::SetupContainerL()
+ {
+ SetupL();
+ TVwsViewId dummyId;
+ iSettingsView->DoActivateL(dummyId, KNullUid, KNullDesC8);
+ CAOUserAfter::AfterLD( KWait_05_secs );
+
+ iContainer =
+ static_cast<CMCSPluginSettingsContainer*>( iSettingsView->Container() );
+ EUNIT_ASSERT(iContainer);
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsContainer_HandleNotifyL()
+ {
+ iMenu.OpenL( KMyMenuData );
+ CMenuItem* newItem = CMenuItem::CreateL( iMenu, KMenuTypeApp, 1, 0 );
+ CleanupStack::PushL( newItem );
+ newItem->SetAttributeL( KMenuAttrUid, KUid );
+ newItem->SetAttributeL( KMenuAttrLongName, KName );
+
+ iSaveWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation );
+ //add menu item
+ CMenuOperation* operationSave = newItem->SaveL( iSaveWatcher->iStatus );
+ iSaveWatcher->Watch( operationSave );
+ CAOUserAfter::AfterLD( KWait_05_secs );
+ //remove menu item
+ iRemoveWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation );
+ CMenuOperation* operationRemove = iMenu.RemoveL( newItem->Id(),
+ iRemoveWatcher->iStatus );
+ iRemoveWatcher->Watch( operationRemove );
+ CAOUserAfter::AfterLD( KWait_05_secs );
+
+ CleanupStack::PopAndDestroy( newItem );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::TeardownContainer()
+ {
+ if ( iRemoveWatcher )
+ {
+ delete iRemoveWatcher;
+ iRemoveWatcher = NULL;
+ }
+ if ( iSaveWatcher )
+ {
+ delete iSaveWatcher;
+ iSaveWatcher = NULL;
+ }
+
+ iSettingsView->DoDeactivate();
+ CAOUserAfter::AfterLD( KWait_05_secs );
+ iContainer = NULL;
+ iMenu.Close();
+ Teardown();
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsBkmList_MCSMenuItemL()
+ {
+ iMenu.OpenL( KMyMenuData );
+ CMenuItem* newItem = CMenuItem::CreateL( iMenu, KMenuTypeUrl, 1, 0 );
+ CleanupStack::PushL( newItem );
+ newItem->SetAttributeL( KMenuAttrUid, KUidMCSB16 );
+ newItem->SetAttributeL( KMenuAttrLongName, KName );
+ newItem->SetAttributeL( KMenuAttrUrl, KUrl );
+
+ //add menu item - EMCSBookmark
+ iSaveWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation );
+ CMenuOperation* operationSave = newItem->SaveL( iSaveWatcher->iStatus );
+ iSaveWatcher->Watch( operationSave );
+ CAOUserAfter::AfterLD( KWait_05_secs );
+
+ iBkmList->GetBookmarkListL();
+ RPointerArray<HSPluginSettingsIf::CPropertyMap> properties;
+ CleanupClosePushL( properties );
+ HSPluginSettingsIf::CPropertyMap* myCPropertyMap =
+ HSPluginSettingsIf::CPropertyMap::NewL();
+
+ CleanupStack::PushL( myCPropertyMap );
+ myCPropertyMap->SetNameL( _L8( "uid" ) );
+ myCPropertyMap->SetValueL( KUidMCSB8 );
+ properties.AppendL( myCPropertyMap );
+ CleanupStack::Pop( myCPropertyMap );
+
+ TSettingItem setting = iBkmList->FindItemL( properties );
+ CleanupStack::PopAndDestroy( &properties );
+ CMenuItem* menuItem = iBkmList->ItemL( setting.id );
+
+ EUNIT_ASSERT( menuItem );
+
+ //remove menu item - EMCSBookmark
+ iRemoveWatcher = CMCSPluginWatcher::NewL( CMCSPluginWatcher::EOperation );
+ CMenuOperation* operationRemove = iMenu.RemoveL( newItem->Id(),
+ iRemoveWatcher->iStatus );
+ iRemoveWatcher->Watch( operationRemove );
+ CAOUserAfter::AfterLD( KWait_05_secs );
+
+ CleanupStack::PopAndDestroy( newItem );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_mcssettings::UT_SettingsModel_UndefinedText()
+ {
+ TPtrC undefinedT = iModel->AppList()->UndefinedText();
+ EUNIT_ASSERT( &undefinedT != NULL );
+ }
+
+void UT_mcssettings::UT_SettingsContainer_HandleHelpCommandL()
+ {
+ iContainer->HandleHelpCommandL();
+ CAOUserAfter::AfterLD( KWait_05_secs );
+
+ TApaTaskList taskList( CCoeEnv::Static()->WsSession() );
+ TApaTask task = taskList.FindApp( KHlpAppUid );
+
+ EUNIT_ASSERT( task.Exists() );
+
+ if ( task.Exists() )
+ {
+ task.EndTask();
+ }
+ }
+
+
+
+// TEST TABLE
+EUNIT_BEGIN_TEST_TABLE
+ (
+ UT_mcssettings,
+ "MCS plugin settings tests.",
+ "UNIT"
+ )
+
+/*EUNIT_TEST
+ (
+ "Fail",
+ "Settings",
+ "Fail",
+ "FUNCTIONALITY",
+ SetupL, UT_Settings_FailL, Teardown
+ )
+*/
+
+EUNIT_TEST
+ (
+ "NewL",
+ "Settings",
+ "NewL",
+ "FUNCTIONALITY",
+ SetupL, UT_Settings_NewLL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Id",
+ "Settings",
+ "Id",
+ "FUNCTIONALITY",
+ SetupL, UT_Settings_IdL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "DoDeactivate",
+ "Settings",
+ "DoDeactivate",
+ "FUNCTIONALITY",
+ SetupL, UT_Settings_DoDeactivateL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "GetCaptionL",
+ "Settings",
+ "GetCaptionL",
+ "FUNCTIONALITY",
+ SetupL, UT_Settings_GetCaptionLL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "PluginProviderCategory",
+ "Settings",
+ "PluginProviderCategory",
+ "FUNCTIONALITY",
+ SetupL, UT_Settings_PluginProviderCategoryL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Visible",
+ "Settings",
+ "Visible",
+ "FUNCTIONALITY",
+ SetupL, UT_Settings_VisibleL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "NewL",
+ "SettingsAppList",
+ "NewL",
+ "FUNCTIONALITY",
+ SetupAppListL, UT_SettingsAppList_NewLL, TeardownAppList
+ )
+
+EUNIT_TEST
+ (
+ "MdcaCount",
+ "SettingsAppList",
+ "MdcaCount",
+ "FUNCTIONALITY",
+ SetupL, UT_SettingsAppList_MdcaCountL, TeardownAppList
+ )
+
+EUNIT_TEST
+ (
+ "MdcaPoint",
+ "SettingsAppList",
+ "MdcaPointL",
+ "FUNCTIONALITY",
+ SetupAppListL, UT_SettingsAppList_MdcaPointL, TeardownAppList
+ )
+
+EUNIT_TEST
+ (
+ "HandleSessionEventL",
+ "SettingsAppList",
+ "HandleSessionEventL",
+ "FUNCTIONALITY",
+ SetupAppListL, UT_SettingsAppList_HandleSessionEventLL, TeardownAppList
+ )
+
+EUNIT_TEST
+ (
+ "BkmNewL",
+ "SettingsBkmList",
+ "NewL",
+ "FUNCTIONALITY",
+ SetupBkmListL, UT_SettingsBkmList_NewLL, TeardownBkmList
+ )
+
+EUNIT_TEST
+ (
+ "BkmMdcaCount",
+ "SettingsBkmList",
+ "MdcaCount",
+ "FUNCTIONALITY",
+ SetupBkmListL, UT_SettingsBkmList_MdcaCountL, TeardownBkmList
+ )
+
+EUNIT_TEST
+ (
+ "BkmMdcaPoint",
+ "SettingsBkmList",
+ "MdcaPointL",
+ "FUNCTIONALITY",
+ SetupBkmListL, UT_SettingsBkmList_MdcaPointL, TeardownBkmList
+ )
+
+EUNIT_TEST
+ (
+ "IsChangeDialogShowing",
+ "SettingsContainer",
+ "IsChangeDialogShowing",
+ "FUNCTIONALITY",
+ SetupL, UT_SettingsContainer_IsChangeDialogShowingL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "CloseChangeDialog",
+ "SettingsContainer",
+ "CloseChangeDialog",
+ "FUNCTIONALITY",
+ SetupL, UT_SettingsContainer_CloseChangeDialogL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "NewL",
+ "SettingsModel",
+ "NewL",
+ "FUNCTIONALITY",
+ SetupL, UT_SettingsModel_NewLL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "MdcaPoint",
+ "SettingsModel",
+ "MdcaPoint",
+ "FUNCTIONALITY",
+ SetupModelL, UT_SettingsModel_MdcaPointL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "App ItemL",
+ "SettingsAppList",
+ "ItemL",
+ "FUNCTIONALITY",
+ SetupAppListL, UT_SettingsAppList_ItemL, TeardownAppList
+ )
+
+EUNIT_TEST
+ (
+ "App FindItemL",
+ "SettingsAppList",
+ "FindItemL",
+ "FUNCTIONALITY",
+ SetupAppListL, UT_SettingsAppList_FindItemL, TeardownAppList
+ )
+
+EUNIT_TEST
+ (
+ "Bkm ItemL",
+ "SettingsBkmList",
+ "ItemL",
+ "FUNCTIONALITY",
+ SetupBkmListL, UT_SettingsBkmList_ItemL, TeardownBkmList
+ )
+
+EUNIT_TEST
+ (
+ "Bkm FindItemL",
+ "SettingsBkmList",
+ "FindItemL",
+ "FUNCTIONALITY",
+ SetupBkmListL, UT_SettingsBkmList_FindItemL, TeardownBkmList
+ )
+
+EUNIT_TEST
+ (
+ "ResetCurrrentListL",
+ "SettingsContainer",
+ "ResetCurrrentListL",
+ "FUNCTIONALITY",
+ SetupContainerL, UT_SettingsContainer_ResetCurrrentListL, TeardownContainer
+ )
+
+EUNIT_TEST
+ (
+ "HandleCommandL",
+ "Settings",
+ "HandleCommandL",
+ "FUNCTIONALITY",
+ SetupL, UT_Settings_HandleCommandLL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "AppList",
+ "SettingsModel",
+ "AppList",
+ "FUNCTIONALITY",
+ SetupModelL, UT_SettingsModel_AppList, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "BkmList",
+ "SettingsModel",
+ "BkmList",
+ "FUNCTIONALITY",
+ SetupModelL, UT_SettingsModel_BkmList, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "ItemId",
+ "SettingsModel",
+ "ItemId",
+ "FUNCTIONALITY",
+ SetupModelL, UT_SettingsModel_ItemId, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Item",
+ "SettingsModel",
+ "Item",
+ "FUNCTIONALITY",
+ SetupModelL, UT_SettingsModel_Item, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "ReplaceItemL",
+ "SettingsModel",
+ "ReplaceItemL",
+ "FUNCTIONALITY",
+ SetupModelL, UT_SettingsModel_ReplaceItemL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "HandleNotifyL",
+ "SettingsContainer",
+ "HandleNotifyL",
+ "FUNCTIONALITY",
+ SetupContainerL, UT_SettingsContainer_HandleNotifyL, TeardownContainer
+ )
+
+EUNIT_TEST
+ (
+ "MCSMenuItemL",
+ "SettingsBkmList",
+ "MCSMenuItemL",
+ "FUNCTIONALITY",
+ SetupBkmListL, UT_SettingsBkmList_MCSMenuItemL, TeardownBkmList
+ )
+
+EUNIT_TEST
+ (
+ "UndefinedText",
+ "SettingsModel",
+ "UndefinedText",
+ "FUNCTIONALITY",
+ SetupModelL, UT_SettingsModel_UndefinedText, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "HandleHelpCommandL",
+ "SettingsModel",
+ "HandleHelpCommandL",
+ "FUNCTIONALITY",
+ SetupContainerL, UT_SettingsContainer_HandleHelpCommandL, TeardownContainer
+ )
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcssettings/ut_mcssettings.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,212 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __UT_MCSSETTINGS_H__
+#define __UT_MCSSETTINGS_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <apgcli.h> //RApaLsSession
+#include <w32std.h> // For RWsSession
+#include <hscontentpublisher.h>
+#include <mcsmenu.h>
+#include <mcsmenuitem.h>
+
+#include "mcspluginwatcher.h"
+
+// INTERNAL INCLUDES
+
+
+// FORWARD DECLARATIONS
+class CAiScutSettingsItem;
+class CMCSPluginSettings;
+class TMCSPluginParser;
+class MAiAppListObserver;
+class CMCSPluginSettingsContainer;
+class CMCSPluginSettingsAppList;
+class CMCSPluginSettingsBkmList;
+class CMCSPluginSettingsModel;
+class CMCSPluginTargetShutter;
+class CGSPluginInterface;
+class CGSBaseView;
+class CAknView;
+class CAknViewAppUi;
+class CMCSMenu;
+class CActiveSchedulerWait;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( UT_mcssettings ) : public CEUnitTestSuiteClass
+{
+
+enum TBookmarkType
+ {
+ EFavBookmark,
+ EMCSBookmark
+ };
+
+
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_mcssettings* NewL();
+ static UT_mcssettings* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_mcssettings();
+
+private: // Constructors and destructors
+
+ UT_mcssettings();
+ void ConstructL();
+
+public: // From observer interface
+
+
+
+private: // New methods
+
+ void SetupL();
+
+ void SetupAppListL();
+
+ void emptySetup();
+
+ void Teardown();
+
+ void TeardownAppList();
+
+ void UT_Settings_FailL();
+
+ void UT_Settings_NewLL();
+
+ void UT_Settings_IdL();
+
+ void UT_Settings_HandleCommandLL();
+
+ void UT_Settings_DoDeactivateL();
+
+ void UT_Settings_GetCaptionLL();
+
+ void UT_Settings_PluginProviderCategoryL();
+
+ void UT_Settings_VisibleL();
+
+ void UT_SettingsAppList_NewLL();
+
+ void UT_SettingsAppList_MdcaCountL();
+
+ void UT_SettingsAppList_MdcaPointL();
+
+ void UT_SettingsAppList_HandleSessionEventLL();
+
+ void UT_mcssettings::SetupBkmListL();
+
+ void UT_mcssettings::TeardownBkmList();
+
+ void UT_mcssettings::UT_SettingsBkmList_NewLL();
+
+ void UT_mcssettings::UT_SettingsBkmList_MdcaCountL();
+
+ void UT_mcssettings::UT_SettingsBkmList_MdcaPointL();
+
+ void UT_SettingsContainer_CMCSPluginSettingsContainerL();
+
+ void UT_SettingsContainer_IsChangeDialogShowingL();
+
+ void UT_SettingsContainer_CloseChangeDialogL();
+
+ void UT_SettingsModel_NewLL();
+
+ void UT_SettingsModel_MdcaCountL();
+
+ void UT_SettingsModel_MdcaPointL();
+
+ void UT_SettingsModel_ItemL();
+
+ void UT_mcssettings::UT_SettingsModel_BkmListL();
+
+ void UT_SettingsAppList_ItemL();
+
+ void UT_SettingsAppList_FindItemL();
+
+ void UT_SettingsBkmList_ItemL();
+
+ void UT_SettingsBkmList_FindItemL();
+
+ void UT_SettingsContainer_HandleNotifyL();
+
+ void UT_SettingsContainer_ResetCurrrentListL();
+
+ void UT_SettingsModel_BkmList();
+
+ void UT_SettingsModel_AppList();
+
+ void UT_SettingsModel_Item();
+
+ void UT_SettingsModel_ItemId();
+
+ void UT_SettingsModel_ReplaceItemL();
+
+ void SetupModelL();
+
+ void SetupContainerL();
+
+ void TeardownContainer();
+
+ void UT_SettingsBkmList_MCSMenuItemL();
+
+ void UT_SettingsModel_UndefinedText();
+
+ void UT_SettingsContainer_HandleHelpCommandL();
+
+
+private: // Data
+
+ CAknViewAppUi* iAppUi;
+ CGSPluginInterface* iGs;
+ CGSBaseView* iSettingsView;
+ CMCSPluginSettingsModel* iModel;
+ CMCSPluginSettingsContainer* iContainer;
+ CMCSPluginSettingsAppList* iAppList;
+ CMCSPluginSettingsBkmList* iBkmList;
+ TUid iId;
+ RPointerArray<CAiScutSettingsItem> iItemArray;
+ CMCSPluginWatcher* iRemoveWatcher;
+ CMCSPluginWatcher* iSaveWatcher;
+ RMenu iMenu;
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+};
+
+#endif // __UT_MCSSETTINGS_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/mcsplugin/ut_mcssettings/ut_mcssettingsdllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "UT_mcssettings.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_mcssettings::NewL();
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/bwins/UT_aiprofileu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/eabi/UT_aiprofileu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _Z24ImplementationGroupProxyRi @ 2 NONAME
+ _ZTI15ProfileObserver @ 3 NONAME
+ _ZTV15ProfileObserver @ 4 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,29 @@
+/*
+* Copyright (c) 2005-2006 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+ut_aiprofile.mmp
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/group/ut_aiprofile.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,80 @@
+/*
+* Copyright (c) 2005-2006 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET ut_aiprofile.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700afe
+
+CAPABILITY EUNIT_CAPS
+//VENDORID 0x00000000
+
+SOURCEPATH ../ut_aiprofile
+SOURCE ut_aiprofileDllMain.cpp
+SOURCE ut_aiprofile.cpp
+SOURCE profileobserver.cpp
+//SOURCE TampAiprofilepublishercontainer.cpp
+
+// Sources needed by the test
+SOURCEPATH ../../../plugins/profileplugin/src
+SOURCE caiprofileplugin.cpp
+SOURCE caiprofileengine.cpp
+
+USERINCLUDE ../../../plugins/profileplugin/inc
+USERINCLUDE ../../../plugins/profileplugin/src
+USERINCLUDE ../../../inc/common
+USERINCLUDE ../ut_aiprofile
+
+SYSTEMINCLUDE /epoc32/include/internal
+APP_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY avkon.lib
+LIBRARY bafl.lib
+LIBRARY cone.lib
+LIBRARY efsrv.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikcore.lib
+LIBRARY centralrepository.lib
+LIBRARY cenrepnotifhandler.lib // CCenRepNotifyHandler
+LIBRARY gsframework.lib // For base classes
+LIBRARY gslistbox.lib // For CGSListBoxItemTextArray
+LIBRARY gsecomplugin.lib
+LIBRARY commonengine.lib // For RConeResourceLoader
+LIBRARY inetprotutil.lib // For TUriParser
+LIBRARY apgrfx.lib // For RApaLsSession
+LIBRARY apparc.lib // For TApaAppInfo
+LIBRARY msgs.lib // For Message Server
+LIBRARY platformenv.lib // For PathInfo
+LIBRARY hlplch.lib // for HlpLauncher
+LIBRARY featmgr.lib // For feature manager
+LIBRARY favouritesengine.lib
+LIBRARY EUnit.lib
+LIBRARY CdlEngine.lib
+LIBRARY ws32.lib
+LIBRARY aiutils.lib
+LIBRARY sssettings.lib
+LIBRARY profileeng.lib
+LIBRARY profileengine.lib
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/ut_aiprofile/profileobserver.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,321 @@
+/*
+* Copyright (c) 2005-2006 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 <coemain.h>
+#include <f32file.h>
+#include <gulicon.h>
+#include <aicontentmodel.h>
+// #include <aipropertyextension.h>
+
+#include "profileobserver.h"
+//#include "caiplugintesterview.h"
+
+
+const char KAiProfileCaption[] = "ProfileCaption";
+const char KAiProfileIcon[] = "ProfileIcon";
+
+
+// ======== MEMBER FUNCTIONS ========
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+ProfileObserver::ProfileObserver()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void ProfileObserver::ConstructL()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+ProfileObserver* ProfileObserver::NewL()
+{
+ ProfileObserver* self = new(ELeave) ProfileObserver();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ CleanupStack::Pop(self);
+ return self;
+}
+
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+ProfileObserver::~ProfileObserver()
+{
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that it initiates content publishing transaction
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::StartTransaction(TInt aTxId)
+{
+ if (iTransactionId != 0)
+ {
+ //TODO: report error
+ }
+
+ iTransactionId = aTxId;
+ return KErrNone;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to request framework that content publishing is committed
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::Commit(TInt aTxId)
+{
+ TRAPD(err, DoCommitL(aTxId));
+ return err;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by plug-in to indicate that content publishing transaction is cancelled
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::Rollback(TInt aTxId)
+{
+ if (iTransactionId == 0)
+ {
+ //TODO: report error
+ }
+ else if (iTransactionId != aTxId)
+ {
+ //TODO: report error
+ }
+
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+// Invoked by plug-in to test if content can be published.
+// ---------------------------------------------------------------------------
+//
+TBool ProfileObserver::CanPublish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aIndex*/)
+{
+ return EFalse; //ETrue;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be published
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::Publish(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex)
+{
+ TRAPD(err, DoPublishL(aPlugin, aContent, aResource, aIndex));
+ return err;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be published
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex)
+{
+ TRAPD(err, DoPublishL(aPlugin, aContent, aText, aIndex));
+ return err;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be published
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex)
+{
+ TRAPD(err, DoPublishL(aPlugin, aContent, aBuf, aIndex));
+ return err;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be published
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::Publish(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, RFile& /*aFile*/, TInt /*aIndex*/)
+{
+ return KErrNotSupported;
+}
+
+
+// ---------------------------------------------------------------------------
+// Invoked by the plug-in to inform that content must be cleaned in UI
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::Clean(CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aIndex*/)
+{
+ // TODO: clean content.
+ iTransactionId = 0;
+ return 0;
+}
+
+
+// ---------------------------------------------------------------------------
+// Returns interface extension. Not used in Series 60 v3.2 release.
+// ---------------------------------------------------------------------------
+//
+TAny* ProfileObserver::Extension(TUid /*aUid*/)
+{
+ return NULL;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+TBool ProfileObserver::RequiresSubscription( const THsPublisherInfo& /*aPublisherInfo*/ ) const
+{
+ return EFalse;
+}
+
+// ---------------------------------------------------------------------------
+// Leaving version of the publish operation
+// ---------------------------------------------------------------------------
+//
+void ProfileObserver::DoPublishL(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& /*aBuf*/, TInt /*aIndex*/)
+{
+ MAiContentItemIterator* iter = static_cast<MAiContentItemIterator*>(
+ aPlugin.GetProperty( CHsContentPublisher::EPublisherContent ) );
+ TAiContentItem item = iter->ItemL(aContent);
+ /*if (*item.cid == *KAiShortcutIcon && *item.type == *KAiContentTypeBitmap)
+ {
+ CGulIcon* icon = UnpackPtr<CGulIcon>(aBuf);
+ if (icon != NULL)
+ {
+ delete icon;
+ // iView->SetShortcutIconL(aIndex, icon);
+ }
+ else
+ {
+ //TODO report error
+ }
+ }*/
+}
+
+
+// ---------------------------------------------------------------------------
+// Leaving version of the publish operation
+// ---------------------------------------------------------------------------
+//
+void ProfileObserver::DoPublishL(CHsContentPublisher& aPlugin, TInt aContent, TInt /*aResource*/, TInt /*aIndex*/)
+{
+ MAiContentItemIterator* iter = static_cast<MAiContentItemIterator*>(
+ aPlugin.GetProperty( CHsContentPublisher::EPublisherContent ) );
+ TAiContentItem item = iter->ItemL(aContent);
+
+/* Does not work for some reason. substitute with ugly magic numbers
+ if (*item.cid == *KAiShortcutIcon)
+ {
+ iView->SetShortcutIconL(aIndex, aResource);
+ }
+ else if (*item.cid == *KAiShortcutCaption)
+ {
+ iView->SetShortcutCaptionL(aIndex, aResource);
+ }*/
+
+ if (aContent == 0)
+ {
+ // iView->SetShortcutIconL(aIndex, aResource);
+ }
+ else if (aContent == 1)
+ {
+ // iView->SetShortcutCaptionL(aIndex, aResource);
+ }
+
+}
+
+
+// ---------------------------------------------------------------------------
+// Leaving version of the publish operation
+// ---------------------------------------------------------------------------
+//
+void ProfileObserver::DoPublishL(CHsContentPublisher& aPlugin, TInt aContent, const TDesC& /*aText*/, TInt /*aIndex*/)
+{
+ MAiContentItemIterator* iter = static_cast<MAiContentItemIterator*>(
+ aPlugin.GetProperty( CHsContentPublisher::EPublisherContent ) );
+ TAiContentItem item = iter->ItemL(aContent);
+ //if (*item.cid == *KAiShortcutCaption)
+ //{
+ // iView->SetShortcutCaptionL(aIndex, aText);
+ //}
+}
+
+
+// ---------------------------------------------------------------------------
+// Leaving version of the commit operation
+// ---------------------------------------------------------------------------
+//
+void ProfileObserver::DoCommitL(TInt aTxId)
+{
+ if (iTransactionId == 0)
+ {
+ //TODO: report error
+ }
+ else if (iTransactionId != aTxId)
+ {
+ //TODO: report error
+ }
+
+ iTransactionId = 0;
+}
+
+
+// ---------------------------------------------------------------------------
+// SetProperty
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/ )
+{
+ return KErrNone;
+}
+
+// ---------------------------------------------------------------------------
+// SetProperty
+// ---------------------------------------------------------------------------
+//
+TInt ProfileObserver::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/,
+ MAiContentObserver::TValueType /*aValueType*/ )
+{
+ return KErrNone;
+}
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/ut_aiprofile/profileobserver.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,301 @@
+/*
+* Copyright (c) 2005-2006 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:
+*
+*/
+
+
+#ifndef PROFILEOBSERVER_H
+#define PROFILEOBSERVER_H
+
+#include <e32base.h>
+#include <aicontentobserver.h>
+#include <hscontentpublisher.h>
+
+//class CAiPluginTesterView;
+class RFile;
+
+/**
+ *
+ */
+class ProfileObserver : public CBase, public MAiContentObserver
+{
+
+public:
+
+ static ProfileObserver* NewL();
+
+ virtual ~ProfileObserver();
+
+ /**
+ * Invoked by the plug-in to inform that it initiates content publishing
+ * transaction.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is started.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * @since S60 v3.2
+ */
+ TInt StartTransaction(TInt aTxId);
+
+ inline TInt CancelTransaction(TInt /*aTxId*/)
+ {
+ return 10000000000;
+ };
+
+ /**
+ * Invoked by the plug-in to request framework that content publishing
+ * transaction must be finalized and content should be rendered to the
+ * screen.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is over.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * KErrNotFound - transaction with matching id has not been
+ * started.
+ * @since S60 v3.2
+ */
+ TInt Commit(TInt aTxId);
+
+ /**
+ * Invoked by plug-in to indicate that content publishing transaction
+ * must be cancelled.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is cancelled.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * KErrNotFound - transaction with matching id has not been
+ * started.
+ * @since S60 v3.2
+ */
+ TInt Rollback(TInt aTxId);
+
+ /**
+ * Invoked by plug-in to test if content can be published.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aIndex - index of the content item.
+ * @return ETrue - if content could be published.
+ * @since S60 3.2
+ */
+ TBool CanPublish(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that content identified by reference
+ * aResource must be published to UI control\element identified by selector
+ * aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aResource - identification of content reference, MUST correspond
+ * single content reference supported by plug-in. The framework
+ * utilizes the reference if to match for cid and MIME type of the
+ * content supplied with in UI definition.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * @since S60 v3.2
+ */
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that textual content provided within
+ * parameter aText must be published to UI control\element identified by
+ * selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aText - Textual content in UNICODE.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that content provided within buffer
+ * aBuf must be published to UI control\element identified by selector
+ * aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aBuf - instance of content.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that content from file handle aFile
+ * must be published to UI control\element identified by selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aFile - file handle from where content can be obtained by UI
+ * framework.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish(CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex);
+
+ /**
+ * Invoked by the plug-in to inform that content must be cleaned in UI
+ * control\element identified by selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * @since S60 v3.2
+ */
+ TInt Clean(CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex);
+
+ /**
+ * Returns interface extension. Not used in Series 60 3.1 release.
+ *
+ * @param aUid - UID of the extension interface to access.
+ * @return the extension interface. Actual type depends on the passed aUid
+ * argument.
+ * @since S60 v3.2
+ */
+ TAny* Extension(TUid aUid) ;
+
+ /**
+ *
+ */
+ TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const;
+
+ /**
+ *
+ */
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue );
+
+ /**
+ *
+ */
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue,
+ MAiContentObserver::TValueType aValueType);
+
+
+protected:
+
+private:
+
+ ProfileObserver();
+
+ void ConstructL();
+
+ /**
+ * Leaving version of the publish operation
+ *
+ * @since S60 3.1
+ */
+ void DoPublishL(CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex);
+
+ /**
+ * Leaving version of the publish operation
+ *
+ * @since S60 3.1
+ */
+ void DoPublishL(CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex);
+
+ /**
+ * Leaving version of the publish operation
+ *
+ * @since S60 3.1
+ */
+ void DoPublishL(CHsContentPublisher& aPlugin, TInt aContent, const TDesC& aText, TInt aIndex);
+
+ /**
+ * Leaving version of the commit operation
+ *
+ * @since S60 3.1
+ */
+ void DoCommitL(TInt aTxId);
+
+private: // Data
+
+ /**
+ * Transaction id
+ */
+ TInt iTransactionId;
+
+ /**
+ * Flag indicating if transaction is ongoing
+ */
+ TBool iTransactionOngoing;
+
+ /**
+ * Pointer to tester application view
+ * Not own.
+ */
+// CAiPluginTesterView* iView;
+
+};
+
+#endif // OBSERVER_H
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/ut_aiprofile/ut_aiprofile.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,332 @@
+/*
+* Copyright (c) 2005-2006 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "UT_aiprofile.h"
+
+// EXTERNAL INCLUDES
+#define protected public
+#define private public
+#include "caiprofileplugin.h"
+#include "caiprofileengine.h"
+#undef private
+#undef protected
+
+#include <digia/eunit/eunitmacros.h>
+#include <GSPrivatePluginProviderIds.h>
+#include <aknappui.h>
+#include <aknviewappui.h>
+#include <eikenv.h>
+#include <CentralRepository.h>
+#include <apgcli.h> //RApaLsSession
+#include <w32std.h> // For RWsSession
+
+// INTERNAL INCLUDES
+#include <aicontentobserver.h>
+#include <aiutility.h>
+#include <puacodes.hrh>
+
+#include "profileobserver.h"
+#include "aiprofileplugincontentmodel.h"
+#include "aiprofilepluginuids.hrh"
+#include "caiprofileplugin.h"
+#include "caiprofileengine.h"
+#include "aipluginsettings.h"
+
+
+// CONSTRUCTION
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_aiprofile* UT_aiprofile::NewL()
+{
+ UT_aiprofile* self = UT_aiprofile::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_aiprofile* UT_aiprofile::NewLC()
+{
+ UT_aiprofile* self = new(ELeave) UT_aiprofile();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+}
+
+// ---------------------------------------------------------------------------
+// Destructor (virtual by CBase)
+// ---------------------------------------------------------------------------
+//
+UT_aiprofile::~UT_aiprofile()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+UT_aiprofile::UT_aiprofile()
+{
+}
+
+// ---------------------------------------------------------------------------
+// Second phase construct
+// ---------------------------------------------------------------------------
+//
+void UT_aiprofile::ConstructL()
+{
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+}
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_aiprofile::SetupL()
+{
+ _LIT( KProfilePluginName, "profileplugin" );
+
+ _LIT8( KNameSpace, "1" );
+ TUid uid = { AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PROFILEPLUGIN };
+ THsPublisherInfo pubInfo( uid, KProfilePluginName, KNameSpace );
+
+ CHsContentPublisher* pubType = CHsContentPublisher::NewL( pubInfo );
+ iProfilePlugin = static_cast<CAiProfilePlugin*>( pubType );
+
+ // iProfilePlugin = CHsContentPublisher::NewL( pubInfo );
+ EUNIT_ASSERT( iProfilePlugin );
+
+ iContentObserver = ProfileObserver::NewL();
+
+ RAiSettingsItemArray settings;
+ iProfilePlugin->ConfigureL( settings );
+
+ iProfilePlugin->SubscribeL( *iContentObserver );
+ iProfilePlugin->Start( CHsContentPublisher::ESystemStartup );
+
+ iProfilePlugin->Resume( CHsContentPublisher::EForeground );
+
+/*
+// iGs = CGSPluginInterface::NewL(TUid::Uid(AI_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_PROFILEPLUGIN), NULL);
+ iProfilePlugin = CAiProfilePlugin::NewL();
+ EUNIT_ASSERT(iProfilePlugin);
+ iContentObserver = iContentObserver->NewL();
+ EUNIT_ASSERT(iContentObserver);
+ iProfilePlugin->SubscribeL( *iContentObserver );
+*/
+}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_aiprofile::Teardown()
+{
+ if( iProfilePlugin )
+ {
+ iProfilePlugin->Stop( CHsContentPublisher::ESystemShutdown );
+ delete iProfilePlugin;
+ iProfilePlugin = NULL;
+ }
+
+ delete iContentObserver;
+}
+
+
+//-------------------------------------------------------------------------------------------
+// Tests for CAiProfilePlugin
+//-------------------------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_aiprofile::UT_resumeL()
+{
+ iProfilePlugin->Suspend( CHsContentPublisher::EBackground );
+ iProfilePlugin->Resume( CHsContentPublisher::EForeground );
+
+ iProfilePlugin->Suspend(CHsContentPublisher::EBackupRestore );
+ iProfilePlugin->Resume( CHsContentPublisher::EForeground );
+
+ iProfilePlugin->Suspend(CHsContentPublisher::EGeneralThemeChange );
+ iProfilePlugin->Resume( CHsContentPublisher::EForeground );
+
+ iProfilePlugin->Suspend( CHsContentPublisher::EBackground );
+}
+
+void UT_aiprofile::UT_HandleEventL()
+{
+
+ iProfilePlugin->HandleEvent(EAiProfileEventSwitchByName, KNullDesC);
+
+ iProfilePlugin->Resume( CHsContentPublisher::EForeground );
+ iProfilePlugin->HandleEvent(EAiProfileEventSwitchByName, KNullDesC);
+
+ iProfilePlugin->HandleEvent(EAiProfileEventSwitchByName, _L("Silent"));
+ iProfilePlugin->iEngine->UpdateProfileNamesL();
+ EUNIT_ASSERT_EQUALS( iProfilePlugin->iEngine->ActiveProfileName(), _L("Silent") );
+
+ //EUNIT_ASSERT_EQUALS(iProfilePlugin->iEngine->IsActiveProfileSilentL(), 1);
+
+ //iProfilePlugin->iEngine->SetActiveProfileNameL( _L("Silent") );
+ //EUNIT_ASSERT_EQUALS(iProfilePlugin->iEngine->ActiveProfileName(),_L("Silent"));
+
+ //iProfilePlugin->iEngine->SetSwapProfileNameL(_L("General"));
+ //EUNIT_ASSERT_EQUALS(iProfilePlugin->iEngine->SwapProfileName(),_L("General"));
+
+ iProfilePlugin->HandleEvent(EAiProfileEventSwitchByIndex, _L("0"));
+ //EUNIT_ASSERT_EQUALS(iProfilePlugin->iEngine->IsActiveProfileSilentL(), 0);
+ //EUNIT_ASSERT_EQUALS(_L("Silent"),iProfilePlugin->iEngine->ActiveProfileName());
+
+ iProfilePlugin->HandleEvent(EAiProfileEventSwap, _L("1"));
+ //EUNIT_ASSERT_EQUALS(iProfilePlugin->iEngine->IsActiveProfileSilentL(), 1);
+
+ iProfilePlugin->HandleEvent(EAiProfileEventSwap, _L("0"));
+ //EUNIT_ASSERT_EQUALS(iProfilePlugin->iEngine->IsActiveProfileSilentL(), 0);
+
+ iProfilePlugin->iEngine->ProfileNameByIndex( 0 );
+
+ iProfilePlugin->iEngine->SwapProfileName();
+
+ /*
+ EUNIT_ASSERT_NO_LEAVE(iProfilePlugin->iEngine->
+ HandleActiveProfileEventL(EProfileNewActiveProfile, 0));
+ */
+// iProfilePlugin->iEngine->ShowOfflineMessageL();
+
+}
+
+void UT_aiprofile::UT_NotifyContentUpdateL()
+{
+ iProfilePlugin->Resume( CHsContentPublisher::EForeground );
+
+ iProfilePlugin->iEngine->PhoneSettingChanged(ESSSettingsCug,1);
+
+ iProfilePlugin->iEngine->PhoneSettingChanged(ESSSettingsAls, 1);
+}
+
+
+void UT_aiprofile::UT_ExtensionL()
+{
+ /*
+ iProfilePlugin->Resume( CHsContentPublisher::EForeground );
+
+ TAny* anyPtr = NULL;
+
+ EUNIT_ASSERT_NO_LEAVE(anyPtr = iProfilePlugin->Extension(KExtensionUidEventHandler));
+
+ EUNIT_ASSERT_NO_LEAVE(anyPtr = iProfilePlugin->Extension(KExtensionUidProperty));
+
+ TUid wrongUid = { 0x3 };
+
+ EUNIT_ASSERT(!iProfilePlugin->Extension(wrongUid));
+
+ MAiPropertyExtension* propertyExtension = static_cast<MAiPropertyExtension*>(anyPtr);
+ EUNIT_ASSERT(propertyExtension);
+
+ EUNIT_ASSERT_NO_LEAVE(anyPtr = propertyExtension->GetPropertyL(EAiPublisherInfo));
+ EUNIT_ASSERT(anyPtr != NULL);
+
+ EUNIT_ASSERT_NO_LEAVE(anyPtr = propertyExtension->GetPropertyL(EAiPublisherContent));
+ EUNIT_ASSERT(anyPtr);
+
+ // Discover resources
+ EUNIT_ASSERT_NO_LEAVE(anyPtr = propertyExtension->GetPropertyL(EAiPublisherResources));
+ EUNIT_ASSERT(anyPtr);
+
+ // Discover event iterator
+ EUNIT_ASSERT_NO_LEAVE(anyPtr = propertyExtension->GetPropertyL(EAiPublisherEvents));
+ EUNIT_ASSERT(anyPtr);
+
+ EUNIT_ASSERT_NO_LEAVE(anyPtr = propertyExtension->GetPropertyL(-1));
+ EUNIT_ASSERT(!anyPtr);
+
+ //iProfilePlugin->Stop(EAiSystemStartup);
+ */
+}
+
+
+void UT_aiprofile::UT_ConfigureLL()
+{
+ RAiSettingsItemArray defaultSettingArray;
+
+ // Profiles settings view
+ AddSettingL(defaultSettingArray, 0x00000001, _L("localapp:0x100058F8?view=0x02"));
+ EUNIT_ASSERT_NO_LEAVE(iProfilePlugin->ConfigureL(defaultSettingArray));
+
+ iProfilePlugin->Resume( CHsContentPublisher::EForeground );
+ EUNIT_ASSERT_NO_LEAVE(iProfilePlugin->PublishL());
+ iProfilePlugin->Suspend(CHsContentPublisher::EBackground );
+
+}
+
+void UT_aiprofile::AddSettingL(RAiSettingsItemArray& aArray, const TInt32 aKey, const TDesC& aValue)
+{
+ MAiPluginSettings* setting = AiUtility::CreatePluginSettingsL();
+ if (aArray.Append(setting) == KErrNone)
+ {
+ MAiPluginSettingsItem& item = setting->AiPluginSettingsItem();
+ item.SetKey(aKey);
+ item.SetValueL(aValue);
+ }
+ else
+ {
+ delete setting;
+ }
+}
+
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(UT_aiprofile, "Profile plugin tests.", "UNIT")
+
+EUNIT_TEST( "Resume", "CAiProfilePlugin", "resume",
+ "FUNCTIONALITY", SetupL, UT_resumeL, Teardown)
+/*
+EUNIT_TEST( "SetPropertyL", "CAiProfilePlugin", "SetPropertyL",
+ "FUNCTIONALITY", SetupL, UT_SetPropertyLL, Teardown)
+*/
+EUNIT_TEST( "HandleEventL", "CAiProfilePlugin", "HandleEventL",
+ "FUNCTIONALITY", SetupL, UT_HandleEventL, Teardown)
+
+EUNIT_TEST( "NotifyContentUpdate", "CAiProfilePlugin", "NotifyContentUpdate",
+ "FUNCTIONALITY", SetupL, UT_NotifyContentUpdateL, Teardown)
+
+EUNIT_TEST( "Extension", "CAiProfilePlugin", "Extension",
+ "FUNCTIONALITY", SetupL, UT_ExtensionL, Teardown)
+
+EUNIT_TEST( "ConfigureL", "CAiProfilePlugin", "ConfigureL",
+ "FUNCTIONALITY", SetupL, UT_ConfigureLL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/ut_aiprofile/ut_aiprofile.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,95 @@
+/*
+* Copyright (c) 2005-2006 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:
+*
+*/
+
+
+#ifndef __UT_AIPROFILE_H__
+#define __UT_AIPROFILE_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <apgcli.h> //RApaLsSession
+#include <w32std.h> // For RWsSession
+
+// INTERNAL INCLUDES
+#include <hscontentpublisher.h>
+
+// FORWARD DECLARATIONS
+class CAiProfileEngine;
+class CAiProfilePlugin;
+class CAiContentPublisher;
+class ProfileObserver;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( UT_aiprofile ) : public CEUnitTestSuiteClass
+{
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_aiprofile* NewL();
+ static UT_aiprofile* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_aiprofile();
+
+private: // Constructors and destructors
+
+ UT_aiprofile();
+ void ConstructL();
+
+public: // From observer interface
+
+
+
+private: // New methods
+
+ void SetupL();
+ void Teardown();
+ void UT_resumeL();
+ // void UT_SetPropertyLL();
+ void UT_HandleEventL();
+ void UT_NotifyContentUpdateL();
+ void UT_ExtensionL();
+ void UT_ConfigureLL();
+ void AddSettingL(RAiSettingsItemArray& aArray, const TInt32 aKey, const TDesC& aValue);
+
+private: // Data
+
+ CAiProfilePlugin* iProfilePlugin;
+ // CHsContentPublisher* iProfilePlugin;
+
+ EUNIT_DECLARE_TEST_TABLE;
+ ProfileObserver* iContentObserver;
+
+
+};
+
+#endif // __UT_AIPROFILE_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/profileplugin/ut_aiprofile/ut_aiprofiledllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2005-2006 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "UT_aiprofile.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_aiprofile::NewL();
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/bwins/mt_sapidatapluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/bwins/ut_sapidataobserveru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/bwins/ut_sapidatapluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/bwins/ut_sapidatau.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+ ?ImplementationGroupProxy@@YAPBUTImplementationProxy@@AAH@Z @ 2 NONAME ; struct TImplementationProxy const * ImplementationGroupProxy(int &)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/common/interface.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,85 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+// Class header
+#include "interface.h"
+
+// External includes
+//#include <coemain.h>
+//#include <f32file.h>
+//#include <gulicon.h>
+//#include <aicontentmodel.h>
+
+//const char KAiShortcutCaption[] = "ShortcutCaption";
+//const char KAiShortcutIcon[] = "ShortcutIcon";
+
+// ======== MEMBER FUNCTIONS ========
+
+//---------------------------------------------------------------------------
+// Interface_EU::Interface_EU()
+//---------------------------------------------------------------------------
+//
+Interface_EU::Interface_EU()
+ {
+ }
+
+//---------------------------------------------------------------------------
+// void Interface_EU::ConstructL()
+//---------------------------------------------------------------------------
+//
+void Interface_EU::ConstructL()
+ {
+ }
+
+//---------------------------------------------------------------------------
+// Interface_EU* Interface_EU::NewL()
+//---------------------------------------------------------------------------
+//
+Interface_EU* Interface_EU::NewL()
+ {
+ Interface_EU* self = new( ELeave ) Interface_EU();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//---------------------------------------------------------------------------
+// Interface_EU::~Interface_EU()
+//---------------------------------------------------------------------------
+//
+Interface_EU::~Interface_EU()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// void Interface_EU::ExecuteCmdL(const TDesC8& aCmdName, const CLiwGenericParamList& aInParamList, CLiwGenericParamList& aOutParamList, TUint aCmdOptions = 0, MLiwNotifyCallback* aCallback = 0);
+// ---------------------------------------------------------------------------
+//
+void Interface_EU::ExecuteCmdL(const TDesC8& /*aCmdName*/,
+ const CLiwGenericParamList& /*aInParamList*/,
+ CLiwGenericParamList& /*aOutParamList*/,
+ TUint /*aCmdOptions*/,
+ MLiwNotifyCallback* /*aCallback*/)
+ {
+ }
+
+void Interface_EU::Close()
+ {
+ }
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/common/interface.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,53 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+#ifndef __INTERFACE_EU_H__
+#define __INTERFACE_EU_H__
+
+// External includes
+#include <e32base.h>
+#include <liwvariant.h>
+
+/**
+ * Observer class
+ */
+class Interface_EU : public CBase,
+ public MLiwInterface
+ {
+public:
+ static Interface_EU* NewL();
+
+ ~Interface_EU();
+
+ void ExecuteCmdL(const TDesC8& aCmdName,
+ const CLiwGenericParamList& aInParamList,
+ CLiwGenericParamList& aOutParamList,
+ TUint aCmdOptions = 0,
+ MLiwNotifyCallback* aCallback = 0);
+
+ void Close();
+
+protected:
+ void ConstructL();
+
+private:
+ Interface_EU();
+ };
+
+#endif // __INTERFACE_EU_H__
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/common/observer.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,247 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+// Class header
+#include "observer.h"
+
+// External includes
+#include <coemain.h>
+#include <f32file.h>
+#include <gulicon.h>
+#include <aicontentmodel.h>
+
+const char KAiShortcutCaption[] = "ShortcutCaption";
+const char KAiShortcutIcon[] = "ShortcutIcon";
+
+// ======== MEMBER FUNCTIONS ========
+
+//---------------------------------------------------------------------------
+// Observer::Observer()
+//---------------------------------------------------------------------------
+//
+Observer::Observer()
+ {
+ }
+
+//---------------------------------------------------------------------------
+// void Observer::ConstructL()
+//---------------------------------------------------------------------------
+//
+void Observer::ConstructL()
+ {
+ }
+
+//---------------------------------------------------------------------------
+// Observer* Observer::NewL()
+//---------------------------------------------------------------------------
+//
+Observer* Observer::NewL()
+ {
+ Observer* self = new( ELeave ) Observer();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+//---------------------------------------------------------------------------
+// Observer::~Observer()
+//---------------------------------------------------------------------------
+//
+Observer::~Observer()
+ {
+ }
+
+//---------------------------------------------------------------------------
+// TInt Observer::StartTransaction()
+//---------------------------------------------------------------------------
+//
+TInt Observer::StartTransaction( TInt aTxId )
+ {
+ if ( iTransactionId != 0 )
+ {
+ //TODO: report error
+ }
+ iTransactionId = aTxId;
+ return KErrNone;
+ }
+
+
+//---------------------------------------------------------------------------
+// TInt Observer::Commit()
+//---------------------------------------------------------------------------
+//
+TInt Observer::Commit( TInt aTxId )
+ {
+ TRAPD( err, DoCommitL( aTxId ) );
+ return err;
+ }
+
+//---------------------------------------------------------------------------
+// TInt Observer::Rollback()
+//---------------------------------------------------------------------------
+//
+TInt Observer::Rollback( TInt aTxId )
+ {
+ if ( iTransactionId == 0 )
+ {
+ //TODO: report error
+ }
+ else if ( iTransactionId != aTxId )
+ {
+ //TODO: report error
+ }
+ return KErrNone;
+ }
+
+//---------------------------------------------------------------------------
+// TBool Observer::CanPublish()
+//---------------------------------------------------------------------------
+//
+TBool Observer::CanPublish( CHsContentPublisher& /*aPlugin*/,
+ TInt /*aContent*/, TInt /*aIndex*/ )
+ {
+ return ETrue;
+ }
+
+//---------------------------------------------------------------------------
+// TInt Observer::Publish()
+//---------------------------------------------------------------------------
+//
+TInt Observer::Publish( CHsContentPublisher& /*aPlugin*/,
+ TInt /*aContent*/, TInt /*aResource*/, TInt /*aIndex*/ )
+ {
+ //TRAPD( err, DoPublishL( aPlugin, aContent, aResource, aIndex ) );
+ TInt err( KErrNone );
+ return err;
+ }
+
+
+//---------------------------------------------------------------------------
+// TInt Observer::Publish()
+//---------------------------------------------------------------------------
+//
+TInt Observer::Publish( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/,
+ const TDesC16& /*aText*/, TInt /*aIndex*/ )
+ {
+ //TRAPD( err, DoPublishL( aPlugin, aContent, aText, aIndex ) );
+ TInt err( KErrNone );
+ return err;
+ }
+
+
+//---------------------------------------------------------------------------
+// TInt Observer::Publish()
+//---------------------------------------------------------------------------
+//
+TInt Observer::Publish( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/,
+ const TDesC8& aBuf, TInt /*aIndex*/ )
+ {
+ CGulIcon* icon = UnpackPtr<CGulIcon>( aBuf );
+ if (icon != NULL)
+ {
+ delete icon;
+ }
+ else
+ {
+ //TODO report error
+ }
+ return KErrNone;
+ }
+
+//---------------------------------------------------------------------------
+// TInt Observer::Publish()
+//---------------------------------------------------------------------------
+//
+TInt Observer::Publish( CHsContentPublisher& /*aPlugin*/,
+ TInt /*aContent*/, RFile& /*aFile*/, TInt /*aIndex*/ )
+ {
+ return KErrNotSupported;
+ }
+
+//---------------------------------------------------------------------------
+// TInt Observer::Clean()
+//---------------------------------------------------------------------------
+//
+TInt Observer::Clean( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/,
+ TInt /*aIndex*/ )
+ {
+ // TODO: clean content.
+ iTransactionId = 0;
+ return 0;
+ }
+
+//---------------------------------------------------------------------------
+// TAny* Observer::Extension()
+//---------------------------------------------------------------------------
+//
+TAny* Observer::Extension( TUid /*aUid*/ )
+ {
+ return NULL;
+ }
+
+//---------------------------------------------------------------------------
+// TBool Observer::RequiresSubscription()
+//---------------------------------------------------------------------------
+//
+TBool Observer::RequiresSubscription(
+ const THsPublisherInfo& /*aPublisherInfo*/ ) const
+ {
+ return EFalse;
+ }
+
+
+//---------------------------------------------------------------------------
+// void Observer::DoCommitL()
+//---------------------------------------------------------------------------
+//
+void Observer::DoCommitL( TInt aTxId )
+ {
+ if ( iTransactionId == 0 )
+ {
+ //TODO: report error
+ }
+ else if ( iTransactionId != aTxId )
+ {
+ //TODO: report error
+ }
+ iTransactionId = 0;
+ }
+
+//---------------------------------------------------------------------------
+// TInt Observer::SetProperty()
+//---------------------------------------------------------------------------
+//
+TInt Observer::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/, const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/ )
+ {
+ return KErrNone;
+ }
+
+// ---------------------------------------------------------------------------
+// TInt Observer::SetProperty()
+// ---------------------------------------------------------------------------
+//
+TInt Observer::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/, const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/,
+ MAiContentObserver::TValueType /*aValueType*/ )
+ {
+ return KErrNone;
+ }
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/common/observer.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,276 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+#ifndef __OBSERVER_H__
+#define __OBSERVER_H__
+
+// External includes
+#include <e32base.h>
+#include <aicontentobserver.h>
+#include <hscontentpublisher.h>
+
+class RFile;
+
+/**
+ * Observer class
+ */
+class Observer : public CBase,
+ public MAiContentObserver
+ {
+public:
+
+ static Observer* NewL();
+
+ virtual ~Observer();
+
+ /**
+ * Invoked by the plug-in to inform that it initiates content publishing
+ * transaction.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is started.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * @since S60 v3.2
+ */
+ TInt StartTransaction( TInt aTxId );
+
+ inline TInt CancelTransaction( TInt /*aTxId*/ )
+ {
+ return 10000000000;
+ };
+
+ /**
+ * Invoked by the plug-in to request framework that content publishing
+ * transaction must be finalized and content should be rendered to the
+ * screen.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is over.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * KErrNotFound - transaction with matching id has not been
+ * started.
+ * @since S60 v3.2
+ */
+ TInt Commit( TInt aTxId );
+
+ /**
+ * Invoked by plug-in to indicate that content publishing transaction
+ * must be cancelled.
+ *
+ * @param aTxId - transaction Id
+ * @return KErrNone - transaction is cancelled.
+ * KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * KErrNotFound - transaction with matching id has not been
+ * started.
+ * @since S60 v3.2
+ */
+ TInt Rollback( TInt aTxId );
+
+ /**
+ * Invoked by plug-in to test if content can be published.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aIndex - index of the content item.
+ * @return ETrue - if content could be published.
+ * @since S60 3.2
+ */
+ TBool CanPublish( CHsContentPublisher& aPlugin, TInt aContent,
+ TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that content identified by reference
+ * aResource must be published to UI control\element identified by selector
+ * aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aResource - identification of content reference, MUST correspond
+ * single content reference supported by plug-in. The framework
+ * utilizes the reference if to match for cid and MIME type of the
+ * content supplied with in UI definition.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * @since S60 v3.2
+ */
+ TInt Publish( CHsContentPublisher& aPlugin, TInt aContent,
+ TInt aResource, TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that textual content provided within
+ * parameter aText must be published to UI control\element identified by
+ * selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aText - Textual content in UNICODE.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish( CHsContentPublisher& aPlugin, TInt aContent,
+ const TDesC16& aText, TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that content provided within buffer
+ * aBuf must be published to UI control\element identified by selector
+ * aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aBuf - instance of content.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish( CHsContentPublisher& aPlugin, TInt aContent,
+ const TDesC8& aBuf, TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that content from file handle aFile
+ * must be published to UI control\element identified by selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aFile - file handle from where content can be obtained by UI
+ * framework.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ * @since S60 v3.2
+ */
+ TInt Publish( CHsContentPublisher& aPlugin, TInt aContent,
+ RFile& aFile, TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that content must be cleaned in UI
+ * control\element identified by selector aContent.
+ *
+ * @param aPlugin - Plug-in property extension interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aIndex - index of the content item.
+ * @return KErrNone - if content is published.
+ * KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * @since S60 v3.2
+ */
+ TInt Clean( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex );
+
+ /**
+ * Returns interface extension. Not used in Series 60 3.1 release.
+ *
+ * @param aUid - UID of the extension interface to access.
+ * @return the extension interface. Actual type depends on the passed aUid
+ * argument.
+ * @since S60 v3.2
+ */
+ TAny* Extension( TUid aUid ) ;
+
+ /**
+ *
+ */
+ TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const;
+
+ /**
+ *
+ */
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue );
+
+ /**
+ *
+ */
+ TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue,
+ MAiContentObserver::TValueType aValueType );
+
+protected:
+
+private:
+
+ Observer();
+
+ void ConstructL();
+
+ /**
+ * Leaving version of the commit operation
+ *
+ * @since S60 3.1
+ */
+ void DoCommitL( TInt aTxId );
+
+private: // Data
+
+ /**
+ * Transaction id
+ */
+ TInt iTransactionId;
+
+ /**
+ * Flag indicating if transaction is ongoing
+ */
+ TBool iTransactionOngoing;
+ };
+
+#endif // __OBSERVER_H__
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/eabi/mt_sapidatapluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _ZTI8Observer @ 2 NONAME
+ _ZTV8Observer @ 3 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/eabi/ut_sapidataobserveru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,6 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _Z24ImplementationGroupProxyRi @ 2 NONAME
+ _ZTI12Interface_EU @ 3 NONAME
+ _ZTV12Interface_EU @ 4 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/eabi/ut_sapidatapluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,4 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _Z24ImplementationGroupProxyRi @ 2 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/eabi/ut_sapidatau.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,8 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _Z24ImplementationGroupProxyRi @ 2 NONAME
+ _ZTI5MTest @ 3 NONAME
+ _ZTI8Observer @ 4 NONAME
+ _ZTV5MTest @ 5 NONAME
+ _ZTV8Observer @ 6 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,35 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+
+PRJ_TESTMMPFILES
+mt_sapidataplugin.mmp
+ut_sapidataplugin.mmp
+ut_sapidata.mmp
+ut_sapidataobserver.mmp
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/group/mt_sapidataplugin.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2009 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+MACRO _SAPIDATAPLUGIN_TEST
+
+TARGET mt_sapidataplugin.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700bf0
+
+CAPABILITY EUNIT_CAPS
+
+SOURCEPATH ../mt_sapidataplugin
+SOURCE mt_sapidataplugindllmain.cpp
+SOURCE mt_sapidataplugin.cpp
+SOURCEPATH ../common
+SOURCE observer.cpp
+
+SOURCEPATH ../stub/src
+SOURCE aicpscommandbuffer_stub.cpp
+USERINCLUDE ../../../inc/common
+
+SOURCEPATH ../../../src/framework
+SOURCE aicpsexecuteparam.cpp
+
+SOURCEPATH ../../../plugins/sapidataplugin/src
+SOURCE sapidata.cpp
+SOURCE sapidataplugin.cpp
+SOURCE sapidataobserver.cpp
+
+USERINCLUDE ../mt_sapidataplugin
+USERINCLUDE ../../../inc/common
+USERINCLUDE ../stub/inc
+USERINCLUDE ../../../inc/framework
+USERINCLUDE ../common
+
+SYSTEMINCLUDE ../../../plugins/mcsplugin/commoninc
+SYSTEMINCLUDE ../../../plugins/mcsplugin/publisher/inc
+SYSTEMINCLUDE ../../../plugins/mcsplugin/data
+
+SYSTEMINCLUDE ../../../plugins/sapidataplugin/inc
+SYSTEMINCLUDE ../../../plugins/sapidataplugin/data
+SYSTEMINCLUDE ../../../inc/utility
+SYSTEMINCLUDE /epoc32/include/ecom
+SYSTEMINCLUDE /epoc32/include/internal // for gsprivatepluginproviderids.h
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY eikdlg.lib
+LIBRARY aiutils.lib
+LIBRARY EUnit.lib
+LIBRARY EUnitUtil.lib
+LIBRARY euser.lib
+LIBRARY apparc.lib
+LIBRARY cone.lib
+LIBRARY eikcore.lib
+LIBRARY avkon.lib
+LIBRARY commonengine.lib
+LIBRARY efsrv.lib
+LIBRARY estor.lib
+LIBRARY ecom.lib
+LIBRARY eikcoctl.lib
+LIBRARY eikctl.lib
+LIBRARY bafl.lib
+LIBRARY apgrfx.lib
+LIBRARY egul.lib
+LIBRARY fbscli.lib
+LIBRARY aknskins.lib
+LIBRARY aknicon.lib
+LIBRARY centralrepository.lib
+LIBRARY msgs.lib
+LIBRARY ws32.lib
+LIBRARY GSEcomPlugin.lib
+LIBRARY cenrepnotifhandler.lib // CCenRepNotifyHandler
+LIBRARY gsframework.lib // For base classes
+LIBRARY gslistbox.lib // For CGSListBoxItemTextArray
+LIBRARY inetprotutil.lib // For TUriParser
+LIBRARY platformenv.lib // For PathInfo
+LIBRARY hlplch.lib // for HlpLauncher
+LIBRARY featmgr.lib // For feature manager
+LIBRARY hspluginsettings.lib
+LIBRARY liwServiceHandler.lib
+LIBRARY charconv.lib
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/group/ut_sapidata.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,71 @@
+/*
+* Copyright (c) 2010 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET ut_sapidata.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700b02
+
+CAPABILITY EUNIT_CAPS
+//VENDORID 0x00000000
+
+SOURCEPATH ../ut_sapidata
+SOURCE ut_sapidatadllmain.cpp
+SOURCE ut_sapidata.cpp
+
+// Sources needed by the test
+SOURCEPATH ../../../plugins/sapidataplugin/src
+SOURCE sapidata.cpp
+SOURCE sapidataplugin.cpp
+SOURCE sapidataobserver.cpp
+
+SOURCEPATH ../common
+SOURCE observer.cpp
+
+USERINCLUDE ../../../plugins/sapidataplugin/inc
+USERINCLUDE ../../../plugins/sapidataplugin/data
+USERINCLUDE ../../../inc/common
+USERINCLUDE ../ut_sapidata
+USERINCLUDE ../common
+
+SYSTEMINCLUDE /epoc32/include/Digia/EUnit
+SYSTEMINCLUDE /epoc32/include/internal
+APP_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY EUnit.lib
+LIBRARY euser.lib
+LIBRARY bafl.lib
+LIBRARY efsrv.lib
+LIBRARY liwservicehandler.lib
+LIBRARY ecom.lib
+LIBRARY aiutils.lib
+LIBRARY cone.lib
+LIBRARY avkon.lib
+LIBRARY fbscli.lib
+LIBRARY egul.lib
+LIBRARY aknskins.lib
+LIBRARY charconv.lib
+LIBRARY estor.lib
+// Debugging dependencies
+LIBRARY flogger.lib
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/group/ut_sapidataobserver.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,70 @@
+/*
+* Copyright (c) 2010 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET ut_sapidataobserver.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700b01
+
+CAPABILITY EUNIT_CAPS
+//VENDORID 0x00000000
+
+SOURCEPATH ../common
+SOURCE interface.cpp
+
+SOURCEPATH ../ut_sapidataobserver
+SOURCE ut_sapidataobserverdllmain.cpp
+SOURCE ut_sapidataobserver.cpp
+
+// Sources needed by the test
+SOURCEPATH ../../../plugins/sapidataplugin/src
+SOURCE sapidata.cpp
+SOURCE sapidataplugin.cpp
+SOURCE sapidataobserver.cpp
+
+USERINCLUDE ../../../plugins/sapidataplugin/inc
+USERINCLUDE ../../../plugins/sapidataplugin/data
+USERINCLUDE ../../../inc/common
+USERINCLUDE ../ut_sapidataplugin
+USERINCLUDE ../common
+
+SYSTEMINCLUDE /epoc32/include/internal
+APP_LAYER_SYSTEMINCLUDE
+
+
+LIBRARY EUnit.lib
+LIBRARY euser.lib
+LIBRARY bafl.lib
+LIBRARY efsrv.lib
+LIBRARY liwservicehandler.lib
+LIBRARY ecom.lib
+LIBRARY aiutils.lib
+LIBRARY cone.lib
+LIBRARY avkon.lib
+LIBRARY fbscli.lib
+LIBRARY egul.lib
+LIBRARY aknskins.lib
+LIBRARY charconv.lib
+LIBRARY estor.lib
+// Debugging dependencies
+LIBRARY flogger.lib
+
+// End of File.
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/group/ut_sapidataplugin.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,69 @@
+/*
+* Copyright (c) 2010 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+
+TARGET ut_sapidataplugin.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700b01
+
+CAPABILITY EUNIT_CAPS
+//VENDORID 0x00000000
+
+SOURCEPATH ../ut_sapidataplugin
+SOURCE ut_sapidataplugindllmain.cpp
+SOURCE ut_sapidataplugin.cpp
+SOURCEPATH ../common
+SOURCE observer.cpp
+
+// Sources needed by the test
+SOURCEPATH ../../../plugins/sapidataplugin/src
+SOURCE sapidata.cpp
+SOURCE sapidataplugin.cpp
+SOURCE sapidataobserver.cpp
+
+USERINCLUDE ../ut_sapidataplugin
+USERINCLUDE ../common
+USERINCLUDE ../../../plugins/sapidataplugin/inc
+USERINCLUDE ../../../plugins/sapidataplugin/data
+USERINCLUDE ../../../inc/common
+
+SYSTEMINCLUDE /epoc32/include/internal
+APP_LAYER_SYSTEMINCLUDE
+LIBRARY EUnit.lib
+LIBRARY euser.lib
+LIBRARY bafl.lib
+LIBRARY efsrv.lib
+LIBRARY liwservicehandler.lib
+LIBRARY ecom.lib
+LIBRARY aiutils.lib
+LIBRARY cone.lib
+LIBRARY avkon.lib
+LIBRARY fbscli.lib
+LIBRARY egul.lib
+LIBRARY aknskins.lib
+LIBRARY charconv.lib
+LIBRARY estor.lib
+// Debugging dependencies
+LIBRARY flogger.lib
+
+// End of File.
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/mt_sapidataplugin/caouserafter.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,91 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __CAOUSERAFTER_H__
+#define __CAOUSERAFTER_H__
+
+// INCLUDES
+#include <E32base.h>
+#include <E32svr.h>
+#include <CoeMain.h>
+
+
+/**
+ * Active object version of User::After()
+ */
+class CAOUserAfter : public CTimer
+ {
+ private:
+ CActiveSchedulerWait iWait;
+ TInt iLength;
+
+
+ public: //new functions
+
+ /**
+ * Constructs the waiting timer, executes
+ * it and when timer expires, deletes self.
+ * @param aLength The lenghth of wait in micro
+ * seconds.
+ */
+ static void AfterLD( TInt aLenght )
+ {
+ CAOUserAfter* wait= new ( ELeave ) CAOUserAfter( aLenght );
+ CleanupStack::PushL( wait );
+ wait->ConstructL();
+ CleanupStack::Pop();
+
+ RDebug::Print( _L("CAOUserAfter - Starting time consuming...") );
+ wait->StartWaitD();
+ RDebug::Print( _L("CAOUserAfter - completed.") );
+ }
+
+ private:
+ CAOUserAfter( TInt aLenght )
+ : CTimer( CActive::EPriorityStandard ),
+ iLength( aLenght )
+ {
+ }
+
+ void ConstructL()
+ {
+ CTimer::ConstructL();
+ CActiveScheduler::Add( this );
+ }
+
+ virtual ~CAOUserAfter()
+ {
+ }
+
+ void StartWaitD()
+ {
+ After( iLength );
+ iWait.Start();
+ }
+
+ void RunL()
+ {
+ iWait.AsyncStop();
+ Cancel();
+ delete this;
+ }
+ };
+
+#endif // __CAOUSERAFTER_H__
+
+// End of File
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/mt_sapidataplugin/mt_sapidataplugin.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,335 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+// CLASS HEADER
+#include "mt_sapidataplugin.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/eunitmacros.h>
+#include <hspluginsettings.h>
+#include <aipluginsettings.h>
+#include <aiutility.h>
+//using namespace HSPluginSettingsIf;
+#include <sapidataplugin.h>
+#include <sapidatapluginuids.hrh>
+
+// INTERNAL INCLUDES
+#include "observer.h"
+#include "aicpsexecuteparam.h"
+#include "sapidataplugin.h"
+#include "caicpscommandbuffer_stub.h"
+#include <mcspluginuids.hrh>
+
+_LIT( KPubData, "publisherData" );
+_LIT( KText, "Hello test!" );
+_LIT( KPublisher, "publisher" );
+_LIT( KWRTPublisher, "wrt_publisher");
+_LIT( KTemplateWidget,"ai3templatedwidget");
+_LIT( KContentIdValue, "com.accuweather.widget.touchNG" );
+_LIT8( KContentType, "content_type" );
+_LIT8( KContentId, "content_id" );
+_LIT8( KAction1, "active_1" );
+_LIT8( KAction2, "active_2" );
+_LIT8( KPublisherId, "publisherId" );
+
+// ---------------------------------------------------------------------------
+// CleanupResetAndDestroy()
+// ---------------------------------------------------------------------------
+//
+static void CleanupResetAndDestroy( TAny* aAny )
+ {
+ static_cast< RAiSettingsItemArray* >( aAny )->ResetAndDestroy();
+ }
+
+// CONSTRUCTION
+
+// ---------------------------------------------------------------------------
+// MT_SapiDataPlugin* MT_SapiDataPlugin::NewL()
+// ---------------------------------------------------------------------------
+//
+MT_SapiDataPlugin* MT_SapiDataPlugin::NewL()
+ {
+ MT_SapiDataPlugin* self = MT_SapiDataPlugin::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// MT_SapiDataPlugin* MT_SapiDataPlugin::NewLC()
+// ---------------------------------------------------------------------------
+//
+MT_SapiDataPlugin* MT_SapiDataPlugin::NewLC()
+ {
+ MT_SapiDataPlugin* self = new( ELeave ) MT_SapiDataPlugin();
+ CleanupStack::PushL( self );
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// MT_SapiDataPlugin::~MT_SapiDataPlugin()
+// ---------------------------------------------------------------------------
+//
+MT_SapiDataPlugin::~MT_SapiDataPlugin()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// MT_SapiDataPlugin::MT_SapiDataPlugin()
+// ---------------------------------------------------------------------------
+//
+MT_SapiDataPlugin::MT_SapiDataPlugin()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// void MT_SapiDataPlugin::ConstructL()
+// ---------------------------------------------------------------------------
+//
+void MT_SapiDataPlugin::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// METHODS
+
+// ---------------------------------------------------------------------------
+// void MT_SapiDataPlugin::SetupL()
+// ---------------------------------------------------------------------------
+//
+void MT_SapiDataPlugin::SetupL()
+ {
+ iContentObserver = Observer::NewL();
+
+ iPlugin = CSapiDataPlugin::NewL( );
+
+ // Array owned by the plugin
+ RAiSettingsItemArray settings;
+ CleanupStack::PushL( TCleanupItem( CleanupResetAndDestroy, &settings ) );
+
+ MAiPluginSettings* configuration( AiUtility::CreatePluginSettingsL() );
+ CleanupDeletePushL( configuration );
+
+ MAiPluginConfigurationItem& item( configuration->AiPluginConfigurationItem() );
+
+ _LIT( KPlugin, "plugin" );
+ _LIT( KPublisher, "publisher" );
+ _LIT( KMtSapiDataPlugin, "mt_sapi_plugin" );
+
+ item.SetOwnerL( KPlugin() );
+ item.SetNameL( KPublisher() );
+ item.SetValueL( KMtSapiDataPlugin() );
+
+ settings.AppendL( configuration );
+ CleanupStack::Pop( configuration );
+
+ iCommandBuffer = CAiCpsCommandBuffer::NewL();
+
+ // Ensure interface is available
+ iCommandBuffer->GetCPSInterfaceL();
+
+ // No publisher there, set empty
+ iPlugin->SetProperty( CHsContentPublisher::ECpsCmdBuffer, static_cast< MAiCpsCommandBuffer* >( iCommandBuffer ) );
+ iPlugin->ConfigureL( settings );
+ iPlugin->SubscribeL( *iContentObserver );
+ iPlugin->Start( CHsContentPublisher::ESystemStartup );
+ iPlugin->Resume( CHsContentPublisher::EForeground );
+
+ CleanupStack::PopAndDestroy(); // settings
+ }
+
+// ---------------------------------------------------------------------------
+// void MT_SapiDataPlugin::Teardown()
+// ---------------------------------------------------------------------------
+//
+void MT_SapiDataPlugin::Teardown()
+ {
+ if ( iPlugin )
+ {
+ delete iPlugin;
+ iPlugin = NULL;
+ }
+ if ( iContentObserver )
+ {
+ delete iContentObserver;
+ iContentObserver = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// void MT_SapiDataPlugin::TestCommandBuffer()
+// ---------------------------------------------------------------------------
+//
+void MT_SapiDataPlugin::TestCommandBuffer()
+ {
+ CLiwDefaultMap* filter = CLiwDefaultMap::NewLC();
+ filter->InsertL( KPublisherId, TLiwVariant( KWRTPublisher ));
+ filter->InsertL( KContentType, TLiwVariant( KTemplateWidget ));
+ filter->InsertL( KContentId, TLiwVariant( KContentIdValue ));
+
+ iCommandBuffer->Flush();
+
+ iCommandBuffer->AddCommand( _L("1"), KPubData, filter, KAction1 );
+ iCommandBuffer->AddCommand( _L("1"), KPubData, filter, KAction2 );
+
+ iCommandBuffer->AddCommand( _L("2"), KPubData, filter, KAction1 );
+
+ EUNIT_ASSERT_EQUALS( iCommandBuffer->iPlugins.Count(), 2);
+ EUNIT_ASSERT_EQUALS( iCommandBuffer->iPlugins[0]->iActions.Count(), 2);
+
+ CleanupStack::PopAndDestroy( filter );
+ }
+
+// ---------------------------------------------------------------------------
+// void MT_SapiDataPlugin::TestActivity()
+// ---------------------------------------------------------------------------
+//
+void MT_SapiDataPlugin::TestActivity()
+ {
+ iPlugin->Stop( CHsContentPublisher::ESystemShutdown );
+ EUNIT_ASSERT(iPlugin->IsStopped());
+
+ iPlugin->Resume( CHsContentPublisher::EForeground );
+ EUNIT_ASSERT(!iPlugin->IsActive());
+ }
+
+// ---------------------------------------------------------------------------
+// void MT_SapiDataPlugin::TestSuspendL()
+// ---------------------------------------------------------------------------
+//
+void MT_SapiDataPlugin::TestSuspendL()
+ {
+ EUNIT_ASSERT( iPlugin->IsActive() );
+ iPlugin->Suspend( CHsContentPublisher::EBackground );
+ EUNIT_ASSERT( !iPlugin->IsActive() );
+ iPlugin->Stop( CHsContentPublisher::ESystemShutdown );
+ EUNIT_ASSERT( iPlugin->IsStopped() );
+ iPlugin->Suspend( CHsContentPublisher::EBackground );
+ EUNIT_ASSERT( iPlugin->IsStopped() );
+ }
+
+// ---------------------------------------------------------------------------
+// void MT_SapiDataPlugin::TestPropertyL()
+// ---------------------------------------------------------------------------
+//
+void MT_SapiDataPlugin::TestPropertyL()
+ {
+ TAny* anyPtr = NULL;
+
+ anyPtr = iPlugin->GetProperty( CHsContentPublisher::EPublisherContent );
+ EUNIT_ASSERT( anyPtr );
+
+ iPlugin->Stop( CHsContentPublisher::ESystemShutdown );
+ iPlugin->SetProperty( CHsContentPublisher::ECpsCmdBuffer, NULL );
+ EUNIT_ASSERT_SPECIFIC_LEAVE( iPlugin->StartL( CHsContentPublisher::ESystemStartup ), KErrNotSupported );
+
+ anyPtr = iPlugin->GetProperty( CHsContentPublisher::ECpsCmdBuffer );
+ EUNIT_ASSERT( anyPtr == NULL );
+ }
+
+// ---------------------------------------------------------------------------
+// void MT_SapiDataPlugin::TestFreeEngineL()
+// ---------------------------------------------------------------------------
+//
+void MT_SapiDataPlugin::TestPublishL()
+ {
+ TInt cID1 = 1;
+ TInt cID2 = 2;
+ TBool founded = EFalse;
+ TPtrC valPtr;
+ valPtr.Set( KText );
+
+ iPlugin->PublishTextL( iContentObserver, cID1, valPtr );
+
+ HBufC* contentText = HBufC::NewLC(valPtr.Size());
+ TPtr cDes = contentText->Des();
+ cDes.Copy(valPtr);
+
+ for (int i = 0; i < iPlugin->iDataArray.Count(); i++)
+ if ( iPlugin->iDataArray[i] == *contentText )
+ {
+ founded = ETrue;
+ break;
+ }
+
+ EUNIT_ASSERT(founded);
+
+ CleanupStack::Pop( contentText );
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE
+ (
+ MT_SapiDataPlugin,
+ "SapiDataPlugin module tests",
+ "MODULE"
+ )
+
+EUNIT_TEST
+ (
+ "Activity",
+ "SapiDataPlugin",
+ "Stop, Resume",
+ "FUNCTIONALITY",
+ SetupL, TestActivity, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Suspend",
+ "SapiDataPlugin",
+ "Suspend",
+ "FUNCTIONALITY",
+ SetupL, TestSuspendL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test property",
+ "SapiDataPlugin",
+ "GetPropertyL, SetPropertyL",
+ "FUNCTIONALITY",
+ SetupL, TestPropertyL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test publish",
+ "SapiDataPlugin",
+ "Publish",
+ "FUNCTIONALITY",
+ SetupL, TestPublishL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test command buffer",
+ "SapiDataPlugin",
+ "CAiCpsCommandBuffer",
+ "FUNCTIONALITY",
+ SetupL, TestCommandBuffer, Teardown
+ )
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/mt_sapidataplugin/mt_sapidataplugin.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,114 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+#ifndef __MT_SAPIDATAPLUGIN_H__
+#define __MT_SAPIDATAPLUGIN_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// FORWARD DECLARATIONS
+class CAiCpsCommandBuffer;
+class CSapiDataPlugin;
+class Observer;
+
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * EUnitWizard generated test class.
+ *
+ */
+NONSHARABLE_CLASS( MT_SapiDataPlugin )
+ : public CEUnitTestSuiteClass
+{
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static MT_SapiDataPlugin* NewL();
+
+ /**
+ * Two phase constructor
+ */
+ static MT_SapiDataPlugin* NewLC();
+
+ /**
+ * Destructor
+ */
+ ~MT_SapiDataPlugin();
+
+private: // Constructors and destructors
+
+ MT_SapiDataPlugin();
+
+ void ConstructL();
+
+private: // New methods
+
+ /**
+ * Called everytime at first
+ * to prepare plugin for test
+ */
+ void SetupL();
+
+ /**
+ * Called everytime to deconstruct the plugin
+ */
+ void Teardown();
+
+ /**
+ * Tests Stop and Resume
+ */
+ void TestActivity();
+
+ /**
+ * Tests if SuspendL pass
+ */
+ void TestSuspendL();
+
+ /**
+ * Tests property information from/to plugin
+ */
+ void TestPropertyL();
+
+ /**
+ * Test publishing
+ */
+ void TestPublishL();
+
+ /**
+ * Test command buffer
+ */
+ void TestCommandBuffer();
+
+private: // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ CSapiDataPlugin* iPlugin;
+ Observer* iContentObserver;
+ CAiCpsCommandBuffer* iCommandBuffer;
+};
+
+#endif // __MT_SAPIDATAPLUGIN_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/mt_sapidataplugin/mt_sapidataplugindllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,49 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+// CLASS HEADER
+#include "mt_sapidataplugin.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ // There is a suite contraction error if use belong codes
+ CEUnitTestSuite* rootSuite = CEUnitTestSuite::NewLC(
+ _L("Wizard generated") );
+ rootSuite->AddL( MT_SapiDataPlugin::NewLC() );
+ CleanupStack::Pop();
+ CleanupStack::Pop( rootSuite ); // rootSuite
+
+ return rootSuite;
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/stub/inc/caicpscommandbuffer_stub.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,173 @@
+/*
+* Copyright (c) 2010 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: Cps command buffer
+*
+*/
+
+
+#ifndef C_CAICPSCOMMANDBUFFER_H
+#define C_CAICPSCOMMANDBUFFER_H
+
+// System includes
+#include <e32base.h>
+
+// User includes
+#include <aicpscommandbuffer.h>
+
+// Forward declarations
+class CLiwGenericParamList;
+class CLiwServiceHandler;
+class CLiwCriteriaItem;
+class CAiCpsExecuteParam;
+class MLiwInterface;
+
+/**
+ * AI Cps command buffer
+ *
+ * @ingroup group_aifw
+ * @lib aifw
+ * @since S60 v5.2
+ */
+NONSHARABLE_CLASS( CAiCpsCommandBuffer ) : public CBase,
+ public MAiCpsCommandBuffer
+ {
+public:
+ // constructors and destructor
+
+ /**
+ * Two-phased constructors.
+ */
+ static CAiCpsCommandBuffer* NewL();
+ static CAiCpsCommandBuffer* NewLC();
+
+ /**
+ * Destructor.
+ */
+ ~CAiCpsCommandBuffer();
+
+private:
+ // constructors
+
+ /**
+ * C++ default constructor
+ */
+ CAiCpsCommandBuffer();
+
+ /**
+ * 2nd phase constructor
+ */
+ void ConstructL();
+
+public:
+ // new function
+
+ /**
+ * Flushes command buffer
+ *
+ * @since S60 v5.2
+ */
+ void Flush();
+
+ /**
+ * Gets the CPS interface
+ *
+ * @since S60 5.2
+ */
+ void GetCPSInterfaceL();
+
+public:
+ // from MAiCpsCommandBuffer
+
+ /**
+ * @see MAiCpsCommandBuffer
+ */
+ void AddCommand( const TDesC& aPluginId, const TDesC& aType,
+ CLiwDefaultMap* aFilter, const TDesC8& aAction);
+
+ /**
+ * @see MAiCpsCommandBuffer
+ */
+ CLiwServiceHandler* ServiceHandler() const;
+
+ /**
+ * @see MAiCpsCommandBuffer
+ */
+ MLiwInterface* CpsInterface() const;
+
+private:
+ // new functions
+
+ /**
+ * Detach the CPS interface
+ *
+ * @since S60 5.2
+ */
+ void DetachL();
+
+ /**
+ * Adds a CPS command execute commnad for a spcific Plugin
+ * Note: aType and Filter will overwrite the previous value
+ *
+ * @since S60 5.2
+ * @param aPluginId plugin id.
+ * @param aType type of the cps registry.
+ * @param aFilter filter values.
+ * @param aAction action trigger.
+ */
+ void DoAddCommandL(const TDesC& aPluginId,const TDesC& aType,
+ CLiwDefaultMap* aFilter, const TDesC8& aAction );
+
+ /**
+ * Flush all the CPS execute commands..
+ *
+ * @since S60 5.2
+ */
+ void DoFlushL();
+
+public:
+ // data
+ /**
+ * SAPI service handler.
+ * Owned.
+ */
+ CLiwServiceHandler* iServiceHandler;
+
+ /**
+ * CPS SAPI service.
+ * Owned.
+ */
+ CLiwCriteriaItem* iCpsService;
+
+ /**
+ * Provides hsps services.
+ * Owned.
+ */
+ MLiwInterface* iCpsInterface;
+
+ /**
+ * Plugins execute parameter array
+ * Owned.
+ */
+ RPointerArray<CAiCpsExecuteParam> iPlugins;
+
+private:
+#ifdef _SAPIDATAPLUGIN_TEST
+ friend class MT_SapiDataPlugin;
+#endif
+ };
+
+#endif // C_CAICPSCOMMANDBUFFER_H
+
+// End of file
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/stub/src/aicpscommandbuffer_stub.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,316 @@
+/*
+* Copyright (c) 2010 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: Cps command buffer
+*
+*/
+
+
+// System includes
+#include <liwservicehandler.h>
+#include <liwvariant.h>
+#include <liwgenericparam.h>
+
+// User includes
+#include "caicpscommandbuffer_stub.h"
+#include "aicpsexecuteparam.h"
+#include <debug.h>
+
+// Constants
+_LIT8( KCPSConfigurationIf, "IContentPublishing" );
+_LIT8( KCPS, "Service.ContentPublishing" );
+_LIT8( KExecuteAction, "ExecuteAction" );
+_LIT8( KExecuteMultipleActions, "ExecuteMultipleActions" );
+_LIT8( KFilters, "filters" );
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::CAiCpsCommandBuffer
+//
+// ---------------------------------------------------------------------------
+//
+CAiCpsCommandBuffer::CAiCpsCommandBuffer()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::ConstructL
+//
+// ---------------------------------------------------------------------------
+//
+void CAiCpsCommandBuffer::ConstructL()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::NewL
+//
+// ---------------------------------------------------------------------------
+//
+CAiCpsCommandBuffer* CAiCpsCommandBuffer::NewL()
+ {
+ CAiCpsCommandBuffer* self = CAiCpsCommandBuffer::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::NewLC
+//
+// ---------------------------------------------------------------------------
+//
+CAiCpsCommandBuffer* CAiCpsCommandBuffer::NewLC()
+ {
+ CAiCpsCommandBuffer* self = new ( ELeave ) CAiCpsCommandBuffer;
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::~CAiCpsCommandBuffer
+//
+// ---------------------------------------------------------------------------
+//
+CAiCpsCommandBuffer::~CAiCpsCommandBuffer()
+ {
+ // Flush any pending commands
+ Flush();
+
+ if ( iCpsInterface )
+ {
+ // Close interface
+ iCpsInterface->Close();
+ }
+
+ TRAP_IGNORE( DetachL() );
+
+ delete iCpsService;
+ delete iServiceHandler;
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::DetachL
+//
+// ---------------------------------------------------------------------------
+//
+void CAiCpsCommandBuffer::DetachL()
+ {
+ if ( iServiceHandler && iCpsService )
+ {
+ // Detach services from the handler
+ RCriteriaArray list;
+ CleanupClosePushL( list );
+
+ list.AppendL( iCpsService );
+
+ iServiceHandler->DetachL( list );
+
+ CleanupStack::PopAndDestroy( &list );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::GetCPSInterfaceL
+//
+// ---------------------------------------------------------------------------
+//
+void CAiCpsCommandBuffer::GetCPSInterfaceL()
+ {
+ if ( iCpsInterface )
+ {
+ return;
+ }
+
+ RCriteriaArray interestList;
+ CleanupClosePushL( interestList );
+
+ CLiwServiceHandler* serviceHandler = CLiwServiceHandler::NewL();
+ CleanupStack::PushL( serviceHandler );
+
+ // Attach to CPS:
+ CLiwCriteriaItem* cpsService = CLiwCriteriaItem::NewL( 1, KCPSConfigurationIf, KCPS );
+ CleanupStack::PushL( cpsService );
+
+ cpsService->SetServiceClass( TUid::Uid( KLiwClassBase ) );
+
+ interestList.AppendL( cpsService );
+ serviceHandler->AttachL( interestList );
+
+ CLiwGenericParamList& inParamList( serviceHandler->InParamListL() );
+ CLiwGenericParamList& outParamList( serviceHandler->OutParamListL() );
+
+ serviceHandler->ExecuteServiceCmdL(
+ *cpsService,
+ inParamList,
+ outParamList );
+
+ TInt pos( 0 );
+
+ outParamList.FindFirst( pos, KCPSConfigurationIf );
+
+ if ( pos != KErrNotFound )
+ {
+ iCpsInterface = (outParamList)[pos].Value().AsInterface();
+ inParamList.Reset();
+ outParamList.Reset();
+ }
+ else
+ {
+ inParamList.Reset();
+ outParamList.Reset();
+ User::Leave( KErrNotFound );
+ }
+
+ CleanupStack::Pop( cpsService );
+ iCpsService = cpsService;
+
+ CleanupStack::Pop( serviceHandler );
+ iServiceHandler = serviceHandler;
+
+ CleanupStack::PopAndDestroy( &interestList );
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::AddCommand
+//
+// ---------------------------------------------------------------------------
+//
+void CAiCpsCommandBuffer::AddCommand( const TDesC& aPluginId,
+ const TDesC& aType, CLiwDefaultMap* aFilter,
+ const TDesC8& aAction )
+ {
+ __PRINTS( "CAiCpsCommandBuffer::AddCommand, start" );
+
+ TRAP_IGNORE( DoAddCommandL( aPluginId, aType, aFilter, aAction ) );
+
+ __PRINTS( "CAiCpsCommandBuffer::AddCommand - done" );
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::ServiceHandler
+//
+// ---------------------------------------------------------------------------
+//
+CLiwServiceHandler* CAiCpsCommandBuffer::ServiceHandler() const
+ {
+ return iServiceHandler;
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::CpsInterface
+//
+// ---------------------------------------------------------------------------
+//
+MLiwInterface* CAiCpsCommandBuffer::CpsInterface() const
+ {
+ return iCpsInterface;
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::DoAddCommandL
+//
+// ---------------------------------------------------------------------------
+//
+void CAiCpsCommandBuffer::DoAddCommandL( const TDesC& aPluginId,
+ const TDesC& aType, CLiwDefaultMap* aFilter,
+ const TDesC8& aAction )
+ {
+ TInt found( KErrNotFound );
+
+ for ( TInt i = 0; i < iPlugins.Count(); i++ )
+ {
+ if ( aPluginId == iPlugins[i]->PluginId() )
+ {
+ found = i;
+ break;
+ }
+ }
+
+ if ( found != KErrNotFound )
+ {
+ iPlugins[found]->AddActionL( aAction );
+ }
+ else
+ {
+ CAiCpsExecuteParam* param = CAiCpsExecuteParam::NewLC();
+ param->SetPluginIdL( aPluginId );
+ param->SetRegistryTypeL( aType );
+ param->SetFilterL( aFilter );
+ param->AddActionL( aAction );
+ iPlugins.AppendL( param );
+ CleanupStack::Pop( param );
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::Flush
+//
+// ---------------------------------------------------------------------------
+//
+void CAiCpsCommandBuffer::Flush()
+ {
+ __PRINTS( "CAiCpsCommandBuffer::Flush, start" );
+
+ if ( iPlugins.Count() > 0 )
+ {
+ TRAP_IGNORE( DoFlushL() );
+ }
+
+ __PRINTS( "CAiCpsCommandBuffer::Flush - done" );
+ }
+
+// ---------------------------------------------------------------------------
+// CAiCpsCommandBuffer::DoFlushL
+//
+// ---------------------------------------------------------------------------
+//
+void CAiCpsCommandBuffer::DoFlushL()
+ {
+ if ( !iCpsInterface )
+ {
+ GetCPSInterfaceL();
+ }
+
+ if ( iCpsInterface )
+ {
+ __PRINTS( "CAiCpsCommandBuffer::DoFlush : Execute" );
+
+ TInt pluginCount( iPlugins.Count() );
+
+ CLiwDefaultList* pluginCmdList = CLiwDefaultList::NewLC();
+
+ for ( TInt i = 0; i < pluginCount; i++ )
+ {
+ CLiwDefaultMap* inParamMap = iPlugins[i]->InParamMapLC();
+ pluginCmdList->AppendL( inParamMap );
+ CleanupStack::PopAndDestroy( inParamMap );
+ }
+
+ CLiwGenericParamList* inParamList = CLiwGenericParamList::NewLC();
+ CLiwGenericParamList* outParamList = CLiwGenericParamList::NewLC();
+
+ TLiwGenericParam item( KFilters, TLiwVariant ( pluginCmdList ) );
+ inParamList->AppendL( item );
+
+ iCpsInterface->ExecuteCmdL( KExecuteMultipleActions, *inParamList, *outParamList);
+
+ CleanupStack::PopAndDestroy( 3, pluginCmdList ); // outparamList, inParamList
+
+ iPlugins.ResetAndDestroy();
+ }
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidata/ut_sapidata.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,460 @@
+/*
+* Copyright (c) 2010 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: unit test for the mcsplugin handler
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_sapidata.h"
+
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/eunitmacros.h>
+#include <e32cmn.h>
+#include "aiutility.h"
+#include "aipluginsettings.h"
+
+// INTERNAL INCLUDES
+#define private public
+#include "sapidata.h"
+#undef private
+#include "sapidataplugin.h"
+#include "observer.h"
+
+// Implementation of the MTest interface
+void MTest::GetMenuItemsL()
+ {
+
+ }
+
+// CONSTRUCTION
+
+// ---------------------------------------------------------------------------
+// UT_SapiData* UT_SapiData::NewL()
+// ---------------------------------------------------------------------------
+//
+UT_SapiData* UT_SapiData::NewL()
+ {
+ UT_SapiData* self = UT_SapiData::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// UT_SapiData* UT_SapiData::NewLC()
+// ---------------------------------------------------------------------------
+//
+UT_SapiData* UT_SapiData::NewLC()
+ {
+ UT_SapiData* self = new(ELeave) UT_SapiData();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor (virtual by CBase)
+// ---------------------------------------------------------------------------
+//
+UT_SapiData::~UT_SapiData()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+UT_SapiData::UT_SapiData()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+// Second phase construct
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataPlugin::SetupL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::SetupL()
+ {
+ iContentObserver = Observer::NewL();
+ TUid uid = { SAPIDP_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DATAPLUGIN };
+
+ iPlugin = CSapiDataPlugin::NewL();
+
+ // Array owned by the plugin
+ RAiSettingsItemArray settings;
+ settings.ReserveL( 3 );
+
+ MAiPluginSettings* configuration( AiUtility::CreatePluginSettingsL() );
+ CleanupDeletePushL( configuration );
+
+ MAiPluginConfigurationItem& confItem = configuration->AiPluginConfigurationItem();
+ confItem.SetOwnerL( KPlugin );
+ confItem.SetNameL( KPublisher );
+ confItem.SetValueL( KMtSapiDataPlugin );
+
+ settings.AppendL( configuration );
+ CleanupStack::Pop( configuration );
+
+ // No publisher there, set empty
+ iPlugin->ConfigureL( settings );
+ iPlugin->SubscribeL( *iContentObserver );
+ iPlugin->Start( CHsContentPublisher::ESystemStartup );
+ iPlugin->Resume( CHsContentPublisher::EForeground );
+
+ CleanupStack::PushL( iPlugin );
+ iData = CSapiData::NewL( iPlugin );
+ CleanupStack::Pop( iPlugin );
+ iData->SetContentIdL( KId );
+ iData->ConfigureL( settings );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataPlugin::Teardown()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::Teardown()
+ {
+ if ( iContentObserver )
+ {
+ delete iContentObserver;
+ iContentObserver = NULL;
+ }
+ if ( iData )
+ {
+ delete iData;
+ iData = NULL;
+ }
+ if ( iPlugin )
+ {
+ delete iPlugin;
+ iPlugin = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestConfigureL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestConfigureL()
+ {
+ RAiSettingsItemArray configurationItemsArr;
+ configurationItemsArr.ReserveL( 1 );
+
+ MAiPluginSettings* settings( AiUtility::CreatePluginSettingsL() );
+ CleanupDeletePushL( settings );
+
+ MAiPluginSettingsItem& item( settings->AiPluginSettingsItem() );
+ item.SetPublisherId( TUid::Uid( 3 ) );
+
+ _LIT( KPlugin, "plugin" );
+ _LIT( KPublisher16, "publisher" );
+ MAiPluginConfigurationItem& confItem = settings->AiPluginConfigurationItem();
+ confItem.SetOwnerL( KPlugin );
+ confItem.SetNameL( KPublisher16 );
+
+ TInt32 key( 0 );
+
+ item.SetKey( key );
+ _LIT( KValue, "value" );
+ item.SetValueL( KValue, EFalse );
+
+ configurationItemsArr.Append( settings );
+ CleanupStack::Pop( settings );
+
+
+ EUNIT_ASSERT_NO_LEAVE( iData->ConfigureL( configurationItemsArr ) );
+
+ //delete settings;
+ configurationItemsArr.ResetAndDestroy();
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestSetContentIdL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestSetContentIdL()
+ {
+ _LIT8( KId, "11" );
+ EUNIT_ASSERT_NO_LEAVE( iData->SetContentIdL( KId ) );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestSetStartupReasonL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestSetStartupReasonL()
+ {
+ _LIT8( KStartupReason, "startup_reason" );
+ EUNIT_ASSERT_LEAVE( iData->SetStartupReasonL( KStartupReason ) );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestIsPluginActive()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestIsPluginActive()
+ {
+ TBool res = iData->IsPluginActive();
+ EUNIT_ASSERT( res );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestChangePublisherStatusL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestChangePublisherStatusL()
+ {
+ _LIT8( KStatus, "new_status" );
+
+ iData->SetUpdateNeeded( ETrue );
+ EUNIT_ASSERT_LEAVE( iData->ChangePublisherStatusL( KStatus ) );
+
+ iData->SetUpdateNeeded( EFalse );
+ EUNIT_ASSERT_LEAVE( iData->ChangePublisherStatusL( KStatus ) );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestTriggerActiveL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestTriggerActiveL()
+ {
+ EUNIT_ASSERT_LEAVE( iData->TriggerActiveL() );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestUpdatePublisherStatusL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestUpdatePublisherStatusL()
+ {
+ TBuf<10> publisher;
+ publisher.Append( _L("publisher") );
+ EUNIT_ASSERT_NO_LEAVE( iData->UpdatePublisherStatusL( publisher) );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestCanUpdate()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestCanUpdate()
+ {
+ TBuf<20> KId_EU;
+ KId_EU.Append( _L("4"));
+
+ TBuf<20> KAll_EU;
+ KAll_EU.Append( _L("all"));
+
+ TBufC<30> KPublisher_EU ( KMtSapiDataPlugin );
+
+
+ EUNIT_ASSERT( iData->CanUpdate( KPublisher_EU, KAll_EU, KId_EU ) );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestGetMenuItemsL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestGetMenuItemsL()
+ {
+ MTest* test;
+
+ test = reinterpret_cast<MTest*> ( iData );
+
+ EUNIT_ASSERT_NO_LEAVE( test->GetMenuItemsL() );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestHasMenuItem()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestHasMenuItem()
+ {
+ _LIT16( KParam, "hello world" );
+ EUNIT_ASSERT( !iData->HasMenuItem(KParam) );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestRemoveL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestRemoveL()
+ {
+ TBuf<10> KAll;
+ KAll.Append( _L("all") );
+
+ Observer* observer = Observer::NewL();
+
+ EUNIT_ASSERT_NO_LEAVE( iData->RemoveL(observer, KAll) );
+
+ delete observer;
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiData::TestRefreshL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiData::TestRefreshL()
+ {
+ TBuf<20> publisher;
+ publisher.Append( _L("mt_sapi_plugin") );
+ TBuf<10> contentType;
+ contentType.Append( _L("all") );
+ TBuf<10> contentId;
+ contentId.Append( _L("4") );
+ TBuf<10> operation;
+ operation.Append( _L("operation") );
+ CLiwDefaultMap* dataMap;
+
+ iData->CanUpdate( publisher, contentType, contentId );
+ iData->RefreshL( publisher, contentType, contentId, operation, dataMap );
+
+ TInt id = 4;
+ iPlugin->Clean(iContentObserver, id );
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE
+ (
+ UT_SapiData,
+ "Sapidata plugin tests",
+ "UNIT"
+ )
+
+EUNIT_TEST
+ (
+ "Test configure",
+ "CSapiData",
+ "ConfigureL",
+ "FUNCTIONALITY",
+ SetupL, TestConfigureL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test refresh",
+ "CSapiData",
+ "RefreshL",
+ "FUNCTIONALITY",
+ SetupL, TestRefreshL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test set content ID",
+ "CSapiData",
+ "SetContentIdL",
+ "FUNCTIONALITY",
+ SetupL, TestSetContentIdL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test set startup reason",
+ "CSapiData",
+ "SetStartupReasonL",
+ "FUNCTIONALITY",
+ SetupL, TestSetStartupReasonL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test is plugin active",
+ "CSapiData",
+ "IsPluginActive",
+ "FUNCTIONALITY",
+ SetupL, TestIsPluginActive, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test change publisher status",
+ "CSapiData",
+ "ChangePublisherStatusL",
+ "FUNCTIONALITY",
+ SetupL, TestChangePublisherStatusL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test trigger activate",
+ "CSapiData",
+ "TriggerActivateL",
+ "FUNCTIONALITY",
+ SetupL, TestTriggerActiveL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test update publisher status",
+ "CSapiData",
+ "UpdatePublisherStatusL",
+ "FUNCTIONALITY",
+ SetupL, TestUpdatePublisherStatusL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test can update",
+ "CSapiData",
+ "CanUpdate",
+ "FUNCTIONALITY",
+ SetupL, TestCanUpdate, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test get menu items",
+ "CSapiData",
+ "GetMenuItemsL",
+ "FUNCTIONALITY",
+ SetupL, TestGetMenuItemsL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test has menu item",
+ "CSapiData",
+ "HasMenuItem",
+ "FUNCTIONALITY",
+ SetupL, TestHasMenuItem, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Test remove",
+ "CSapiData",
+ "RemoveL",
+ "FUNCTIONALITY",
+ SetupL, TestRemoveL, Teardown
+ )
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidata/ut_sapidata.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,105 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __UT_SAPIDATAPLUGIN_H__
+#define __UT_SAPIDATAPLUGIN_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <msvapi.h>
+
+// INTERNAL INCLUDES
+
+// FORWARD DECLARATIONS
+class CSapiData;
+class CSapiDataPlugin;
+class Observer;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+_LIT( KPublisher, "publisher" );
+_LIT( KMtSapiDataPlugin, "mt_sapi_plugin" );
+_LIT8( KId, "4" );
+
+// CLASS DEFINITION
+class MTest
+ {
+ public:
+ virtual void GetMenuItemsL();
+ };
+/**
+ *
+ * Unit test for the mcspluginhandler
+ *
+ */
+NONSHARABLE_CLASS( UT_SapiData ) :
+ public CEUnitTestSuiteClass
+ {
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_SapiData* NewL();
+ static UT_SapiData* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_SapiData();
+
+private: // Constructors and destructors
+
+ UT_SapiData();
+ void ConstructL();
+
+private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void TestConfigureL();
+ void TestSetContentIdL();
+ void TestSetStartupReasonL();
+ void TestCreateFilterLC();
+ void TestRefreshL();
+ void TestIsPluginActive();
+ void TestChangePublisherStatusL();
+ void TestTriggerActiveL();
+ void TestUpdatePublisherStatusL();
+ void TestGetMenuItemsL();
+ void TestCanUpdate();
+ void TestHasMenuItem();
+ void TestRemoveL();
+
+private: // Data
+
+ CSapiData* iData;
+
+ CSapiDataPlugin* iPlugin;
+ Observer* iContentObserver;
+
+ EUNIT_DECLARE_TEST_TABLE;
+ };
+
+#endif // __UT_SAPIDATAPLUGIN_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidata/ut_sapidatadllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_sapidata.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_SapiData::NewL();
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidataobserver/ut_sapidataobserver.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,291 @@
+/*
+* Copyright (c) 2010 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: unit test for the sapidataobserver
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_sapidataobserver.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/eunitmacros.h>
+#include <e32cmn.h>
+
+// INTERNAL INCLUDES
+#include "sapidata.h"
+#include "sapidataobserver.h"
+#include "sapidataplugin.h"
+#include "sapidatapluginconst.h"
+
+// CONSTRUCTION
+
+// ---------------------------------------------------------------------------
+// UT_SapiDataObserver* UT_SapiDataObserver::NewL()
+// ---------------------------------------------------------------------------
+//
+UT_SapiDataObserver* UT_SapiDataObserver::NewL()
+ {
+ UT_SapiDataObserver* self = UT_SapiDataObserver::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// UT_SapiDataObserver* UT_SapiDataObserver::NewLC()
+// ---------------------------------------------------------------------------
+//
+UT_SapiDataObserver* UT_SapiDataObserver::NewLC()
+ {
+ UT_SapiDataObserver* self = new(ELeave) UT_SapiDataObserver();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor (virtual by CBase)
+// ---------------------------------------------------------------------------
+//
+UT_SapiDataObserver::~UT_SapiDataObserver()
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+UT_SapiDataObserver::UT_SapiDataObserver()
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// Second phase construct
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataObserver::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// ---------------------------------------------------------------------------
+// Auxiliary method for the obtaining of the MLiwInterface
+// ---------------------------------------------------------------------------
+//
+MLiwInterface* UT_SapiDataObserver::GetMessagingInterfaceL()
+ {
+ if( !iServiceHandler )
+ {
+ iServiceHandler = CLiwServiceHandler::NewL();
+ }
+
+ CLiwGenericParamList* inParam = CLiwGenericParamList::NewL();
+ CleanupStack::PushL( inParam );
+ CLiwGenericParamList* outParam = CLiwGenericParamList::NewL();
+ CleanupStack::PushL( outParam );
+ CLiwCriteriaItem* crit = CLiwCriteriaItem::NewL( KLiwCmdAsStr, KCPInterface,
+ KCPService );
+ crit->SetServiceClass( TUid::Uid(KLiwClassBase) );
+
+ RCriteriaArray a;
+ a.AppendL(crit);
+
+ iServiceHandler->AttachL(a);
+ iServiceHandler->ExecuteServiceCmdL( *crit, *inParam, *outParam );
+
+ delete crit;
+ a.Reset();
+
+ // find service interface
+ TInt pos = 0;
+ MLiwInterface* msgInterface = NULL;
+ outParam->FindFirst( pos, KCPInterface );
+ if ( pos != KErrNotFound )
+ {
+ msgInterface = (*outParam)[pos].Value().AsInterface();
+ }
+
+ outParam->Reset();
+ inParam->Reset();
+ CleanupStack::PopAndDestroy( outParam );
+ CleanupStack::PopAndDestroy( inParam );
+
+ return msgInterface;
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataObserver::SetupL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataObserver::SetupL()
+ {
+ iInterface = GetMessagingInterfaceL();
+ iPlugin = CSapiDataPlugin::NewL();
+ iData = CSapiData::NewL( iPlugin );
+ iObserver = CSapiDataObserver::NewL( iInterface, iData );
+
+ CLiwDefaultMap* filter = CLiwDefaultMap::NewLC();
+ filter->InsertL( KPublisherId, TLiwVariant( KPublisherId ));
+ filter->InsertL( KOperation, TLiwVariant( KAddUpdateDelete ) );
+ iObserver->RegisterL( filter, KCpData(),
+ KExtendedNotifications );
+ CleanupStack::PopAndDestroy( filter );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataObserver::Teardown()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataObserver::Teardown()
+ {
+ if ( iObserver )
+ {
+ iObserver->ReleaseL();
+ delete iObserver;
+ iObserver = NULL;
+ }
+ if( iInterface )
+ {
+ iInterface->Close();
+ iInterface = NULL;
+ }
+ if( iServiceHandler )
+ {
+ iServiceHandler->Reset();
+ delete iServiceHandler;
+ iServiceHandler = NULL;
+ }
+ if ( iData )
+ {
+ delete iData;
+ iData = NULL;
+ }
+ if ( iPlugin )
+ {
+ delete iPlugin;
+ iPlugin = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataObserver::HandleSessionEventL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataObserver::ConstructTestL()
+ {
+ if ( iObserver )
+ EUNIT_ASSERT( ETrue )
+ else
+ EUNIT_ASSERT( EFalse );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataObserver::RegisterTestL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataObserver::RegisterTestL()
+ {
+ CLiwDefaultMap* conRegFilter = iData->CreateFilterLC();
+ conRegFilter->InsertL( KOperation, TLiwVariant( KAddUpdateDelete ) );
+
+ EUNIT_ASSERT_NO_LEAVE( iObserver->RegisterL( conRegFilter, KCpData(), KExtendedNotifications ));
+
+ CleanupStack::PopAndDestroy( conRegFilter );
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataObserver::ReleaseTestL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataObserver::ReleaseTestL()
+ {
+ EUNIT_ASSERT_NO_LEAVE( iObserver->ReleaseL() );
+
+ delete iObserver;
+ iObserver = NULL;
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataObserver::HandleNotifyTestL()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataObserver::HandleNotifyTestL()
+ {
+ CLiwGenericParamList* paramList = CLiwGenericParamList::NewL();
+ TInt id = 999;
+ TInt retValue = 0;
+
+ retValue = iObserver->HandleNotifyL( id, 0, *paramList, *paramList );
+
+ if ( retValue == id )
+ EUNIT_ASSERT( ETrue )
+ else
+ EUNIT_ASSERT( EFalse );
+ }
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE
+ (
+ UT_SapiDataObserver,
+ "Sapidata Observer tests",
+ "UNIT"
+ )
+
+EUNIT_TEST
+ (
+ "Tests ConstructL()",
+ "CSapiDataObserver",
+ "ConstructL",
+ "FUNCTIONALITY",
+ SetupL, ConstructTestL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Tests RegisterL()",
+ "CSapiDataObserver",
+ "RegisterL",
+ "FUNCTIONALITY",
+ SetupL, RegisterTestL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Tests ReleaseL()",
+ "CSapiDataObserver",
+ "ReleaseL",
+ "FUNCTIONALITY",
+ SetupL, ReleaseTestL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Tests HandleNotify()",
+ "CSapiDataObserver",
+ "HandleNotifyL",
+ "FUNCTIONALITY",
+ SetupL, HandleNotifyTestL, Teardown
+ )
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidataobserver/ut_sapidataobserver.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,94 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __UT_SAPIDATAOBSERVER_H__
+#define __UT_SAPIDATAOBSERVER_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <msvapi.h>
+#include <liwcommon.h>
+#include <liwservicehandler.h>
+
+// INTERNAL INCLUDES
+#include "interface.h"
+
+// FORWARD DECLARATIONS
+class CSapiData;
+class CSapiDataObserver;
+class CSapiDataPlugin;
+class CLiwServiceHandler;
+
+#include <e32def.h>
+
+_LIT8( KCPInterface, "IDataSource" );
+_LIT8( KCPService, "Service.ContentPublishing" );
+
+// CLASS DEFINITION
+/**
+ *
+ * Unit test for the sapidataobserver
+ *
+ */
+NONSHARABLE_CLASS( UT_SapiDataObserver ) :
+ public CEUnitTestSuiteClass
+ {
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_SapiDataObserver* NewL();
+ static UT_SapiDataObserver* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_SapiDataObserver();
+
+private: // Constructors and destructors
+
+ UT_SapiDataObserver();
+ void ConstructL();
+
+private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ MLiwInterface* GetMessagingInterfaceL();
+
+ void ConstructTestL();
+ void RegisterTestL();
+ void ReleaseTestL();
+ void HandleNotifyTestL();
+
+private: // Data
+
+ CSapiData* iData;
+ MLiwInterface* iInterface;
+ CSapiDataPlugin* iPlugin;
+ CLiwServiceHandler* iServiceHandler;
+ CSapiDataObserver* iObserver;
+
+ EUNIT_DECLARE_TEST_TABLE;
+ };
+
+#endif // __UT_SAPIDATAOBSERVER_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidataobserver/ut_sapidataobserverdllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_sapidataobserver.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_SapiDataObserver::NewL();
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidataplugin/ut_sapidataplugin.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,354 @@
+/*
+* Copyright (c) 2010 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: unit test for the mcsplugin handler
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_sapidataplugin.h"
+
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/eunitmacros.h>
+#include <e32cmn.h>
+#include <aiutility.h>
+#include <aipluginsettings.h>
+
+// INTERNAL INCLUDES
+#include "sapidata.h"
+#include "sapidataobserver.h"
+#include "sapidataplugin.h"
+#include "sapidatapluginconst.h"
+#include "observer.h"
+
+
+_LIT( KTest, "TEST" );
+_LIT( KUpdate, "update" );
+// CONSTRUCTION
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_SapiDataPlugin* UT_SapiDataPlugin::NewL()
+ {
+ UT_SapiDataPlugin* self = UT_SapiDataPlugin::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_SapiDataPlugin* UT_SapiDataPlugin::NewLC()
+ {
+ UT_SapiDataPlugin* self = new(ELeave) UT_SapiDataPlugin();
+ CleanupStack::PushL(self);
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+// Destructor (virtual by CBase)
+// ---------------------------------------------------------------------------
+//
+UT_SapiDataPlugin::~UT_SapiDataPlugin()
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// Default constructor
+// ---------------------------------------------------------------------------
+//
+UT_SapiDataPlugin::UT_SapiDataPlugin()
+ {
+
+ }
+
+// ---------------------------------------------------------------------------
+// Second phase construct
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataPlugin::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// ---------------------------------------------------------------------------
+// void UT_SapiDataPlugin::Teardown()
+// ---------------------------------------------------------------------------
+//
+void UT_SapiDataPlugin::Teardown()
+ {
+ if ( iPlugin )
+ {
+ delete iPlugin;
+ iPlugin = NULL;
+ }
+ if ( iObserver )
+ {
+ delete iObserver;
+ iObserver = NULL;
+ }
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::UT_SapiDataPlugin_Data()
+ {
+ iData = iPlugin->Data();
+ EUNIT_ASSERT( iData );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::SetupL()
+ {
+ iPlugin = CSapiDataPlugin::NewL();
+
+ RAiSettingsItemArray settings;
+ MAiPluginSettings* setting = AiUtility::CreatePluginSettingsL();
+
+ CleanupDeletePushL( setting );
+ MAiPluginContentItem& item = setting->AiPluginContentItem();
+ item.SetTypeL( _L( "image" ) );
+ item.SetNameL( _L( "widget/icon" ) );
+ settings.AppendL( setting );
+ CleanupStack::Pop( setting );
+
+ MAiPluginSettings* setting1 = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting1 );
+ MAiPluginContentItem& item1 = setting1->AiPluginContentItem();
+ item1.SetTypeL( _L( "image" ) );
+ item1.SetNameL( _L( "widget/icon" ) );
+ settings.AppendL( setting1 );
+ CleanupStack::Pop( setting1 );
+
+ MAiPluginSettings* setting2 = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting2 );
+ MAiPluginContentItem& item2 = setting2->AiPluginContentItem();
+ item2.SetTypeL( _L( "text" ) );
+ item2.SetNameL( _L( "widget/longname" ) );
+ settings.AppendL( setting2 );
+ CleanupStack::Pop( setting2 );
+
+ MAiPluginSettings* setting3 = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting3 );
+ MAiPluginConfigurationItem& item3 = setting3->AiPluginConfigurationItem();
+ item3.SetOwnerL( _L( "plugin" ) );
+ item3.SetNameL( _L( "publisher" ));
+ item3.SetValueL( _L( "TEST" ) );
+ settings.AppendL( setting3 );
+ CleanupStack::Pop( setting3 );
+
+ TRAPD( err, iPlugin->ConfigureL( settings ) );
+ EUNIT_ASSERT_EQUALS(err, KErrNone);
+
+ iPlugin->Start( CHsContentPublisher::ESystemStartup );
+ iPlugin->Resume( CHsContentPublisher::EForeground );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::UT_SapiDataPlugin_GetTypeL()
+ {
+ MAiPluginSettings* setting4 = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting4 );
+ MAiPluginContentItem& item4 = setting4->AiPluginContentItem();
+ item4.SetTypeL( _L( "text" ) );
+ item4.SetNameL( _L( "widget/longname" ) );
+
+ HBufC* objectId = item4.Name().AllocLC();
+ objectId->Des().Delete(0, objectId->LocateReverse(KPluginNameSeprator) + 1);
+
+ HBufC* type = iPlugin->GetTypeL( *objectId ).AllocLC();
+ EUNIT_ASSERT_EQUALS( type != KNullDesC(), ETrue )
+
+ CleanupStack::PopAndDestroy( type );
+ CleanupStack::PopAndDestroy( objectId );
+ CleanupStack::PopAndDestroy( setting4 );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::UT_SapiDataPlugin_GetIdL()
+ {
+ MAiPluginSettings* setting4 = AiUtility::CreatePluginSettingsL();
+ CleanupDeletePushL( setting4 );
+ MAiPluginContentItem& item4 = setting4->AiPluginContentItem();
+ item4.SetTypeL( _L( "text" ) );
+ item4.SetNameL( _L( "widget/longname" ) );
+
+ HBufC* objectId = item4.Name().AllocLC();
+ objectId->Des().Delete(0, objectId->LocateReverse(KPluginNameSeprator) + 1);
+
+ TInt id = iPlugin->GetIdL( *objectId );
+ EUNIT_ASSERT_EQUALS( id != KErrNotFound, ETrue );
+
+ CleanupStack::PopAndDestroy( objectId );
+ CleanupStack::PopAndDestroy( setting4 );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::UT_SapiDataPlugin_Resume()
+ {
+ EUNIT_ASSERT( iPlugin->IsActive() );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::UT_SapiDataPlugin_NetworkStatus()
+ {
+ iPlugin->SetOnline();
+ CSapiDataPlugin::TPluginNetworkStatus networkStatus =
+ iPlugin->NetworkStatus();
+ EUNIT_ASSERT_EQUALS( networkStatus == CSapiDataPlugin::EOnline, ETrue );
+
+ iPlugin->SetOffline();
+ networkStatus = iPlugin->NetworkStatus();
+ EUNIT_ASSERT_EQUALS( networkStatus == CSapiDataPlugin::EOffline, ETrue );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::UT_SapiDataPlugin_GetProperty()
+ {
+ TAny* anyPtr = iPlugin->GetProperty( CSapiDataPlugin::EPublisherContent );
+ MAiContentItemIterator* iter =
+ static_cast<MAiContentItemIterator*>( anyPtr);
+ EUNIT_ASSERT( iter );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::UT_SapiDataPlugin_HasMenuItem()
+ {
+ TBool res = iPlugin->HasMenuItem( KTest );
+ EUNIT_ASSERT( res == EFalse );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+void UT_SapiDataPlugin::UT_SapiDataPlugin_Clean()
+ {
+ iObserver = Observer::NewL();
+ TInt id = 1;
+
+ iPlugin->SubscribeL( *iObserver );
+ EUNIT_ASSERT_NO_LEAVE( iPlugin->Clean( iObserver, id ) );
+ }
+
+// TEST TABLE
+
+
+EUNIT_BEGIN_TEST_TABLE
+ (
+ UT_SapiDataPlugin,
+ "Sapidata plugin tests",
+ "UNIT"
+ )
+
+EUNIT_TEST
+ (
+ "Data",
+ "CSapiDataPlugin",
+ "Data",
+ "FUNCTIONALITY",
+ SetupL, UT_SapiDataPlugin_Data, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Resume",
+ "CSapiDataPlugin",
+ "Resume",
+ "FUNCTIONALITY",
+ SetupL, UT_SapiDataPlugin_Resume, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "GetTypeL",
+ "CSapiDataPlugin",
+ "GetTypeL",
+ "FUNCTIONALITY",
+ SetupL, UT_SapiDataPlugin_GetTypeL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "GetIdL",
+ "CSapiDataPlugin",
+ "GetIdL",
+ "FUNCTIONALITY",
+ SetupL, UT_SapiDataPlugin_GetIdL, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "NetworkStatus",
+ "CSapiDataPlugin",
+ "NetworkStatus",
+ "FUNCTIONALITY",
+ SetupL, UT_SapiDataPlugin_NetworkStatus, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "GetProperty",
+ "CSapiDataPlugin",
+ "GetProperty",
+ "FUNCTIONALITY",
+ SetupL, UT_SapiDataPlugin_GetProperty, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "HasMenuItem",
+ "CSapiDataPlugin",
+ "HasMenuItem",
+ "FUNCTIONALITY",
+ SetupL, UT_SapiDataPlugin_HasMenuItem, Teardown
+ )
+
+EUNIT_TEST
+ (
+ "Clean",
+ "CSapiDataPlugin",
+ "Clean",
+ "FUNCTIONALITY",
+ SetupL, UT_SapiDataPlugin_Clean, Teardown
+ )
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidataplugin/ut_sapidataplugin.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,103 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef __UT_SAPIDATAPLUGIN_H__
+#define __UT_SAPIDATAPLUGIN_H__
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <msvapi.h>
+#include <hscontentpublisher.h>
+#include <aicontentmodel.h>
+// INTERNAL INCLUDES
+
+// FORWARD DECLARATIONS
+class CSapiData;
+class CSapiDataPlugin;
+class Observer;
+
+#include <e32def.h>
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+// CLASS DEFINITION
+/**
+ *
+ * Unit test for the mcspluginhandler
+ *
+ */
+NONSHARABLE_CLASS( UT_SapiDataPlugin ) :
+ public CEUnitTestSuiteClass
+ //public MMsvSessionObserver
+ {
+public: // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_SapiDataPlugin* NewL();
+ static UT_SapiDataPlugin* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_SapiDataPlugin();
+
+private: // Constructors and destructors
+
+ UT_SapiDataPlugin();
+ void ConstructL();
+
+private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void UT_SapiDataPlugin_Data();
+
+ void UT_SapiDataPlugin_ConfigureL();
+
+ void UT_SapiDataPlugin_Resume();
+
+ void UT_SapiDataPlugin_NetworkStatus();
+
+ void UT_SapiDataPlugin_GetProperty();
+
+ void UT_SapiDataPlugin_GetTypeL();
+
+ void UT_SapiDataPlugin_GetIdL();
+
+ void UT_SapiDataPlugin_HasMenuItem();
+
+ void UT_SapiDataPlugin_Clean();
+
+private: // Data
+
+ CSapiData* iData;
+
+ CSapiDataPlugin* iPlugin;
+
+ Observer* iObserver;
+
+ EUNIT_DECLARE_TEST_TABLE;
+ };
+
+#endif // __UT_SAPIDATAPLUGIN_H__
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/sapidataplugin/ut_sapidataplugin/ut_sapidataplugindllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,43 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+// CLASS HEADER
+#include "ut_sapidataplugin.h"
+
+// EXTERNAL INCLUDES
+#include <digia/eunit/ceunittestsuite.h>
+
+/**
+ * Test suite factory function.
+ */
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_SapiDataPlugin::NewL();
+ }
+
+#ifndef __SECURE_API__
+/**
+ * Standard Symbian DLL entry point function.
+ */
+GLDEF_C TInt E32Dll(TDllReason)
+ {
+ return KErrNone;
+ }
+#endif
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/bwins/mt_wrtdatapluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/bwins/ut_wrtdatapluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/eabi/mt_wrtdatapluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,5 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _ZTI22CWrtDataPluginObserver @ 2 NONAME
+ _ZTV22CWrtDataPluginObserver @ 3 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/eabi/ut_wrtdatapluginu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,31 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+
+PRJ_TESTMMPFILES
+mt_wrtdataplugin.mmp
+ut_wrtdataplugin.mmp
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/group/mt_wrtdataplugin.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,48 @@
+/*
+* Copyright (c) 2010 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET mt_wrtdataplugin.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700b02
+
+
+CAPABILITY EUNIT_CAPS
+VENDORID 0x00000000
+
+SOURCEPATH ../src
+SOURCE mt_wrtdataplugin.cpp
+SOURCE mt_wrtdataplugin_dllmain.cpp
+SOURCE wrtdatapluginobserver.cpp
+
+
+USERINCLUDE ../inc
+SYSTEMINCLUDE ../../../plugins/wrtdataplugin/inc
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY EUnit.lib
+LIBRARY EUnitUtil.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY hspluginsettings.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/group/ut_wrtdataplugin.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2010 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 <platform_paths.hrh>
+#include <data_caging_paths.hrh>
+#include <eunitcaps.h>
+
+TARGET ut_wrtdataplugin.dll
+TARGETTYPE dll
+TARGETPATH /DigiaEUnit/Tests
+UID 0x1000af5a 0x01700b03
+
+
+
+CAPABILITY EUNIT_CAPS
+VENDORID 0x00000000
+
+SOURCEPATH ../src
+SOURCE ut_wrtdataplugin.cpp
+SOURCE ut_wrtdataplugin_dllmain.cpp
+
+
+
+USERINCLUDE ../inc
+SYSTEMINCLUDE ../../../plugins/wrtdataplugin/inc
+
+
+APP_LAYER_SYSTEMINCLUDE
+
+LIBRARY EUnit.lib
+LIBRARY EUnitUtil.lib
+LIBRARY euser.lib
+LIBRARY ecom.lib
+LIBRARY hspluginsettings.lib
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/inc/mt_wrtdataplugin.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,98 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+#ifndef __MT_WRTDATAPLUGIN_H__
+#define __MT_WRTDATAPLUGIN_H__
+
+// INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <digia/eunit/eunitdecorators.h>
+
+
+// FORWARD DECLARATIONS
+class CHsContentPublisher;
+class CWrtDataPluginObserver;
+
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( MT_wrtdataplugin )
+ : public CEUnitTestSuiteClass
+ {
+public: // Constructors and destructor
+
+ static MT_wrtdataplugin* NewL();
+ static MT_wrtdataplugin* NewLC();
+ ~MT_wrtdataplugin();
+
+private: // Constructors
+
+ MT_wrtdataplugin();
+ void ConstructL();
+
+private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void TestStartL();
+
+ void TestStopL();
+
+ void TestResumeL();
+
+ void TestSuspendL();
+
+ void TestSetOnlineL();
+
+ void TestSetOfflineL();
+
+ void TestSubscribeL();
+
+ void TestConfigureL();
+
+ void TestSetPropertyL();
+
+ void TestGetPropertyL();
+
+ void TestHandleEventL();
+
+ void TestHasMenuItemL();
+
+ void TestExtensionL();
+
+ void TestPublisherInfoL();
+
+
+private: // Data
+
+
+ CHsContentPublisher* iPlugin;
+ CWrtDataPluginObserver* iContentObserver;
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ };
+
+#endif // __MT_WRTDATAPLUGIN_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/inc/ut_wrtdataplugin.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,125 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+#ifndef __UT_WRTDATAPLUGIN_H__
+#define __UT_WRTDATAPLUGIN_H__
+
+// INCLUDES
+#include <digia/eunit/ceunittestsuiteclass.h>
+#include <digia/eunit/eunitdecorators.h>
+
+
+
+// FORWARD DECLARATIONS
+class CWrtDataPlugin;
+class CWrtDataPluginObserver;
+class CWrtDataObserver;
+class TAknsItemID;
+
+#ifndef NONSHARABLE_CLASS
+#define NONSHARABLE_CLASS(x) class x
+#endif
+
+
+// CLASS DEFINITION
+/**
+ * Generated EUnit test suite class.
+ */
+NONSHARABLE_CLASS( UT_wrtdataplugin )
+ : public CEUnitTestSuiteClass
+ {
+public: // Constructors and destructor
+
+ static UT_wrtdataplugin* NewL();
+ static UT_wrtdataplugin* NewLC();
+ ~UT_wrtdataplugin();
+
+private: // Constructors
+
+ UT_wrtdataplugin();
+ void ConstructL();
+
+private: // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ // CWrtDataPlugin test cases
+ void TestGetIdL();
+
+ void TestGetTypeL();
+
+ void TestRefreshL();
+
+ void TestIsActive();
+
+ void TestPublishTextL();
+
+ void TestPublishImageHandleL();
+
+ void TestPublishImagePathL();
+
+ void TestClean();
+
+ void TestShowLoadingIcon();
+
+ void TestHideLoadingIcon();
+
+ void TestData();
+
+ void TestNetworkStatus();
+
+ void TestStartTimer();
+
+ // CWrtData test cases
+ void TestConfigureL();
+
+ void TestRegisterL();
+
+ void TestUpdatePublisherStatusL();
+
+ void TestPublishInitialDataL();
+
+ void TestPublishDefaultImageL();
+
+ void TestPublishL();
+
+ void TestDataRefreshL();
+
+ void TestExecuteActionL();
+
+ void TestIsPluginActive();
+
+ void TestNotifyPublisherL();
+
+ void TestSetCommandBuffer();
+
+ // CWrtDataObserver test cases
+ void TestHandleNotifyL();
+
+private: // Data
+
+
+ CWrtDataPlugin* iPlugin;
+ CWrtDataPluginObserver* iContentObserver;
+ CWrtDataObserver* iDataObserver;
+ EUNIT_DECLARE_TEST_TABLE;
+
+ };
+
+#endif // __MT_WRTDATAPLUGIN_H__
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/inc/wrtdatapluginobserver.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,299 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+#ifndef WRTDATAPLUGINOBSERVER_H
+#define WRTDATAPLUGINOBSERVER_H
+
+// INCLUDES
+#include <e32std.h>
+#include <e32base.h>
+#include <aicontentobserver.h>
+
+
+// CLASS DECLARATION
+
+/**
+ * CWrtDataPluginObserver
+ *
+ */
+class CWrtDataPluginObserver : public CBase, public MAiContentObserver
+ {
+public:
+ // Constructors and destructor
+
+ /**
+ * Destructor.
+ */
+ ~CWrtDataPluginObserver();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CWrtDataPluginObserver* NewL();
+
+ /**
+ * Two-phased constructor.
+ */
+ static CWrtDataPluginObserver* NewLC();
+
+
+public: // from MAiContentObserver
+ // new functions
+
+ /**
+ * Invoked by the plug-in to inform that it initiates content publishing
+ * transaction.
+ *
+ * @param aTxId - transaction Id
+ * @return - Possible return values:
+ * - KErrNone - transaction is started.
+ * - KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ */
+ virtual TInt StartTransaction( TInt aTxId );
+
+ /**
+ * Invoked by the plug-in to request framework that content publishing
+ * transaction must be finalized and content should be rendered to the
+ * screen.
+ *
+ * @param aTxId - transaction Id
+ * @return - Possible return values:
+ * - KErrNone - transaction is over.
+ * - KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * - KErrNotFound - transaction with matching id has not been
+ * started.
+ * - Any of the system-wide error codes in case of resource allocation failure.
+ */
+ virtual TInt Commit( TInt aTxId );
+
+ /**
+ * Invoked by plug-in to indicate that content publishing transaction
+ * must be cancelled.
+ *
+ * @param aTxId - transaction Id
+ * @return - Possible return values:
+ * - KErrNone - transaction is cancelled.
+ * - KErrNotSupported - UI Controller does not support transactions,
+ * meaning that content will be rendered every time when Publish
+ * is called.
+ * - KErrNotFound - transaction with matching id has not been
+ * started.
+ */
+ virtual TInt CancelTransaction( TInt aTxId );
+
+ /**
+ * Invoked by plug-in to test if the specified content can be published.
+ *
+ * @param aPlugin - Plug-in interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aIndex - index of the content item.
+ * @return ETrue - if content could be published; EFalse otherwise.
+ */
+ virtual TBool CanPublish( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that content identified by reference
+ * aResource must be published to UI control\element identified by selector
+ * aContent.
+ *
+ * @param aPlugin - Plug-in interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aResource - identification of content reference, MUST correspond
+ * single content reference supported by plug-in. The framework
+ * utilizes the reference if to match for cid and MIME type of the
+ * content supplied with in UI definition.
+ * @param aIndex - index of the content item.
+ * @return - Possible return values:
+ * - KErrNone - if content is published.
+ * - KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * - KErrNotFound - if content reference is not found in current
+ * UI definition.
+ */
+ virtual TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, TInt aResource, TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that textual content provided within
+ * parameter aText must be published to UI control\element identified by
+ * selector aContent.
+ *
+ * @param aPlugin - Plug-in interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aText - Textual content in UNICODE.
+ * @param aIndex - index of the content item.
+ * @return - Possible return values:
+ * - KErrNone - if content is published.
+ * - KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * - KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * - KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ */
+ virtual TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, const TDesC16& aText, TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that content provided within buffer
+ * aBuf must be published to UI control\element identified by selector
+ * aContent.
+ *
+ * @param aPlugin - Plug-in interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aBuf - instance of content.
+ * @param aIndex - index of the content item.
+ * @return - Possible return values:
+ * - KErrNone - if content is published.
+ * - KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * - KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * - KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ */
+ virtual TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, const TDesC8& aBuf, TInt aIndex );
+
+
+ /**
+ * Invoked by the plug-in to inform that content from file handle aFile
+ * must be published to UI control\element identified by selector aContent.
+ *
+ * @param aPlugin - Plug-in interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aFile - file handle from where content can be obtained by UI
+ * framework.
+ * @param aIndex - index of the content item.
+ * @return - Possible return values:
+ * - KErrNone - if content is published.
+ * - KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * - KErrNotFound - if content reference is not found in current
+ * UI definition.
+ * - KErrArgument - if content cannot be published to UI element,
+ * e.g. MIME type mismatch.
+ */
+ virtual TInt Publish( CHsContentPublisher& aPlugin, TInt aContent, RFile& aFile, TInt aIndex );
+
+ /**
+ * Invoked by the plug-in to inform that content must be cleaned in UI
+ * control\element identified by selector aContent.
+ *
+ * @param aPlugin - Plug-in interface implementation.
+ * @param aContent - identification of content selector, MUST correspond
+ * single content selector supported by plug-in. The framework
+ * utilizes the selector id to match for cid and MIME type.
+ * @param aIndex - index of the content item.
+ * @return - Possible return values:
+ * - KErrNone - if content is published.
+ * - KErrNotSupported - if content selector is not supported by
+ * current UI definition.
+ * - KErrNotFound - if content reference is not found in current
+ * UI definition.
+ */
+ virtual TInt Clean( CHsContentPublisher& aPlugin, TInt aContent, TInt aIndex );
+
+ /**
+ * Returns interface extension. Not used in S60 3.2 release.
+ *
+ * @param aUid - UID of the extension interface to access.
+ * @return the extension interface. Actual type depends on the passed aUid
+ * argument.
+ */
+ virtual TAny* Extension( TUid aUid );
+
+ /**
+ * Invoked by the plugin factory
+ *
+ * @param aPublsiherInfo Publisher which requires subscription
+ * @return ETrue if subsription is needed, EFalse otherwise
+ */
+ virtual TBool RequiresSubscription( const THsPublisherInfo& aPublisherInfo ) const;
+
+ /**
+ * Invoked by the plug-in to change the property value of a specific content.
+ * value type must be string.
+ * @param aPlugin - Plug-in interface implementation.
+ * @param aElementId - id of content selector, MUST correspond
+ * single content supported by plug-in. The framework
+ * utilizes the id to find in the plugin xml defintion.
+ * @param aPropertyName - property name.
+ * @param aPropertyValue - property value.
+ * @return - Possible return values:
+ * - KErrNone - if content reference found.
+ * - KErrNotFound - if content reference is not found in current
+ * plugin definition.
+ * - KErrNotSupported - if content selector is not supported by
+ * current plugin definition.
+ */
+ virtual TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue );
+
+ /**
+ * Invoked by the plug-in to change the property value of a specific content.
+ *
+ * @param aPlugin - Plug-in interface implementation.
+ * @param aElementId - id of content selector, MUST correspond
+ * single content supported by plug-in. The framework
+ * utilizes the id to find in the plugin xml defintion.
+ * @param aPropertyName - property name.
+ * @param aPropertyValue - property value.
+ * @param aValueType - value type.
+ * @return - Possible return values:
+ * - KErrNone - if content reference found.
+ * - KErrNotFound - if content reference is not found in current
+ * plugin definition.
+ * - KErrNotSupported - if content selector is not supported by
+ * current plugin definition.
+ */
+ virtual TInt SetProperty( CHsContentPublisher& aPlugin,
+ const TDesC8& aElementId,
+ const TDesC8& aPropertyName,
+ const TDesC8& aPropertyValue,
+ MAiContentObserver::TValueType aValueType);
+
+
+private:
+
+ /**
+ * Constructor for performing 1st stage construction
+ */
+ CWrtDataPluginObserver();
+
+ /**
+ * EPOC default constructor for performing 2nd stage construction
+ */
+ void ConstructL();
+
+ };
+
+#endif // WRTDATAPLUGINOBSERVER_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/src/mt_wrtdataplugin.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,532 @@
+/*
+* Copyright (c) 2010 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 "mt_wrtdataplugin.h"
+#include "wrtdatapluginobserver.h"
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/eunitdecorators.h>
+#include <hscontentpublisher.h>
+#include <wrtdatapluginuids.hrh>
+
+_LIT( KWRTPublisherName,"WRTWidget" );
+_LIT8( KNameSpace, "5" );
+
+
+// - Construction -----------------------------------------------------------
+
+MT_wrtdataplugin* MT_wrtdataplugin::NewL()
+ {
+ MT_wrtdataplugin* self = MT_wrtdataplugin::NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+MT_wrtdataplugin* MT_wrtdataplugin::NewLC()
+ {
+ MT_wrtdataplugin* self = new( ELeave ) MT_wrtdataplugin();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+MT_wrtdataplugin::~MT_wrtdataplugin()
+ {
+ if ( iPlugin )
+ {
+ delete iPlugin;
+ }
+ if ( iContentObserver )
+ {
+ delete iContentObserver;
+ }
+
+ }
+
+MT_wrtdataplugin::MT_wrtdataplugin()
+ {
+ }
+
+void MT_wrtdataplugin::ConstructL()
+ {
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// - Test methods -----------------------------------------------------------
+
+
+
+void MT_wrtdataplugin::SetupL( )
+ {
+
+
+ TUid uid = { WRTDP_UID_ECOM_IMPLEMENTATION_CONTENTPUBLISHER_DATAPLUGIN };
+ THsPublisherInfo pubInfo( uid, KWRTPublisherName, KNameSpace );
+ iPlugin = CHsContentPublisher::NewL( pubInfo );
+ iContentObserver = CWrtDataPluginObserver::NewL();
+
+ EUNIT_ASSERT( iPlugin );
+ EUNIT_ASSERT( iContentObserver );
+ __UHEAP_MARK;
+
+ }
+
+
+void MT_wrtdataplugin::Teardown( )
+ {
+ __UHEAP_MARKEND;
+ if ( iPlugin )
+ {
+ delete iPlugin;
+ iPlugin = NULL;
+ }
+ if ( iContentObserver )
+ {
+ delete iContentObserver;
+ iPlugin = NULL;
+ }
+
+
+ }
+
+
+void MT_wrtdataplugin::TestStartL()
+ {
+ TInt loop = 10000;
+
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Start(CHsContentPublisher::ESystemStartup);
+ iPlugin->Stop(CHsContentPublisher::ESystemShutdown);
+ }
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Start(CHsContentPublisher::EPageStartup);
+ iPlugin->Stop(CHsContentPublisher::EPageShutdown);
+ }
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+ }
+
+ EUNIT_ASSERT( ETrue );
+ }
+
+
+void MT_wrtdataplugin::TestStopL()
+ {
+ TInt loop = 10000;
+
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Start(CHsContentPublisher::ESystemStartup);
+ iPlugin->Stop(CHsContentPublisher::ESystemShutdown);
+ }
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Start(CHsContentPublisher::EPageStartup);
+ iPlugin->Stop(CHsContentPublisher::EPageShutdown);
+ }
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+ }
+
+ EUNIT_ASSERT( ETrue );
+ }
+
+
+void MT_wrtdataplugin::TestResumeL()
+ {
+ TInt loop = 10000;
+
+ iPlugin->Start(CHsContentPublisher::ESystemStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackground);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::ESystemShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPageStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackground);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPageShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackground);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+
+
+ // Suspend - Resume (EBackupRestore)
+
+ iPlugin->Start(CHsContentPublisher::ESystemStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackupRestore);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::ESystemShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPageStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackupRestore);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPageShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackupRestore);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+
+ // Suspend - Resume (EGeneralThemeChange)
+
+ iPlugin->Start(CHsContentPublisher::ESystemStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EGeneralThemeChange);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::ESystemShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPageStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EGeneralThemeChange);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPageShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EGeneralThemeChange);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+ EUNIT_ASSERT( ETrue );
+ }
+
+
+void MT_wrtdataplugin::TestSuspendL()
+ {
+ TInt loop = 10000;
+
+ iPlugin->Start(CHsContentPublisher::ESystemStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackground);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::ESystemShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPageStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackground);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPageShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackground);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+
+
+ // Suspend - Resume (EBackupRestore)
+
+ iPlugin->Start(CHsContentPublisher::ESystemStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackupRestore);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::ESystemShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPageStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackupRestore);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPageShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EBackupRestore);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+
+ // Suspend - Resume (EGeneralThemeChange)
+
+ iPlugin->Start(CHsContentPublisher::ESystemStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EGeneralThemeChange);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::ESystemShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPageStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EGeneralThemeChange);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPageShutdown);
+
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->Suspend(CHsContentPublisher::EGeneralThemeChange);
+ iPlugin->Resume(CHsContentPublisher::EForeground);
+ }
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+ EUNIT_ASSERT( ETrue );
+
+ }
+
+void MT_wrtdataplugin::TestSetOnlineL()
+ {
+ TInt loop = 10000;
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->SetOnline();
+ iPlugin->SetOffline();
+ }
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+ EUNIT_ASSERT( ETrue );
+ }
+
+void MT_wrtdataplugin::TestSetOfflineL()
+ {
+ TInt loop = 10000;
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ for ( TInt i = 0; i< loop ; i++ )
+ {
+ iPlugin->SetOnline();
+ iPlugin->SetOffline();
+ }
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+ EUNIT_ASSERT( ETrue );
+ }
+
+
+void MT_wrtdataplugin::TestSubscribeL()
+ {
+ iPlugin->SubscribeL(*iContentObserver);
+ // TODO: do some operations and check observer
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+
+void MT_wrtdataplugin::TestConfigureL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void MT_wrtdataplugin::TestSetPropertyL()
+ {
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ iPlugin->SetProperty(CHsContentPublisher::EPublisherContent,NULL);
+ TAny* any = iPlugin->GetProperty(CHsContentPublisher::EPublisherContent);
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+ EUNIT_ASSERT( any == NULL );
+ }
+
+
+void MT_wrtdataplugin::TestGetPropertyL()
+ {
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ iPlugin->SetProperty(CHsContentPublisher::EPublisherContent,NULL);
+ TAny* any = iPlugin->GetProperty(CHsContentPublisher::EPublisherContent);
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+ EUNIT_ASSERT( any == NULL );
+ }
+
+
+void MT_wrtdataplugin::TestHandleEventL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+
+
+void MT_wrtdataplugin::TestHasMenuItemL()
+ {
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ iPlugin->HasMenuItem(KNullDesC);
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+ EUNIT_ASSERT( ETrue );
+ }
+
+void MT_wrtdataplugin::TestExtensionL()
+ {
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ iPlugin->Extension(KNullUid);
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+ EUNIT_ASSERT( ETrue );
+
+ }
+
+void MT_wrtdataplugin::TestPublisherInfoL()
+ {
+ iPlugin->Start(CHsContentPublisher::EPluginStartup);
+ const THsPublisherInfo& publisherInfo = iPlugin->PublisherInfo();
+ // TODO: check publisherInfo.Uid(), publisherInfo.Name(), publisherInfo.Namespace()
+ iPlugin->Stop(CHsContentPublisher::EPluginShutdown);
+
+ EUNIT_ASSERT( ETrue );
+
+ }
+
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+ MT_wrtdataplugin,
+ "Add test suite description here.",
+ "MODULE" )
+
+EUNIT_TEST(
+ "StartL",
+ "WRTDataPlugin",
+ "StartL",
+ "FUNCTIONALITY",
+ SetupL, TestStartL, Teardown)
+
+
+EUNIT_TEST(
+ "StopL",
+ "WRTDataPlugin",
+ "StopL",
+ "FUNCTIONALITY",
+ SetupL, TestStopL, Teardown)
+
+EUNIT_TEST(
+ "ResumeL",
+ "WRTDataPlugin",
+ "ResumeL",
+ "FUNCTIONALITY",
+ SetupL, TestResumeL, Teardown)
+
+EUNIT_TEST(
+ "SuspendL",
+ "WRTDataPlugin",
+ "SuspendL",
+ "FUNCTIONALITY",
+ SetupL, TestSuspendL, Teardown)
+
+EUNIT_TEST(
+ "SetOnlineL",
+ "WRTDataPlugin",
+ "SetOnlineL",
+ "FUNCTIONALITY",
+ SetupL, TestSetOnlineL, Teardown)
+
+EUNIT_TEST(
+ "SetOfflineL",
+ "WRTDataPlugin",
+ "SetOfflineL",
+ "FUNCTIONALITY",
+ SetupL, TestSetOfflineL, Teardown)
+
+EUNIT_TEST(
+ "SubscribeL",
+ "WRTDataPlugin",
+ "SubscribeL",
+ "FUNCTIONALITY",
+ SetupL, TestSubscribeL, Teardown)
+
+EUNIT_TEST(
+ "ConfigureL",
+ "WRTDataPlugin",
+ "ConfigureL",
+ "FUNCTIONALITY",
+ SetupL, TestConfigureL, Teardown)
+
+EUNIT_TEST(
+ "SetPropertyL",
+ "WRTDataPlugin",
+ "SetPropertyL",
+ "FUNCTIONALITY",
+ SetupL, TestSetPropertyL, Teardown)
+
+EUNIT_TEST(
+ "GetPropertyL",
+ "WRTDataPlugin",
+ "GetPropertyL",
+ "FUNCTIONALITY",
+ SetupL, TestGetPropertyL, Teardown)
+
+EUNIT_TEST(
+ "HandleEventL",
+ "WRTDataPlugin",
+ "HandleEventL",
+ "FUNCTIONALITY",
+ SetupL, TestHandleEventL, Teardown)
+
+EUNIT_TEST(
+ "HasMenuItem",
+ "WRTDataPlugin",
+ "HasMenuItem",
+ "FUNCTIONALITY",
+ SetupL, TestHasMenuItemL, Teardown)
+
+EUNIT_TEST(
+ "Extension",
+ "WRTDataPlugin",
+ "Extension",
+ "FUNCTIONALITY",
+ SetupL, TestExtensionL, Teardown)
+
+EUNIT_TEST(
+ "PublisherInfo",
+ "WRTDataPlugin",
+ "PublisherInfo",
+ "FUNCTIONALITY",
+ SetupL, TestPublisherInfoL, Teardown)
+
+EUNIT_END_TEST_TABLE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/src/mt_wrtdataplugin_dllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2010 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 "mt_wrtdataplugin.h"
+#include <digia/eunit/ceunittestsuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return MT_wrtdataplugin::NewL();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/src/ut_wrtdataplugin.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,214 @@
+/*
+* Copyright (c) 2010 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 "ut_wrtdataplugin.h"
+#include "wrtdatapluginobserver.h"
+
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/eunitdecorators.h>
+#include <hscontentpublisher.h>
+#include <wrtdatapluginuids.hrh>
+#include <wrtdataplugin.h>
+
+_LIT( KWRTPublisherName,"WRTWidget" );
+_LIT8( KNameSpace, "5" );
+
+
+// - Construction -----------------------------------------------------------
+
+UT_wrtdataplugin* UT_wrtdataplugin::NewL()
+ {
+ UT_wrtdataplugin* self = UT_wrtdataplugin::NewLC();
+ CleanupStack::Pop();
+ return self;
+ }
+
+UT_wrtdataplugin* UT_wrtdataplugin::NewLC()
+ {
+ UT_wrtdataplugin* self = new( ELeave ) UT_wrtdataplugin();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+UT_wrtdataplugin::~UT_wrtdataplugin()
+ {
+ if ( iPlugin )
+ {
+ delete iPlugin;
+ }
+ if ( iContentObserver )
+ {
+ delete iContentObserver;
+ }
+
+ }
+
+UT_wrtdataplugin::UT_wrtdataplugin()
+ {
+ }
+
+void UT_wrtdataplugin::ConstructL()
+ {
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// - Test methods -----------------------------------------------------------
+
+
+void UT_wrtdataplugin::TestGetIdL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestGetTypeL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestRefreshL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestIsActive()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestPublishTextL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestPublishImageHandleL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestPublishImagePathL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestClean()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestShowLoadingIcon()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestHideLoadingIcon()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestData()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestNetworkStatus()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestStartTimer()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+
+void UT_wrtdataplugin::TestConfigureL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestRegisterL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestUpdatePublisherStatusL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestPublishInitialDataL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestPublishDefaultImageL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestPublishL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestDataRefreshL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestExecuteActionL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestIsPluginActive()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestNotifyPublisherL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestSetCommandBuffer()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+void UT_wrtdataplugin::TestHandleNotifyL()
+ {
+ EUNIT_ASSERT_DESC( EFalse, "Test not implemeted.");
+ }
+
+
+// - EUnit test table -------------------------------------------------------
+
+EUNIT_BEGIN_TEST_TABLE(
+ UT_wrtdataplugin,
+ "Add test suite description here.",
+ "MODULE" )
+
+/*EUNIT_TEST(
+ "StartL",
+ "WRTDataPlugin",
+ "StartL",
+ "FUNCTIONALITY",
+ SetupL, TestStartL, Teardown)
+*/
+EUNIT_END_TEST_TABLE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/src/ut_wrtdataplugin_dllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,24 @@
+/*
+* Copyright (c) 2010 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 "ut_wrtdataplugin.h"
+#include <digia/eunit/ceunittestsuite.h>
+
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_wrtdataplugin::NewL();
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wrtdataplugin/src/wrtdatapluginobserver.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,130 @@
+/*
+* Copyright (c) 2010 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 "wrtdatapluginobserver.h"
+
+CWrtDataPluginObserver::CWrtDataPluginObserver()
+ {
+ // No implementation required
+ }
+
+CWrtDataPluginObserver::~CWrtDataPluginObserver()
+ {
+ }
+
+CWrtDataPluginObserver* CWrtDataPluginObserver::NewLC()
+ {
+ CWrtDataPluginObserver* self = new (ELeave) CWrtDataPluginObserver();
+ CleanupStack::PushL(self);
+ self->ConstructL();
+ return self;
+ }
+
+CWrtDataPluginObserver* CWrtDataPluginObserver::NewL()
+ {
+ CWrtDataPluginObserver* self = CWrtDataPluginObserver::NewLC();
+ CleanupStack::Pop(); // self;
+ return self;
+ }
+
+void CWrtDataPluginObserver::ConstructL()
+ {
+
+ }
+
+TInt CWrtDataPluginObserver::StartTransaction( TInt /*aTxId*/ )
+ {
+ return KErrNotSupported;
+ }
+
+TInt CWrtDataPluginObserver::Commit( TInt /*aTxId */)
+ {
+ return KErrNone;
+ }
+
+
+TInt CWrtDataPluginObserver::CancelTransaction( TInt /*aTxId */)
+ {
+ return KErrNone;
+ }
+
+
+TBool CWrtDataPluginObserver::CanPublish( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aIndex */)
+ {
+ return EFalse;
+ }
+
+
+TInt CWrtDataPluginObserver::Publish( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aResource*/, TInt /*aIndex*/ )
+ {
+ return KErrNotSupported;
+ }
+
+
+TInt CWrtDataPluginObserver::Publish( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, const TDesC16& /*aText*/, TInt /*aIndex */)
+ {
+ return KErrNotSupported;
+ }
+
+
+TInt CWrtDataPluginObserver::Publish( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, const TDesC8& /*aBuf*/, TInt /*aIndex */)
+ {
+ return KErrNotSupported;
+ }
+
+
+TInt CWrtDataPluginObserver::Publish( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, RFile& /*aFile*/, TInt /*aIndex */)
+ {
+ return KErrNotSupported;
+ }
+
+TInt CWrtDataPluginObserver::Clean( CHsContentPublisher& /*aPlugin*/, TInt /*aContent*/, TInt /*aIndex */)
+ {
+ return KErrNotSupported;
+ }
+
+
+TAny* CWrtDataPluginObserver::Extension( TUid /*aUid */)
+ {
+ return NULL;
+ }
+
+
+TBool CWrtDataPluginObserver::RequiresSubscription( const THsPublisherInfo& /*aPublisherInfo */) const
+ {
+ return EFalse;
+ }
+
+
+TInt CWrtDataPluginObserver::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue */)
+ {
+ return KErrNotSupported;
+ }
+
+TInt CWrtDataPluginObserver::SetProperty( CHsContentPublisher& /*aPlugin*/,
+ const TDesC8& /*aElementId*/,
+ const TDesC8& /*aPropertyName*/,
+ const TDesC8& /*aPropertyValue*/,
+ MAiContentObserver::TValueType /*aValueType*/)
+ {
+ return KErrNotSupported;
+ }
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,33 @@
+/*
+* 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:
+*
+*/
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+#include "../ut_aiwspluginanim/group/bld.inf"
+#include "../ut_numerickeyhandler/group/bld.inf"
+#include "../ut_modifierkeytracker/group/bld.inf"
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/animgeneralfunctions_stub.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,220 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// animgeneralfunctions_stub.cpp
+
+#include "animgeneralfunctions_stub.h"
+
+CAnimGeneralFunctionsStub* CAnimGeneralFunctionsStub::NewL()
+ {
+ return new (ELeave) CAnimGeneralFunctionsStub;
+ }
+
+CAnimGeneralFunctionsStub::~CAnimGeneralFunctionsStub()
+ {
+ delete iWindowName;
+ }
+
+CAnimGeneralFunctionsStub::CAnimGeneralFunctionsStub()
+ {
+ }
+
+void CAnimGeneralFunctionsStub::Animate(TDateTime* /*aDateTime*/)
+ {
+ }
+
+void CAnimGeneralFunctionsStub::SetSync(TAnimSync /*aSyncMode*/)
+ {
+ }
+
+void CAnimGeneralFunctionsStub::SetInterval(TInt /*aInterval*/)
+ {
+ }
+
+void CAnimGeneralFunctionsStub::SetNextInterval(TInt /*aInterval*/)
+ {
+ }
+
+TDateTime CAnimGeneralFunctionsStub::SystemTime() const
+ {
+ return TDateTime();
+ }
+
+TBool CAnimGeneralFunctionsStub::FlashStateOn() const
+ {
+ return EFalse;
+ }
+
+MAnimGeneralFunctions::TAnimSync CAnimGeneralFunctionsStub::Sync() const
+ {
+ return ESyncNone;
+ }
+
+const CFbsScreenDevice* CAnimGeneralFunctionsStub::ScreenDevice()
+ {
+ return NULL;
+ }
+
+CFbsBitmap* CAnimGeneralFunctionsStub::DuplicateBitmapL(TInt /*aHandle*/)
+ {
+ return NULL;
+ }
+
+CFbsFont* CAnimGeneralFunctionsStub::DuplicateFontL(TInt /*aHandle*/)
+ {
+ return NULL;
+ }
+
+void CAnimGeneralFunctionsStub::CloseFont(CFbsFont *)
+ {
+ }
+
+const RThread& CAnimGeneralFunctionsStub::Client()
+ {
+ return iThread;
+ }
+
+void CAnimGeneralFunctionsStub::ReplyBuf(const TDesC8& /*aDes*/)
+ {
+ }
+
+void CAnimGeneralFunctionsStub::ReplyBuf(const TDesC16& /*aDes*/)
+ {
+ }
+
+void CAnimGeneralFunctionsStub::Panic() const
+ {
+ }
+
+void CAnimGeneralFunctionsStub::GetRawEvents(TBool aGetEvents) const
+ {
+ iGetEvents = aGetEvents;
+ }
+
+void CAnimGeneralFunctionsStub::PostRawEvent(const TRawEvent &aRawEvent) const
+ {
+ iPostedRawEvent = aRawEvent;
+ }
+
+void CAnimGeneralFunctionsStub::PostKeyEvent(const TKeyEvent &aRawEvent) const
+ {
+ iPostedKeyEvent = aRawEvent;
+ }
+
+const RMessagePtr2* CAnimGeneralFunctionsStub::Message()
+ {
+ return NULL;
+ }
+
+TAny* CAnimGeneralFunctionsStub::ExtendedInterface(TInt aInterface)
+ {
+ TAny* result = NULL;
+
+ switch( aInterface )
+ {
+ case MAnimGeneralFunctions::EWindowExtensionInterface:
+ result = static_cast< MAnimGeneralFunctionsWindowExtension* >( this );
+ break;
+ default:
+ break;
+ }
+
+ return result;
+ }
+
+TInt CAnimGeneralFunctionsStub::RegisterForNotifications(TUint32 /*aNotifications*/)
+ {
+ return KErrNone;
+ }
+
+void MAnimGeneralFunctions::Reserved1() const
+ {
+ }
+
+void MAnimGeneralFunctions::Reserved2() const
+ {
+ }
+
+void MAnimGeneralFunctions::Reserved3() const
+ {
+ }
+
+TInt CAnimGeneralFunctionsStub::Screens() const
+ {
+ return 1;
+ }
+
+TInt CAnimGeneralFunctionsStub::FocusScreens() const
+ {
+ return 1;
+ }
+
+void CAnimGeneralFunctionsStub::SetFocusScreen(TInt /*aScreenNo*/)
+ {
+ }
+
+TInt CAnimGeneralFunctionsStub::WindowGroups(TInt /*aScreen*/) const
+ {
+ return 1;
+ }
+
+TBool CAnimGeneralFunctionsStub::WindowGroupInfo(TWindowGroupInfo& aInfo,TInt aScreen, TInt aFullOrdinalPosition) const
+ {
+ if ( aScreen == 0 && aFullOrdinalPosition == 0 )
+ {
+ aInfo = iWgInfo;
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+TBool CAnimGeneralFunctionsStub::WindowGroupName(TPtrC& aWindowName, TInt aScreen, TInt aFullOrdinalPosition) const
+ {
+ if ( aScreen == 0 && aFullOrdinalPosition == 0 && iWindowName )
+ {
+ aWindowName.Set( *iWindowName );
+ return ETrue;
+ }
+ return EFalse;
+ }
+
+TInt CAnimGeneralFunctionsStub::SetOrdinalPosition(TInt aWindowGroupId,TInt aPos,TInt aOrdinalPriority)
+ {
+ iSetOrdinalPosition.iWindowGroupId = aWindowGroupId;
+ iSetOrdinalPosition.iPos = aPos;
+ iSetOrdinalPosition.iOrdinalPriority = aOrdinalPriority;
+ return KErrNone;
+ }
+
+void CAnimGeneralFunctionsStub::WindowConfig(TWindowConfig& /*aWindowConfig*/) const
+ {
+
+ }
+
+void MAnimGeneralFunctionsWindowExtension::Reserved1() const
+ {
+ }
+
+void MAnimGeneralFunctionsWindowExtension::Reserved2() const
+ {
+ }
+
+void MAnimGeneralFunctionsWindowExtension::Reserved3() const
+ {
+ }
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/animgeneralfunctions_stub.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// animgeneralfunctions_stub.h
+
+#ifndef ANIMGENERALFUNCTIONS_STUB_H
+#define ANIMGENERALFUNCTIONS_STUB_H
+
+#include <w32adll.h>
+
+class CAnimGeneralFunctionsStub :
+ public CBase,
+ public MAnimGeneralFunctions,
+ public MAnimGeneralFunctionsWindowExtension
+ {
+public:
+ static CAnimGeneralFunctionsStub* NewL();
+ ~CAnimGeneralFunctionsStub();
+
+private:
+ CAnimGeneralFunctionsStub();
+
+public: // from MAnimGeneralFunctions
+ void Animate(TDateTime *aDateTime);
+ void SetSync(TAnimSync aSyncMode);
+ void SetInterval(TInt aInterval);
+ void SetNextInterval(TInt aInterval);
+ TDateTime SystemTime() const;
+ TBool FlashStateOn() const;
+ TAnimSync Sync() const;
+ const CFbsScreenDevice *ScreenDevice();
+ CFbsBitmap *DuplicateBitmapL(TInt aHandle);
+ CFbsFont *DuplicateFontL(TInt aHandle);
+ void CloseFont(CFbsFont *);
+ const RThread &Client();
+ void ReplyBuf(const TDesC8 &aDes);
+ void ReplyBuf(const TDesC16 &aDes);
+ void Panic() const;
+ void GetRawEvents(TBool aGetEvents) const;
+ void PostRawEvent(const TRawEvent &aRawEvent) const;
+ void PostKeyEvent(const TKeyEvent &aRawEvent) const;
+ const RMessagePtr2* Message();
+ TAny* ExtendedInterface(TInt aInterface);
+ TInt RegisterForNotifications(TUint32 aNotifications);
+
+public: // from MAnimGeneralFunctionsWindowExtension
+ TInt Screens() const;
+ TInt FocusScreens() const;
+ void SetFocusScreen(TInt aScreenNo);
+ TInt WindowGroups(TInt aScreen) const;
+ TBool WindowGroupInfo(TWindowGroupInfo& aInfo,TInt aScreen,TInt aFullOrdinalPosition) const;
+ TBool WindowGroupName(TPtrC& aWindowName,TInt aScreen,TInt aFullOrdinalPosition) const;
+ TInt SetOrdinalPosition(TInt aWindowGroupId,TInt aPos,TInt aOrdinalPriority);
+ void WindowConfig(TWindowConfig& aWindowConfig) const;
+
+public: // Data
+ RThread iThread;
+ mutable TBool iGetEvents;
+ mutable TRawEvent iPostedRawEvent;
+ mutable TKeyEvent iPostedKeyEvent;
+ TWindowGroupInfo iWgInfo;
+ HBufC* iWindowName;
+ struct { TInt iWindowGroupId; TInt iPos; TInt iOrdinalPriority; } iSetOrdinalPosition;
+ };
+
+#endif // ANIMGENERALFUNCTIONS_STUB_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/featmgr_stub.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,60 @@
+/*
+* Copyright (c) 2002 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: Feature manager API
+*
+*/
+
+// System includes
+
+// User includes
+#include "featmgr_stub.h"
+
+#include "ut_aiwspluginanimtls.h"
+
+// Constants
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS =======
+// ----------------------------------------------------------------------------
+// FeatureManager::InitializeLibL()
+//
+// ----------------------------------------------------------------------------
+//
+void FeatureManager::InitializeLibL()
+ {
+ UT_AiWsPluginAnimTls::Instance()->IncFeatMgrCount();
+ }
+
+// ----------------------------------------------------------------------------
+// FeatureManager::UnInitializeLib()
+//
+// ----------------------------------------------------------------------------
+//
+void FeatureManager::UnInitializeLib()
+ {
+ UT_AiWsPluginAnimTls::Instance()->DecFeatMgrCount();
+ }
+
+// ----------------------------------------------------------------------------
+// FeatureManager::FeatureSupported()
+//
+// ----------------------------------------------------------------------------
+//
+TBool FeatureManager::FeatureSupported( TInt aFeature )
+ {
+ return UT_AiWsPluginAnimTls::Instance()->FeatureSupported(aFeature);
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/featmgr_stub.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,68 @@
+/*
+* Copyright (c) 2002 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: Feature manager API
+*
+*/
+
+
+#ifndef _FEATUREMANAGER_STUB_H
+#define _FEATUREMANAGER_STUB_H
+
+// INCLUDES
+#include <e32base.h>
+
+// FORWARD DECLARATIONS
+class CFeatMgrTlsData;
+
+/**
+ * Feature manager API stub.
+ */
+NONSHARABLE_CLASS( FeatureManager ) : public CBase
+ {
+ public:
+ /**
+ * This must be called in the scope of the thread before calling
+ * any other methods. It sets up TLS. Uninitialization is done
+ * by calling the UnInitializeLibL() function.
+ *
+ * Leave conditions: out of memory.
+ */
+ static void InitializeLibL();
+
+ /**
+ * This must be called in the scope of the thread after calling
+ * InitializeLibL(). It frees the allocated TLS.
+ */
+ static void UnInitializeLib();
+
+ /**
+ * Fetches information whether a certain feature is supported.
+ *
+ * @since 1.2
+ * @param aFeature feature ID
+ * @return feature support status
+ */
+ static TBool FeatureSupported( TInt aFeature );
+
+ private:
+
+ /**
+ * C++ default constructor.
+ * Prohibits instantiation of this class.
+ */
+ FeatureManager();
+ };
+
+#endif // _FEATUREMANAGER_STUB_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/numerickeyhandler_stub.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,74 @@
+/*
+* Copyright (c) 2006 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: Stub Numeric key forwarding handler implementation for Active Idle
+* WS Plug-in.
+*
+*/
+
+
+// System includes
+
+// User includes
+#include "numerickeyhandler_stub.h"
+
+#include "ut_aiwspluginanimtls.h"
+
+namespace AiWsPlugin {
+
+// Constants
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS =======
+// ----------------------------------------------------------------------------
+// CNumericKeyHandler::CNumericKeyHandler()
+//
+// ----------------------------------------------------------------------------
+//
+CNumericKeyHandler::CNumericKeyHandler( TInt aTargetWgId,
+ MAnimGeneralFunctionsWindowExtension* aWindowExt ) :
+ iTargetWgId( aTargetWgId ), iWindowExt( aWindowExt )
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CNumericKeyHandler::NewLC()
+//
+// ----------------------------------------------------------------------------
+//
+CNumericKeyHandler* CNumericKeyHandler::NewLC( TInt aTargetWgId,
+ MAnimGeneralFunctionsWindowExtension* aWindowExt )
+ {
+ CNumericKeyHandler* self =
+ new ( ELeave ) CNumericKeyHandler( aTargetWgId, aWindowExt );
+
+ CleanupStack::PushL( self );
+
+ UT_AiWsPluginAnimTls::Instance()->AddEventHandlerL( *self );
+
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// CNumericKeyHandler::~CNumericKeyHandler()
+//
+// ----------------------------------------------------------------------------
+//
+CNumericKeyHandler::~CNumericKeyHandler()
+ {
+ }
+
+} // namespace AiWsPlugin
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/numerickeyhandler_stub.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,61 @@
+/*
+* Copyright (c) 2006 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: Numeric key forwarding handler for Active Idle WS Plug-in.
+*
+*/
+
+
+#ifndef _NUMERICKEYHANDLER_STUB_H
+#define _NUMERICKEYHANDLER_STUB_H
+
+#include "testeventhandler_stub.h"
+
+class MAnimGeneralFunctionsWindowExtension;
+class MAiPSPropertyObserver;
+
+namespace AiWsPlugin {
+
+/**
+ * (STUB) Numeric key forwarding handler for Active Idle WS Plug-in.
+ */
+class CNumericKeyHandler :
+ public T_AiWsPlugin::CTestEventHandler
+ {
+public:
+ /**
+ * Creates a new instance of this class.
+ *
+ * @param aTargetWgId Window Group id of the target application where
+ * numeric key events are forwarded.
+ * @return A new object of this class. The returned object is left on the
+ * cleanup stack.
+ */
+ static CNumericKeyHandler* NewLC
+ ( TInt aTargetWgId, MAnimGeneralFunctionsWindowExtension* aWindowExt );
+
+ ~CNumericKeyHandler();
+
+private:
+ CNumericKeyHandler
+ ( TInt aTargetWgId, MAnimGeneralFunctionsWindowExtension* aWindowExt );
+
+public: // data
+ TInt iTargetWgId;
+ MAnimGeneralFunctionsWindowExtension* iWindowExt;
+ };
+
+} // namespace AiWsPlugin
+
+
+#endif // _NUMERICKEYHANDLER_STUB_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/testeventhandler_stub.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,131 @@
+/*
+* Copyright (c) 2006 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: Keylock handler for Active Idle WS Plug-in.
+*
+*/
+
+// System includes
+
+// User includes
+#include "testeventhandler_stub.h"
+
+// Constants
+
+namespace T_AiWsPlugin {
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS =======
+// ----------------------------------------------------------------------------
+// operator==
+//
+// ----------------------------------------------------------------------------
+//
+static TBool operator==( const TRawEvent& aLhs, const TRawEvent& aRhs )
+ {
+ const TUint8* lhs = reinterpret_cast<const TUint8*>( &aLhs );
+ const TUint8* rhs = reinterpret_cast<const TUint8*>( &aRhs );
+
+ return ( Mem::Compare( lhs, sizeof(TRawEvent), rhs, sizeof(TRawEvent) ) == 0 );
+ }
+
+// ----------------------------------------------------------------------------
+// ResetEvent
+//
+// ----------------------------------------------------------------------------
+//
+static void ResetEvent( TRawEvent& aEvent )
+ {
+ Mem::FillZ( &aEvent, sizeof( TRawEvent ) );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestEventHandler::~CTestEventHandler()
+//
+// ----------------------------------------------------------------------------
+//
+CTestEventHandler::~CTestEventHandler()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// CTestEventHandler::ResetLastEvent()
+//
+// ----------------------------------------------------------------------------
+//
+void CTestEventHandler::ResetLastEvent()
+ {
+ ResetEvent( iLastEvent );
+ }
+
+// ----------------------------------------------------------------------------
+// CTestEventHandler::RespondToEvent()
+//
+// ----------------------------------------------------------------------------
+//
+void CTestEventHandler::RespondToEvent( const TRawEvent& aEvent )
+ {
+ iRespondToEvent = aEvent;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestEventHandler::SetUiStateQuery()
+//
+// ----------------------------------------------------------------------------
+//
+void CTestEventHandler::SetUiStateQuery( MUiState& aUiState )
+ {
+ iUiState = &aUiState;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestEventHandler::FocusChanged()
+//
+// ----------------------------------------------------------------------------
+//
+void CTestEventHandler::FocusChanged( TBool aState )
+ {
+ iFocus = aState;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestEventHandler::OfferRawEvent()
+//
+// ----------------------------------------------------------------------------
+//
+TBool CTestEventHandler::OfferRawEvent( const TRawEvent& aRawEvent )
+ {
+ if ( iRespondToEvent == aRawEvent )
+ {
+ iLastEvent = aRawEvent;
+
+ ResetEvent( iRespondToEvent );
+ return ETrue;
+ }
+
+ return EFalse;
+ }
+
+// ----------------------------------------------------------------------------
+// CTestEventHandler::CTestEventHandler()
+//
+// ----------------------------------------------------------------------------
+//
+CTestEventHandler::CTestEventHandler()
+ {
+ }
+
+} // namespace T_AiWsPlugin
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/testeventhandler_stub.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,66 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// testeventhandler.h
+
+#ifndef _TESTEVENTHANDLER_STUB_H
+#define _TESTEVENTHANDLER_STUB_H
+
+#include "eventhandler.h"
+#include <e32event.h>
+
+namespace T_AiWsPlugin {
+
+using AiWsPlugin::MUiState;
+
+/**
+ * Common test event handler base for AiWsPlugin unit tests.
+ */
+class CTestEventHandler :
+ public AiWsPlugin::CEventHandler
+ {
+public:
+ ~CTestEventHandler();
+
+public: // Testing functions
+ MUiState* UiState() const { return iUiState; }
+ TBool Focus() const { return iFocus; }
+ const TRawEvent& LastEvent() const { return iLastEvent; }
+ void ResetLastEvent();
+ void RespondToEvent( const TRawEvent& aEvent );
+
+private:
+// from base class CEventHandler
+ void SetUiStateQuery( MUiState& aUiState );
+ void FocusChanged( TBool aState );
+ TBool OfferRawEvent(const TRawEvent& aRawEvent);
+
+protected:
+ CTestEventHandler();
+
+private: // data
+ AiWsPlugin::MUiState* iUiState;
+ TBool iFocus;
+ TRawEvent iLastEvent;
+ TRawEvent iRespondToEvent;
+ };
+
+} // namespace T_AiWsPlugin
+
+
+#endif // _TESTEVENTHANDLER_STUB_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/stub/wsanim_stub.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,46 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// wsanim.h
+
+#ifndef _WSANIM_STUB_H
+#define _WSANIM_STUB_H
+
+#include <w32adll.h>
+
+class MAnimGeneralFunctions;
+
+/**
+ * Stub of CWsAnim for CAiWsPluginAnim unit test.
+ */
+class CWsAnim : public CBase
+ {
+public:
+ static void SetFunctions
+ (CAnim& aAnim, MAnimGeneralFunctions* aFunctions)
+ {
+ // CWsAnim is friend of CAnim which enables setting its protected members
+ aAnim.iFunctions = aFunctions;
+ }
+
+private:
+ // Private constructor to prevent instantiation of this class
+ CWsAnim() {}
+ };
+
+
+#endif // _WSANIM_STUB_H
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/bwins/ut_aiwspluginanimu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/eabi/ut_aiwspluginanimu.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,15 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _ZTI15CAiWsPluginAnim @ 2 NONAME
+ _ZTI21MAnimGeneralFunctions @ 3 NONAME
+ _ZTI25CAnimGeneralFunctionsStub @ 4 NONAME
+ _ZTI36MAnimGeneralFunctionsWindowExtension @ 5 NONAME
+ _ZTIN10AiWsPlugin18CNumericKeyHandlerE @ 6 NONAME
+ _ZTIN12T_AiWsPlugin17CTestEventHandlerE @ 7 NONAME
+ _ZTV15CAiWsPluginAnim @ 8 NONAME
+ _ZTV21MAnimGeneralFunctions @ 9 NONAME
+ _ZTV25CAnimGeneralFunctionsStub @ 10 NONAME
+ _ZTV36MAnimGeneralFunctionsWindowExtension @ 11 NONAME
+ _ZTVN10AiWsPlugin18CNumericKeyHandlerE @ 12 NONAME
+ _ZTVN12T_AiWsPlugin17CTestEventHandlerE @ 13 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 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: homescreensrv main bld.inf file for module tests
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+ut_aiwspluginanim.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/group/ut_aiwspluginanim.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,59 @@
+/*
+* Copyright (c) 2009 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: project file
+*
+*/
+
+#include <platform_paths.hrh>
+#include <eunitcaps.h>
+
+
+TARGET ut_aiwspluginanim.dll
+TARGETTYPE dll
+UID 0x1000af5a 0x01700000
+VENDORID VID_DEFAULT
+
+CAPABILITY EUNIT_CAPS
+MACRO _AIWSPLUGIN_UNIT_TEST
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../../../../plugins/wsplugin/inc
+USERINCLUDE ../../../../inc/common
+
+USERINCLUDE ../../stub
+USERINCLUDE ../inc
+
+SOURCEPATH ../../../../plugins/wsplugin/src
+SOURCE aiwspluginanim.cpp
+SOURCE modifierkeytracker.cpp
+
+SOURCEPATH ../src
+SOURCE ut_aiwspluginanim.cpp
+SOURCE ut_aiwspluginanimtls.cpp
+SOURCE ut_aiwspluginanim_dllmain.cpp
+
+SOURCEPATH ../../stub
+SOURCE featmgr_stub.cpp
+SOURCE testeventhandler_stub.cpp
+SOURCE numerickeyhandler_stub.cpp
+SOURCE animgeneralfunctions_stub.cpp
+
+LIBRARY aiutils.lib
+LIBRARY euser.lib
+LIBRARY cone.lib
+LIBRARY EUnit.lib
+LIBRARY EUnitUtil.lib
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/inc/ut_aiwspluginanim.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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: EUnit unit test class for AiWsPlugin
+*
+*/
+
+
+#ifndef _UT_CAIWSPLUGINANIM_H
+#define _UT_CAIWSPLUGINANIM_H
+
+// System includes
+#include <e32base.h>
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// User includes
+
+// Forward declarations
+class CAiWsPluginAnim;
+class CAnimGeneralFunctionsStub;
+class UT_AiWsPluginAnimTls;
+
+// Clas declaration
+NONSHARABLE_CLASS( UT_AiWsPluginAnim ) : public CEUnitTestSuiteClass
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_AiWsPluginAnim* NewL();
+ static UT_AiWsPluginAnim* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_AiWsPluginAnim();
+
+private:
+ // Constructors and destructors
+
+ UT_AiWsPluginAnim();
+ void ConstructL();
+
+private:
+ // New methods
+
+ void EmptySetup();
+ void SetupTlsL();
+ void SetupDependenciesL();
+ void SetupTestObjL(TBool aHasFocus);
+ void SetupNoSliderL( TBool aHasFocus );
+ void SetupNoSliderL();
+ void SetupL(TBool aHasFocus);
+ void SetupL();
+ void Teardown();
+
+ void T_ConstructL(TBool aHasFocus);
+ void T_ConstructL();
+ void T_CAiWsPluginAnim_EmptyFunctionsL();
+ void T_CAiWsPluginAnim_FocusChangedL( TBool aFocus );
+ void T_CAiWsPluginAnim_FocusChangedL();
+ void T_CAiWsPluginAnim_OfferRawEventL();
+
+private:
+ // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ CAiWsPluginAnim* iCAiWsPluginAnim;
+ CAnimGeneralFunctionsStub* iAnimGeneralFunctions;
+ UT_AiWsPluginAnimTls* iTls;
+ TInt iFeatMgrCount;
+ };
+
+#endif // _UT_CAIWSPLUGINANIM_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/inc/ut_aiwspluginanimtls.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+
+#ifndef _UT_AIWSPLUGINANIMTLS_H
+#define _UT_AIWSPLUGINANIMTLS_H
+
+// System includes
+#include <e32base.h>
+#include <e32hashtab.h>
+
+// User incldues
+#include "testeventhandler_stub.h"
+
+// Forward declarations
+
+/**
+ * TLS shared test data holder for CAiWsPluginAnim unit tests.
+ */
+NONSHARABLE_CLASS( UT_AiWsPluginAnimTls )
+ : public CBase
+ {
+public:
+ static void CreateL();
+ static UT_AiWsPluginAnimTls* Instance();
+ static void Destroy();
+
+private:
+ UT_AiWsPluginAnimTls();
+ void ConstructL();
+ ~UT_AiWsPluginAnimTls();
+
+public: // New methods
+ template<class EventHandler_t>
+ EventHandler_t* FindEventHandler() const;
+
+ void AddEventHandlerL( T_AiWsPlugin::CTestEventHandler& aHandler );
+ TArray<T_AiWsPlugin::CTestEventHandler*> EventHandlers() const;
+
+ void IncFeatMgrCount();
+ void DecFeatMgrCount();
+ TInt FeatMgrCount() const;
+ TBool FeatureSupported( TInt aFeatureId ) const;
+ void SetFeatureSupportedL( TInt aFeatureId, TBool aValue );
+
+private: // Data
+ RPointerArray<T_AiWsPlugin::CTestEventHandler> iEventHandlers;
+ TInt iFeatMgrCount;
+ RHashMap< TInt, TBool > iFeatures;
+ };
+
+
+template<class EventHandler_t>
+EventHandler_t* UT_AiWsPluginAnimTls::FindEventHandler() const
+ {
+ EventHandler_t* result = NULL;
+ const TInt count = iEventHandlers.Count();
+ for( TInt i = 0; i < count && !result; ++i )
+ {
+ T_AiWsPlugin::CTestEventHandler* handler = iEventHandlers[i];
+ result = dynamic_cast<EventHandler_t*>( handler );
+ }
+ return result;
+ }
+
+#endif // _UT_AIWSPLUGINANIMTLS_H
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/src/ut_aiwspluginanim.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,477 @@
+/*
+* 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:
+*
+*/
+
+
+// System includes
+#include <e32base.h>
+#include <e32cmn.h>
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/teunitassertioninfo.h>
+#include <digia/eunit/eunitdecorators.h>
+
+// User includes
+#include "aiwspluginanim.h"
+
+#include "animgeneralfunctions_stub.h"
+#include "numerickeyhandler_stub.h"
+#include "wsanim_stub.h"
+#include "testeventhandler_stub.h"
+
+#include "ut_aiwspluginanimtls.h"
+#include "ut_aiwspluginanim.h"
+
+// Constants
+namespace
+ {
+ const TInt KAiWgId = 42;
+ const TInt KTargetWgId = KAiWgId + 1;
+ const TAiWsPluginAnimInitData KWsPluginInitData =
+ { KAiWgId, KTargetWgId };
+ const TBool KNoFocus = EFalse;
+ }
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ----------------------------------------------------------------------------
+// ResetEvent()
+//
+// ----------------------------------------------------------------------------
+//
+void ResetEvent( TRawEvent& aEvent )
+ {
+ Mem::FillZ( &aEvent, sizeof( TRawEvent ) );
+ }
+
+// ----------------------------------------------------------------------------
+// operator==()
+//
+// ----------------------------------------------------------------------------
+//
+TBool operator==( const TRawEvent& aLhs, const TRawEvent& aRhs )
+ {
+ const TUint8* lhs = reinterpret_cast<const TUint8*>( &aLhs );
+ const TUint8* rhs = reinterpret_cast<const TUint8*>( &aRhs );
+ return ( Mem::Compare( lhs, sizeof(TRawEvent), rhs, sizeof(TRawEvent) ) == 0 );
+ }
+
+// ======== MEMBER FUNCTIONS =======
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::NewL()
+//
+// ----------------------------------------------------------------------------
+//
+UT_AiWsPluginAnim* UT_AiWsPluginAnim::NewL()
+ {
+ UT_AiWsPluginAnim* self = UT_AiWsPluginAnim::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::NewLC()
+//
+// ----------------------------------------------------------------------------
+//
+UT_AiWsPluginAnim* UT_AiWsPluginAnim::NewLC()
+ {
+ UT_AiWsPluginAnim* self = new( ELeave ) UT_AiWsPluginAnim();
+ CleanupStack::PushL( self );
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::~UT_AiWsPluginAnim()
+//
+// ----------------------------------------------------------------------------
+//
+UT_AiWsPluginAnim::~UT_AiWsPluginAnim()
+ {
+ delete iCAiWsPluginAnim;
+ delete iAnimGeneralFunctions;
+ UT_AiWsPluginAnimTls::Destroy();
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::UT_AiWsPluginAnim()
+//
+// ----------------------------------------------------------------------------
+//
+UT_AiWsPluginAnim::UT_AiWsPluginAnim()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::ConstructL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::EmptySetup()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::EmptySetup()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::SetupTlsL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::SetupTlsL()
+ {
+ if ( !iTls )
+ {
+ UT_AiWsPluginAnimTls::CreateL();
+ iTls = UT_AiWsPluginAnimTls::Instance();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::SetupDependenciesL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::SetupDependenciesL()
+ {
+ if ( !iAnimGeneralFunctions )
+ {
+ iAnimGeneralFunctions = CAnimGeneralFunctionsStub::NewL();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::SetupTestObjL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::SetupTestObjL( TBool aHasFocus )
+ {
+ CAiWsPluginAnim* obj = new (ELeave) CAiWsPluginAnim;
+ CleanupStack::PushL( obj );
+
+ CWsAnim::SetFunctions( *obj, iAnimGeneralFunctions );
+ obj->ConstructL( const_cast<TAiWsPluginAnimInitData*>
+ (&KWsPluginInitData), aHasFocus );
+
+ CleanupStack::Pop( obj );
+ iCAiWsPluginAnim = obj;
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::SetupL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::UT_AiWsPluginAnim::SetupL( TBool aHasFocus )
+ {
+ SetupTlsL();
+ SetupDependenciesL();
+ SetupTestObjL( aHasFocus );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::SetupL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::SetupL()
+ {
+ SetupL( KNoFocus );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::SetupNoSliderL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::SetupNoSliderL( TBool aHasFocus )
+ {
+ SetupTlsL();
+ iTls->SetFeatureSupportedL( KFeatureIdKeypadNoSlider, ETrue );
+ SetupDependenciesL();
+ SetupTestObjL( aHasFocus );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::SetupNoSliderL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::SetupNoSliderL()
+ {
+ SetupNoSliderL( KNoFocus );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::Teardown()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::Teardown()
+ {
+ delete iCAiWsPluginAnim;
+ iCAiWsPluginAnim = NULL;
+
+ delete iAnimGeneralFunctions;
+ iAnimGeneralFunctions = NULL;
+
+ if ( iTls )
+ {
+ // Store feature manager ref count for testing in T_ConstructL
+ iFeatMgrCount = iTls->FeatMgrCount();
+ }
+
+ UT_AiWsPluginAnimTls::Destroy();
+ iTls = NULL;
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::T_ConstructL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::T_ConstructL( TBool aHasFocus )
+ {
+ // Test that iCAiWsPluginAnim is in the correct state
+ EUNIT_ASSERT_EQUALS( iCAiWsPluginAnim->HasFocus(), aHasFocus );
+ EUNIT_ASSERT_EQUALS( iCAiWsPluginAnim->Modifiers(), 0 );
+
+ // Test that event handlers are initialized to correct state
+ TArray<T_AiWsPlugin::CTestEventHandler*>
+ eventHandlers( iTls->EventHandlers() );
+
+ for( TInt i = 0; i < eventHandlers.Count(); ++i )
+ {
+ T_AiWsPlugin::CTestEventHandler* handler = eventHandlers[i];
+ EUNIT_ASSERT_EQUALS( handler->Focus(), aHasFocus );
+ EUNIT_ASSERT( handler->UiState() );
+ EUNIT_ASSERT_EQUALS( handler->UiState()->HasFocus(), aHasFocus );
+ EUNIT_ASSERT_EQUALS( handler->UiState()->Modifiers(), 0 );
+ }
+
+ // Test that numeric key handler is correctly set up
+ AiWsPlugin::CNumericKeyHandler* numKeyHandler =
+ iTls->FindEventHandler< AiWsPlugin::CNumericKeyHandler >();
+
+ EUNIT_ASSERT( numKeyHandler );
+ EUNIT_ASSERT_EQUALS( numKeyHandler->iTargetWgId, KTargetWgId );
+
+ MAnimGeneralFunctionsWindowExtension* ext =
+ static_cast<MAnimGeneralFunctionsWindowExtension*>(
+ iAnimGeneralFunctions->ExtendedInterface
+ ( MAnimGeneralFunctions::EWindowExtensionInterface ) );
+
+ EUNIT_ASSERT_EQUALS( numKeyHandler->iWindowExt, ext );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::T_ConstructL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::T_ConstructL()
+ {
+ // Test construction with no focus
+ SetupL( EFalse );
+ EUNIT_ASSERT_EQUALS( iFeatMgrCount, 0 );
+ T_ConstructL( EFalse );
+ Teardown();
+ SetupNoSliderL( EFalse );
+ T_ConstructL( EFalse );
+ Teardown();
+ EUNIT_ASSERT_EQUALS( iFeatMgrCount, 0 );
+
+ // Test construction with focus
+ SetupL( ETrue );
+ T_ConstructL( ETrue );
+ Teardown();
+ EUNIT_ASSERT_EQUALS( iFeatMgrCount, 0 );
+ SetupNoSliderL( ETrue );
+ T_ConstructL( ETrue );
+ Teardown();
+ EUNIT_ASSERT_EQUALS( iFeatMgrCount, 0 );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::T_CAiWsPluginAnim_EmptyFunctionsL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::T_CAiWsPluginAnim_EmptyFunctionsL()
+ {
+ // Call empty functions to ensure coverage targets are reached
+ TInt result = KErrNotFound;
+ EUNIT_ASSERT_NO_LEAVE( result = iCAiWsPluginAnim->CommandReplyL( 0, NULL ) );
+ EUNIT_ASSERT_EQUALS( result, KErrNone );
+
+ EUNIT_ASSERT_NO_LEAVE( iCAiWsPluginAnim->Command( 0, NULL ) );
+
+ EUNIT_ASSERT_NO_LEAVE( iCAiWsPluginAnim->Animate( NULL ) );
+
+ EUNIT_ASSERT_NO_LEAVE( iCAiWsPluginAnim->Redraw() );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::T_CAiWsPluginAnim_FocusChangedL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::T_CAiWsPluginAnim_FocusChangedL( TBool aFocus )
+ {
+ iCAiWsPluginAnim->FocusChanged( aFocus );
+
+ EUNIT_ASSERT_EQUALS( iCAiWsPluginAnim->HasFocus(), aFocus );
+
+ TArray<T_AiWsPlugin::CTestEventHandler*>
+ eventHandlers( iTls->EventHandlers() );
+
+ for ( TInt i = 0; i < eventHandlers.Count(); ++i )
+ {
+ T_AiWsPlugin::CTestEventHandler* handler = eventHandlers[i];
+ EUNIT_ASSERT_EQUALS( handler->Focus(), aFocus );
+ EUNIT_ASSERT( handler->UiState() );
+ EUNIT_ASSERT_EQUALS( handler->UiState()->HasFocus(), aFocus );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::T_CAiWsPluginAnim_FocusChangedL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::T_CAiWsPluginAnim_FocusChangedL()
+ {
+ T_CAiWsPluginAnim_FocusChangedL( ETrue );
+ T_CAiWsPluginAnim_FocusChangedL( EFalse );
+ T_CAiWsPluginAnim_FocusChangedL( !iCAiWsPluginAnim->HasFocus() );
+ T_CAiWsPluginAnim_FocusChangedL( !iCAiWsPluginAnim->HasFocus() );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::TestLastEventsL()
+//
+// ----------------------------------------------------------------------------
+//
+void TestLastEventsL(
+ const TArray<T_AiWsPlugin::CTestEventHandler*>& aEventHandlers,
+ const TRawEvent& aRefEvent )
+ {
+ for( TInt i = 0; i < aEventHandlers.Count(); ++i )
+ {
+ T_AiWsPlugin::CTestEventHandler* handler = aEventHandlers[i];
+ EUNIT_ASSERT_EQUALS( handler->LastEvent(), aRefEvent );
+ handler->ResetLastEvent();
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnim::T_CAiWsPluginAnim_OfferRawEventL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnim::T_CAiWsPluginAnim_OfferRawEventL()
+ {
+ TRawEvent nullEvent;
+ ResetEvent( nullEvent );
+ TRawEvent testEvent( nullEvent );
+ TArray<T_AiWsPlugin::CTestEventHandler*> eventHandlers( iTls->EventHandlers() );
+
+ // Check initial state
+ TestLastEventsL( eventHandlers, nullEvent );
+
+ // Test modifier key event
+ testEvent.Set( TRawEvent::EKeyDown, EStdKeyLeftShift );
+ EUNIT_ASSERT( !iCAiWsPluginAnim->OfferRawEvent( testEvent ) );
+ // Modifier key events should not be forwarded to event handlers
+ TestLastEventsL( eventHandlers, nullEvent );
+ testEvent.Set( TRawEvent::EKeyUp, EStdKeyLeftShift );
+ EUNIT_ASSERT( !iCAiWsPluginAnim->OfferRawEvent( testEvent ) );
+ // Modifier key events should not be forwarded to event handlers
+ TestLastEventsL( eventHandlers, nullEvent );
+
+ // Test non-modifier key event
+ testEvent.Set( TRawEvent::EKeyDown, EStdKeyDevice0 );
+ EUNIT_ASSERT( !iCAiWsPluginAnim->OfferRawEvent( testEvent ) );
+ // Non-modifier key events should be forwarded to event handlers
+ TestLastEventsL( eventHandlers, nullEvent );
+ testEvent.Set( TRawEvent::EKeyUp, EStdKeyDevice0 );
+ EUNIT_ASSERT( !iCAiWsPluginAnim->OfferRawEvent( testEvent ) );
+ // Non-modifier key events should be forwarded to event handlers
+ TestLastEventsL( eventHandlers, nullEvent );
+
+ // Test event consuming
+ testEvent.Set( TRawEvent::EKeyDown, EStdKeyDevice1 );
+ // Make the first event handler consume the event
+ eventHandlers[0]->RespondToEvent( testEvent );
+ // OfferRawEvent should return true because the event is consumed
+ EUNIT_ASSERT( iCAiWsPluginAnim->OfferRawEvent( testEvent ) );
+ }
+
+//------------------------------------------------------------------------------
+// Test case table
+//
+//------------------------------------------------------------------------------
+//
+EUNIT_BEGIN_TEST_TABLE(
+ UT_AiWsPluginAnim,
+ "Test suite for class CAiWsPluginAnim",
+ "UNIT" )
+
+ EUNIT_TEST(
+ "Construction",
+ "CAiWsPluginAnim",
+ "ConstructL",
+ "FUNCTIONALITY",
+ EmptySetup, T_ConstructL, Teardown)
+
+ EUNIT_TEST(
+ "Test empty pure virtual overloads",
+ "CAiWsPluginAnim",
+ "CommandReplyL - test0",
+ "FUNCTIONALITY",
+ SetupL, T_CAiWsPluginAnim_EmptyFunctionsL, Teardown)
+
+ EUNIT_TEST(
+ "FocusChanged",
+ "CAiWsPluginAnim",
+ "FocusChanged",
+ "FUNCTIONALITY",
+ SetupL, T_CAiWsPluginAnim_FocusChangedL, Teardown)
+
+ EUNIT_TEST(
+ "OfferRawEvent",
+ "CAiWsPluginAnim",
+ "OfferRawEvent",
+ "FUNCTIONALITY",
+ SetupL, T_CAiWsPluginAnim_OfferRawEventL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/src/ut_aiwspluginanim_dllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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:
+*
+*/
+
+
+// System includes
+#include <digia/eunit/ceunittestsuite.h>
+
+// User includes
+#include "ut_aiwspluginanim.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Creates test suite instance
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_AiWsPluginAnim::NewL();
+ }
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_aiwspluginanim/src/ut_aiwspluginanimtls.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,159 @@
+/*
+* Copyright (c) 2009 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:
+*
+*/
+
+// System includes
+
+// User includes
+#include "ut_aiwspluginanimtls.h"
+
+// Constants
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS =======
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::CreateL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnimTls::CreateL()
+ {
+ if ( !Instance() )
+ {
+ UT_AiWsPluginAnimTls* self = new( ELeave ) UT_AiWsPluginAnimTls;
+ CleanupStack::PushL( self );
+ User::LeaveIfError( Dll::SetTls( self ) );
+ CleanupStack::Pop( self );
+ }
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::Instance()
+//
+// ----------------------------------------------------------------------------
+//
+UT_AiWsPluginAnimTls* UT_AiWsPluginAnimTls::Instance()
+ {
+ return static_cast<UT_AiWsPluginAnimTls*>( Dll::Tls() );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::Destroy()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnimTls::Destroy()
+ {
+ delete Instance();
+ Dll::SetTls( NULL );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::UT_AiWsPluginAnimTls()
+//
+// ----------------------------------------------------------------------------
+//
+UT_AiWsPluginAnimTls::UT_AiWsPluginAnimTls()
+ {
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::~UT_AiWsPluginAnimTls
+//
+// ----------------------------------------------------------------------------
+//
+UT_AiWsPluginAnimTls::~UT_AiWsPluginAnimTls()
+ {
+ iEventHandlers.Close();
+ iFeatures.Close();
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::AddEventHandlerL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnimTls::AddEventHandlerL(
+ T_AiWsPlugin::CTestEventHandler& aHandler )
+ {
+ iEventHandlers.AppendL( &aHandler );
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::EventHandlers()
+//
+// ----------------------------------------------------------------------------
+//
+TArray<T_AiWsPlugin::CTestEventHandler*> UT_AiWsPluginAnimTls::EventHandlers() const
+ {
+ return iEventHandlers.Array();
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::IncFeatMgrCount()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnimTls::IncFeatMgrCount()
+ {
+ ++iFeatMgrCount;
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::DecFeatMgrCount()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnimTls::DecFeatMgrCount()
+ {
+ --iFeatMgrCount;
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::FeatMgrCount()
+//
+// ----------------------------------------------------------------------------
+//
+TInt UT_AiWsPluginAnimTls::FeatMgrCount() const
+ {
+ return iFeatMgrCount;
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::FeatureSupported()
+//
+// ----------------------------------------------------------------------------
+//
+TBool UT_AiWsPluginAnimTls::FeatureSupported( TInt aFeatureId ) const
+ {
+ const TBool* value = iFeatures.Find( aFeatureId );
+
+ return (value ? *value : EFalse);
+ }
+
+// ----------------------------------------------------------------------------
+// UT_AiWsPluginAnimTls::SetFeatureSupportedL()
+//
+// ----------------------------------------------------------------------------
+//
+void UT_AiWsPluginAnimTls::SetFeatureSupportedL( TInt aFeatureId,
+ TBool aValue )
+ {
+ iFeatures.InsertL( aFeatureId, aValue );
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_modifierkeytracker/bwins/ut_modifierkeytrackeru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_modifierkeytracker/eabi/ut_modifierkeytrackeru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_modifierkeytracker/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+ut_modifierkeytracker.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_modifierkeytracker/group/ut_modifierkeytracker.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,50 @@
+/*
+* Copyright (c) 2009 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: project file
+*
+*/
+
+#include <platform_paths.hrh>
+#include <eunitcaps.h>
+
+
+TARGET ut_modifierkeytracker.dll
+TARGETTYPE dll
+UID 0x1000af5a 0x01700000
+VENDORID VID_DEFAULT
+
+CAPABILITY EUNIT_CAPS
+MACRO _AIWSPLUGIN_UNIT_TEST
+
+MW_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../../../../plugins/wsplugin/inc
+USERINCLUDE ../../../../inc/common
+
+USERINCLUDE ../inc
+
+SOURCEPATH ../../../../plugins/wsplugin/src
+SOURCE modifierkeytracker.cpp
+
+SOURCEPATH ../src
+SOURCE ut_modifierkeytracker.cpp
+SOURCE ut_modifierkeytracker_dllmain.cpp
+
+LIBRARY aiutils.lib
+LIBRARY euser.lib
+LIBRARY cone.lib
+LIBRARY EUnit.lib
+LIBRARY EUnitUtil.lib
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_modifierkeytracker/inc/ut_modifierkeytracker.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,88 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef _UT_MODIFIERKEYTRACKER_H
+#define _UT_MODIFIERKEYTRACKER_H
+
+// System includes
+#include <e32base.h>
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// User includes
+#include "modifierkeytracker.h"
+
+// Forward declarations
+
+// Class declaration
+NONSHARABLE_CLASS( UT_MofifierKeyTracker ) : public CEUnitTestSuiteClass
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_MofifierKeyTracker* NewL();
+ static UT_MofifierKeyTracker* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_MofifierKeyTracker();
+
+private:
+ // Constructors and destructors
+
+ UT_MofifierKeyTracker();
+ void ConstructL();
+
+private:
+ // New methods
+
+ void SetupL();
+
+ void Teardown();
+
+ void T_TModifierKeyTracker_ConstructL( );
+
+ void T_TModifierKeyTracker_NonModiferUpdateL( );
+
+ void T_TModifierKeyTracker_TestModifierKeyDownL
+ ( TInt aScanCode, TUint aExcpectedStatus );
+
+ void T_TModifierKeyTracker_TestModifierKeyUpL
+ ( TInt aScanCode, TUint aExcpectedStatus );
+
+ void T_TModifierKeyTracker_SingleModiferUpdateL
+ ( TInt aScanCode, TUint aExcpectedStatus );
+
+ void T_TModifierKeyTracker_SingleModiferUpdateL( );
+
+ void T_TModifierKeyTracker_MultiModiferUpdateL( );
+
+ void T_TModifierKeyTracker_MixedModiferNonModiferUpdateL( );
+
+private:
+ // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+ AiWsPlugin::TModifierKeyTracker* iTModifierKeyTracker;
+ };
+
+#endif // _UT_MODIFIERKEYTRACKER_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_modifierkeytracker/src/ut_modifierkeytracker.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,342 @@
+/*
+* 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:
+*
+*/
+
+
+// System includes
+#include <e32base.h>
+#include <e32cmn.h>
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/teunitassertioninfo.h>
+#include <digia/eunit/eunitdecorators.h>
+
+// User includes
+#include "modifierkeytracker.h"
+
+#include "ut_modifierkeytracker.h"
+
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::NewL()
+//
+// -----------------------------------------------------------------------------
+//
+UT_MofifierKeyTracker* UT_MofifierKeyTracker::NewL()
+ {
+ UT_MofifierKeyTracker* self = UT_MofifierKeyTracker::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::NewLC()
+//
+// -----------------------------------------------------------------------------
+//
+UT_MofifierKeyTracker* UT_MofifierKeyTracker::NewLC()
+ {
+ UT_MofifierKeyTracker* self = new( ELeave ) UT_MofifierKeyTracker();
+ CleanupStack::PushL( self );
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::~UT_MofifierKeyTracker()
+//
+// -----------------------------------------------------------------------------
+//
+UT_MofifierKeyTracker::~UT_MofifierKeyTracker()
+ {
+ delete iTModifierKeyTracker;
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::UT_MofifierKeyTracker()
+//
+// -----------------------------------------------------------------------------
+//
+UT_MofifierKeyTracker::UT_MofifierKeyTracker()
+ {
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::ConstructL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::SetupL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::SetupL()
+ {
+ iTModifierKeyTracker = new( ELeave ) AiWsPlugin::TModifierKeyTracker;
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::Teardown()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::Teardown()
+ {
+ delete iTModifierKeyTracker;
+ iTModifierKeyTracker = NULL;
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::T_TModifierKeyTracker_ConstructL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::T_TModifierKeyTracker_ConstructL()
+ {
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), 0 );
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::T_TModifierKeyTracker_NonModiferUpdateL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::T_TModifierKeyTracker_NonModiferUpdateL()
+ {
+ TRawEvent testEvent;
+ testEvent.Set( TRawEvent::EKeyDown, EStdKeyDevice0 );
+ EUNIT_ASSERT( !iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), 0 );
+ testEvent.Set( TRawEvent::EKeyUp, EStdKeyDevice0 );
+ EUNIT_ASSERT( !iTModifierKeyTracker->Update( testEvent ) );
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::T_TModifierKeyTracker_TestModifierKeyDownL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::T_TModifierKeyTracker_TestModifierKeyDownL(
+ TInt aScanCode, TUint aExcpectedStatus )
+ {
+ TRawEvent testEvent;
+ testEvent.Set( TRawEvent::EKeyDown, aScanCode );
+ EUNIT_ASSERT( iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), aExcpectedStatus );
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::T_TModifierKeyTracker_TestModifierKeyUpL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::T_TModifierKeyTracker_TestModifierKeyUpL(
+ TInt aScanCode, TUint aExcpectedStatus )
+ {
+ TRawEvent testEvent;
+ testEvent.Set( TRawEvent::EKeyUp, aScanCode );
+ EUNIT_ASSERT( iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), aExcpectedStatus );
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::T_TModifierKeyTracker_SingleModiferUpdateL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::T_TModifierKeyTracker_SingleModiferUpdateL(
+ TInt aScanCode, TUint aExcpectedStatus )
+ {
+ T_TModifierKeyTracker_TestModifierKeyDownL( aScanCode, aExcpectedStatus );
+ T_TModifierKeyTracker_TestModifierKeyUpL( aScanCode, 0 );
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::T_TModifierKeyTracker_SingleModiferUpdateL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::T_TModifierKeyTracker_SingleModiferUpdateL()
+ {
+ T_TModifierKeyTracker_SingleModiferUpdateL(
+ EStdKeyLeftShift, EModifierLeftShift | EModifierShift );
+
+ T_TModifierKeyTracker_SingleModiferUpdateL(
+ EStdKeyRightShift, EModifierRightShift | EModifierShift );
+
+ T_TModifierKeyTracker_SingleModiferUpdateL(
+ EStdKeyLeftCtrl, EModifierLeftCtrl | EModifierCtrl );
+
+ T_TModifierKeyTracker_SingleModiferUpdateL(
+ EStdKeyRightCtrl, EModifierRightCtrl | EModifierCtrl );
+
+ T_TModifierKeyTracker_SingleModiferUpdateL(
+ EStdKeyLeftAlt, EModifierLeftAlt | EModifierAlt );
+
+ T_TModifierKeyTracker_SingleModiferUpdateL(
+ EStdKeyRightAlt, EModifierRightAlt | EModifierAlt );
+
+ T_TModifierKeyTracker_SingleModiferUpdateL(
+ EStdKeyLeftFunc, EModifierLeftFunc | EModifierFunc );
+
+ T_TModifierKeyTracker_SingleModiferUpdateL(
+ EStdKeyRightFunc, EModifierRightFunc | EModifierFunc );
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::T_TModifierKeyTracker_MultiModiferUpdateL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::T_TModifierKeyTracker_MultiModiferUpdateL()
+ {
+ TUint expectedStatus = EModifierLeftShift | EModifierShift ;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyLeftShift, expectedStatus );
+ expectedStatus |= EModifierRightShift;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyRightShift, expectedStatus );
+
+ expectedStatus |= EModifierLeftCtrl | EModifierCtrl;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyLeftCtrl, expectedStatus );
+ expectedStatus |= EModifierRightCtrl;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyRightCtrl, expectedStatus );
+
+ expectedStatus |= EModifierLeftAlt | EModifierAlt;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyLeftAlt, expectedStatus );
+ expectedStatus |= EModifierRightAlt;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyRightAlt, expectedStatus );
+
+ expectedStatus |= EModifierLeftFunc | EModifierFunc;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyLeftFunc, expectedStatus );
+ expectedStatus |= EModifierRightFunc;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyRightFunc, expectedStatus );
+
+ expectedStatus &= ~EModifierLeftShift;
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyLeftShift, expectedStatus );
+ expectedStatus &= ~(EModifierRightShift | EModifierShift);
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyRightShift, expectedStatus );
+
+ expectedStatus &= ~EModifierLeftCtrl;
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyLeftCtrl, expectedStatus );
+ expectedStatus &= ~(EModifierRightCtrl | EModifierCtrl);
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyRightCtrl, expectedStatus );
+
+ expectedStatus &= ~EModifierLeftAlt;
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyLeftAlt, expectedStatus );
+ expectedStatus &= ~(EModifierRightAlt | EModifierAlt);
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyRightAlt, expectedStatus );
+
+ expectedStatus &= ~EModifierLeftFunc;
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyLeftFunc, expectedStatus );
+ expectedStatus &= ~(EModifierRightFunc | EModifierFunc);
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyRightFunc, expectedStatus );
+
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), 0 );
+ }
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::T_TModifierKeyTracker_MixedModiferNonModiferUpdateL()
+//
+// -----------------------------------------------------------------------------
+//
+void UT_MofifierKeyTracker::T_TModifierKeyTracker_MixedModiferNonModiferUpdateL()
+ {
+ TUint expectedStatus = EModifierLeftShift | EModifierShift ;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyLeftShift, expectedStatus );
+
+ TRawEvent testEvent;
+ testEvent.Set( TRawEvent::EKeyDown, EStdKeyDevice0 );
+ EUNIT_ASSERT( !iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), expectedStatus );
+ testEvent.Set( TRawEvent::EKeyUp, EStdKeyDevice0 );
+ EUNIT_ASSERT( !iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), expectedStatus );
+
+ expectedStatus |= EModifierLeftCtrl | EModifierCtrl;
+ T_TModifierKeyTracker_TestModifierKeyDownL( EStdKeyLeftCtrl, expectedStatus );
+
+ testEvent.Set( TRawEvent::EKeyDown, EStdKeyDevice1 );
+ EUNIT_ASSERT( !iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), expectedStatus );
+ testEvent.Set( TRawEvent::EKeyUp, EStdKeyDevice1 );
+ EUNIT_ASSERT( !iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), expectedStatus );
+
+ expectedStatus &= ~(EModifierLeftShift | EModifierShift);
+ T_TModifierKeyTracker_TestModifierKeyUpL( EStdKeyLeftShift, expectedStatus );
+
+ testEvent.Set( TRawEvent::EKeyDown, EStdKeyDevice2 );
+ EUNIT_ASSERT( !iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), expectedStatus );
+ testEvent.Set( TRawEvent::EKeyUp, EStdKeyDevice2 );
+ EUNIT_ASSERT( !iTModifierKeyTracker->Update( testEvent ) );
+ EUNIT_ASSERT_EQUALS( iTModifierKeyTracker->Status( ), expectedStatus );
+ }
+
+// -----------------------------------------------------------------------------
+// Test case table
+//
+// -----------------------------------------------------------------------------
+//
+EUNIT_BEGIN_TEST_TABLE(
+ UT_MofifierKeyTracker,
+ "Add test suite description here.",
+ "UNIT" )
+
+ EUNIT_TEST(
+ "Constructor",
+ "TModifierKeyTracker",
+ "Constructor",
+ "FUNCTIONALITY",
+ SetupL, T_TModifierKeyTracker_ConstructL, Teardown)
+
+ EUNIT_TEST(
+ "Update - Single active modifier key",
+ "TModifierKeyTracker",
+ "Update",
+ "FUNCTIONALITY",
+ SetupL, T_TModifierKeyTracker_SingleModiferUpdateL, Teardown)
+
+ EUNIT_TEST(
+ "Update - Multiple active modifier keys",
+ "TModifierKeyTracker",
+ "Update",
+ "FUNCTIONALITY",
+ SetupL, T_TModifierKeyTracker_MultiModiferUpdateL, Teardown)
+
+ EUNIT_TEST(
+ "Update - Mixed modfier and other keys",
+ "TModifierKeyTracker",
+ "Update",
+ "FUNCTIONALITY",
+ SetupL, T_TModifierKeyTracker_MixedModiferNonModiferUpdateL, Teardown)
+
+EUNIT_END_TEST_TABLE
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_modifierkeytracker/src/ut_modifierkeytracker_dllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,38 @@
+/*
+* 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:
+*
+*/
+
+
+// System includes
+#include <digia/eunit/ceunittestsuite.h>
+
+// User includes
+#include "ut_modifierkeytracker.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Creates test suite instance
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return UT_MofifierKeyTracker::NewL();
+ }
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_numerickeyhandler/bwins/ut_numerickeyhandleru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestSuiteL@@YAPAVMEUnitTest@@XZ @ 1 NONAME ; class MEUnitTest * CreateTestSuiteL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_numerickeyhandler/eabi/ut_numerickeyhandleru.def Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,11 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _ZTI21MAnimGeneralFunctions @ 2 NONAME
+ _ZTI25CAnimGeneralFunctionsStub @ 3 NONAME
+ _ZTI36MAnimGeneralFunctionsWindowExtension @ 4 NONAME
+ _ZTIN10AiWsPlugin18CNumericKeyHandlerE @ 5 NONAME
+ _ZTV21MAnimGeneralFunctions @ 6 NONAME
+ _ZTV25CAnimGeneralFunctionsStub @ 7 NONAME
+ _ZTV36MAnimGeneralFunctionsWindowExtension @ 8 NONAME
+ _ZTVN10AiWsPlugin18CNumericKeyHandlerE @ 9 NONAME
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_numerickeyhandler/group/bld.inf Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,28 @@
+/*
+* Copyright (c) 2010 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:
+*
+*/
+
+
+
+PRJ_PLATFORMS
+DEFAULT
+
+PRJ_EXPORTS
+
+PRJ_MMPFILES
+
+PRJ_TESTMMPFILES
+ut_numerickeyhandler.mmp
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_numerickeyhandler/group/ut_numerickeyhandler.mmp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,63 @@
+/*
+* Copyright (c) 2009 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: project file
+*
+*/
+
+#include <platform_paths.hrh>
+#include <eunitcaps.h>
+
+
+TARGET ut_numerickeyhandler.dll
+TARGETTYPE dll
+UID 0x1000af5a 0x01700000
+VENDORID VID_DEFAULT
+
+CAPABILITY EUNIT_CAPS
+MACRO _AIWSPLUGIN_UNIT_TEST
+
+APP_LAYER_SYSTEMINCLUDE
+
+USERINCLUDE ../../../../plugins/wsplugin/inc
+USERINCLUDE ../../../../inc/common
+USERINCLUDE ../../stub
+USERINCLUDE ../inc
+
+SOURCEPATH ../../../../plugins/wsplugin/src
+SOURCE numerickeyhandler.cpp
+
+SOURCEPATH ../../stub/
+SOURCE animgeneralfunctions_stub.cpp
+
+SOURCEPATH ../src
+SOURCE ut_numerickeyhandler.cpp
+SOURCE ut_numerickeyhandler_dllmain.cpp
+
+LIBRARY aiutils.lib
+LIBRARY euser.lib
+LIBRARY cone.lib
+LIBRARY EUnit.lib
+LIBRARY EUnitUtil.lib
+
+
+LIBRARY efsrv.lib
+LIBRARY CenRepNotifHandler.lib
+LIBRARY ptiengine.lib
+LIBRARY centralrepository.lib
+LIBRARY commonengine.lib
+LIBRARY esock.lib
+LIBRARY serviceprovidersettings.lib
+LIBRARY featmgr.lib
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_numerickeyhandler/inc/ut_numerickeyhandler.h Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,111 @@
+/*
+* 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:
+*
+*/
+
+
+#ifndef _UT_NUMERICKEYHANDLER_H
+#define _UT_NUMERICKEYHANDLER_H
+
+// System includes
+#include <e32base.h>
+#include <w32adll.h>
+#include <e32def.h>
+#include <digia/eunit/ceunittestsuiteclass.h>
+
+// User includes
+#include "uistate.h"
+#include "aiwspluginanimdef.h"
+
+// Forward declarations
+class CAnimGeneralFunctionsStub;
+
+typedef MAnimGeneralFunctionsWindowExtension::TWindowGroupInfo TIdPlgWindowGroupInfo;
+
+namespace AiWsPlugin {
+
+class CNumericKeyHandler;
+
+// Class declaration
+NONSHARABLE_CLASS( UT_NumericKeyHandler ) : public CEUnitTestSuiteClass,
+ public MUiState
+ {
+public:
+ // Constructors and destructors
+
+ /**
+ * Two phase construction
+ */
+ static UT_NumericKeyHandler* NewL();
+ static UT_NumericKeyHandler* NewLC();
+ /**
+ * Destructor
+ */
+ ~UT_NumericKeyHandler();
+
+private:
+ // Constructors and destructors
+
+ UT_NumericKeyHandler();
+ void ConstructL();
+
+
+public:
+ // From base class MUiState
+
+ TUint Modifiers() const;
+ TBool HasFocus() const;
+
+private:
+ // New methods
+
+ void SetupL();
+
+ void EmptySetupL();
+
+ void Teardown();
+
+ void TestNumericKeyCreationL();
+
+ void TestNumericKeyEventL();
+
+ void TestFocusChangeL();
+
+ void TestNumericKeyEventQwertyModeL();
+
+ void TestHandlerFunctions1L();
+
+ void TestHandlerFunctions2L();
+
+ void TestHandlerFunctions3L();
+
+private:
+ // Data
+
+ EUNIT_DECLARE_TEST_TABLE;
+
+ CNumericKeyHandler* iNumericKeyHandler;
+
+ CAnimGeneralFunctionsStub* iAnimGeneralFunctions;
+
+ TInt iTestValue;
+
+ TUint iModifiers;
+ };
+}
+
+#endif // _UT_NUMERICKEYHANDLER_H
+
+// End of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_numerickeyhandler/src/ut_numerickeyhandler.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,336 @@
+/*
+* 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:
+*
+*/
+
+
+// System includes
+#include <e32base.h>
+#include <e32cmn.h>
+#include <e32event.h>
+#include <e32keys.h>
+#include <e32property.h>
+#include <aknfepinternalcrkeys.h>
+
+#include <digia/eunit/eunitmacros.h>
+#include <digia/eunit/teunitassertioninfo.h>
+#include <digia/eunit/eunitdecorators.h>
+
+// User includes
+#include "numerickeyhandler.h"
+
+#include <activeidle2domainpskeys.h>
+#include "eventhandler.h"
+
+#include "ut_numerickeyhandler.h"
+#include "animgeneralfunctions_stub.h"
+
+using namespace AiWsPlugin;
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// UT_MofifierKeyTracker::NewL()
+//
+// -----------------------------------------------------------------------------
+//
+
+
+// CLASS HEADER
+
+// EXTERNAL INCLUDES
+//#include <telephonyinternalpskeys.h>
+
+
+_LIT( fileName, "C:\\keyhandler.txt");
+// INTERNAL INCLUDES
+
+
+
+
+// CONSTRUCTION
+UT_NumericKeyHandler* UT_NumericKeyHandler::NewL()
+ {
+ UT_NumericKeyHandler* self = UT_NumericKeyHandler::NewLC();
+ CleanupStack::Pop();
+
+ return self;
+ }
+
+UT_NumericKeyHandler* UT_NumericKeyHandler::NewLC()
+ {
+ UT_NumericKeyHandler* self = new( ELeave ) UT_NumericKeyHandler();
+ CleanupStack::PushL( self );
+
+ self->ConstructL();
+
+ return self;
+ }
+
+// Destructor (virtual by CBase)
+UT_NumericKeyHandler::~UT_NumericKeyHandler()
+ {
+ }
+
+// Default constructor
+UT_NumericKeyHandler::UT_NumericKeyHandler()
+ {
+ }
+
+// Second phase construct
+void UT_NumericKeyHandler::ConstructL()
+ {
+ // The ConstructL from the base class CEUnitTestSuiteClass must be called.
+ // It generates the test case table.
+ CEUnitTestSuiteClass::ConstructL();
+ }
+
+// METHODS
+
+void UT_NumericKeyHandler::EmptySetupL( )
+ {
+
+ }
+
+void UT_NumericKeyHandler::SetupL( )
+ {
+ if ( !iAnimGeneralFunctions )
+ {
+ iAnimGeneralFunctions = CAnimGeneralFunctionsStub::NewL();
+ }
+
+ iModifiers = NULL;
+ MAnimGeneralFunctionsWindowExtension* ext =
+ static_cast<MAnimGeneralFunctionsWindowExtension*>(
+ iAnimGeneralFunctions->ExtendedInterface
+ ( MAnimGeneralFunctions::EWindowExtensionInterface ) );
+
+ iNumericKeyHandler = AiWsPlugin::CNumericKeyHandler::NewLC( 0, ext);
+ CleanupStack::Pop();
+ }
+
+void UT_NumericKeyHandler::Teardown( )
+ {
+ if( iNumericKeyHandler )
+ {
+ delete iNumericKeyHandler;
+ iNumericKeyHandler = NULL;
+ }
+ if ( iAnimGeneralFunctions )
+ {
+ delete iAnimGeneralFunctions;
+ iAnimGeneralFunctions = NULL;
+ }
+ _LIT( fileName, "C:\\keyhandler.txt");
+ RFs fs;
+ fs.Connect();
+ fs.Delete( fileName );
+ fs.Close();
+ }
+
+void UT_NumericKeyHandler::TestNumericKeyCreationL( )
+ {
+ EUNIT_ASSERT( iNumericKeyHandler );
+ }
+
+void UT_NumericKeyHandler::TestFocusChangeL( )
+ {
+ // The fuction that this test tests is unnecessary
+ AiWsPlugin::CEventHandler* handler = iNumericKeyHandler;
+ handler->FocusChanged( ETrue );
+ EUNIT_ASSERT( ETrue );
+ }
+
+void UT_NumericKeyHandler::TestNumericKeyEventL()
+ {
+
+ TRawEvent event;
+ event.Set( TRawEvent::EKeyDown, EStdKeyHash );
+
+ AiWsPlugin::CEventHandler* handler = iNumericKeyHandler;
+ CleanupStack::PushL( handler );
+
+ handler->SetUiStateQuery( *this );
+ handler->OfferRawEvent(event);
+
+ CleanupStack::Pop( handler );
+
+ TUid uidi(KNullUid);
+ TUint uintti(0);
+
+ RProperty::Get(uidi, uintti, iTestValue );
+
+ //EUNIT_ASSERT_EQUALS( iTestValue, TInt(EPSAiNumberEntry));
+ }
+
+
+void UT_NumericKeyHandler::TestNumericKeyEventQwertyModeL()
+ {
+ // Write file to enable qwertymode
+ RFs fs;
+ RFile file;
+ TInt err = fs.Connect();
+ err = file.Replace( fs, fileName, EFileShareAny);
+ TBuf8<30> txt;
+ txt.Num( TInt(1) );
+ err = file.Write( 0,txt);
+ file.Close();
+ fs.Close();
+
+ if ( !iAnimGeneralFunctions )
+ {
+ iAnimGeneralFunctions = CAnimGeneralFunctionsStub::NewL();
+ }
+
+ iModifiers = NULL;
+ MAnimGeneralFunctionsWindowExtension* ext =
+ static_cast<MAnimGeneralFunctionsWindowExtension*>(
+ iAnimGeneralFunctions->ExtendedInterface
+ ( MAnimGeneralFunctions::EWindowExtensionInterface ) );
+
+ iNumericKeyHandler = AiWsPlugin::CNumericKeyHandler::NewLC( 0, ext);
+ CleanupStack::Pop();
+
+ TRawEvent event;
+ event.Set( TRawEvent::EKeyDown, EStdKeyHash );
+
+
+ AiWsPlugin::CEventHandler* handler = iNumericKeyHandler;
+ handler->SetUiStateQuery( *this );
+ handler->OfferRawEvent(event);
+ TUid uidi(KNullUid);
+ TUint uintti(0);
+ RProperty::Get(uidi, uintti, iTestValue );
+
+ EUNIT_ASSERT_EQUALS( iTestValue, TInt(EPSAiNumberEntry ));
+ }
+
+void UT_NumericKeyHandler::TestHandlerFunctions1L()
+ {
+ AiWsPlugin::CEventHandler* handler = iNumericKeyHandler;
+ handler->SetUiStateQuery( *this );
+ TRawEvent event;
+ event.Set( TRawEvent::EKeyDown, EStdKeyHash );
+ iNumericKeyHandler->iQwertyMode = ETrue;
+ iNumericKeyHandler->CheckPostToTarget( event );
+
+ iNumericKeyHandler->iQwertyMode = EFalse;
+ iNumericKeyHandler->CheckPostToTarget( event );
+
+ event.Set( TRawEvent::EKeyDown, '5' );
+ iNumericKeyHandler->iQwertyMode = ETrue;
+ iNumericKeyHandler->CheckPostToTarget( event );
+
+ event.Set( TRawEvent::EKeyDown, '5' );
+ iNumericKeyHandler->iQwertyMode = EFalse;
+ iNumericKeyHandler->CheckPostToTarget( event );
+ }
+void UT_NumericKeyHandler::TestHandlerFunctions2L()
+ {
+ AiWsPlugin::CEventHandler* handler = iNumericKeyHandler;
+ handler->SetUiStateQuery( *this );
+ iNumericKeyHandler->LoadInputLanguageKeyBindings(0);
+ iNumericKeyHandler->LoadInputLanguageKeyBindings(1);
+ iNumericKeyHandler->LoadInputLanguageKeyBindings(2);
+ iNumericKeyHandler->LoadInputLanguageKeyBindings(3);
+ iNumericKeyHandler->LoadInputLanguageKeyBindings(4);
+ iNumericKeyHandler->LoadInputLanguageKeyBindings(5);
+ iNumericKeyHandler->LoadInputLanguageKeyBindings(6);
+ }
+void UT_NumericKeyHandler::TestHandlerFunctions3L()
+ {
+ AiWsPlugin::CEventHandler* handler = iNumericKeyHandler;
+ handler->SetUiStateQuery( *this );
+ iNumericKeyHandler->HandleQwertyModeChanged(iNumericKeyHandler);
+ iNumericKeyHandler->HandleNotifyGeneric(0);
+ iNumericKeyHandler->HandleNotifyGeneric(1);
+ iNumericKeyHandler->HandleNotifyGeneric(KAknFepInputTxtLang);
+ }
+
+TUint UT_NumericKeyHandler::Modifiers() const
+ {
+ return iModifiers;
+ }
+
+
+TBool UT_NumericKeyHandler::HasFocus() const
+ {
+ return ETrue;
+ }
+
+
+// TEST TABLE
+
+EUNIT_BEGIN_TEST_TABLE(
+ UT_NumericKeyHandler,
+ "Add test suite description here.",
+ "MODULE" )
+
+EUNIT_TEST(
+ "Test creation",
+ "CNumericKeyHandler",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestNumericKeyCreationL, Teardown)
+
+EUNIT_TEST(
+ "Test Numeric event",
+ "CNumericKeyHandler",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestNumericKeyEventL, Teardown)
+
+EUNIT_TEST(
+ "Test Focus Change",
+ "CNumericKeyHandler",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestFocusChangeL, Teardown)
+
+EUNIT_TEST(
+ "Test Functions",
+ "CNumericKeyHandler",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestHandlerFunctions1L, Teardown)
+
+EUNIT_TEST(
+ "Test Functions",
+ "CNumericKeyHandler",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestHandlerFunctions2L, Teardown)
+
+EUNIT_TEST(
+ "Test Functions",
+ "CNumericKeyHandler",
+ "",
+ "FUNCTIONALITY",
+ SetupL, TestHandlerFunctions3L, Teardown)
+
+
+// Enable this test when memory leak in CTpiEngine has bee fixed.(TSW:VRIA-6V7B4W)
+/*EUNIT_TEST(
+ "Qwerty Mode Numeric event",
+ "CNumericKeyHandler",
+ "",
+ "FUNCTIONALITY",
+ EmptySetupL, TestNumericKeyEventQwertyModeL, Teardown)*/
+
+EUNIT_END_TEST_TABLE
+
+// END OF FILE
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/idlefw/tsrc/wsplugin/ut_numerickeyhandler/src/ut_numerickeyhandler_dllmain.cpp Thu Aug 19 10:13:44 2010 +0300
@@ -0,0 +1,44 @@
+/*
+* 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:
+*
+*/
+
+
+// System includes
+#include <digia/eunit/ceunittestsuite.h>
+
+// User includes
+#include "ut_numerickeyhandler.h"
+
+// ======== LOCAL FUNCTIONS ========
+
+// ======== MEMBER FUNCTIONS ========
+
+// -----------------------------------------------------------------------------
+// Creates test suite instance
+// -----------------------------------------------------------------------------
+//
+EXPORT_C MEUnitTest* CreateTestSuiteL()
+ {
+ return AiWsPlugin::UT_NumericKeyHandler::NewL();
+ }
+
+// End of file
+
+
+
+
+
+