sl@0: // Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // Actually - it has nothing to do with the heap. sl@0: // It tests the case when we have a pointer to an interface, implemented sl@0: // by the dll and dll is upgraded, the pointer needs to point to the upgraded version sl@0: // sl@0: // sl@0: sl@0: #include <swi/launcher.h> sl@0: #include <e32test.h> sl@0: #include <f32file.h> sl@0: #include <bautils.h> sl@0: #include <ecom/ecom.h> sl@0: #include "EComUidCodes.h" sl@0: #include "HeapTestInterface.h" sl@0: #include "tui.h" sl@0: sl@0: sl@0: sl@0: sl@0: using namespace Swi; sl@0: sl@0: LOCAL_D RTest test(_L("t_heaptest.exe")); sl@0: _LIT(KSisFilePath,"Z:\\HeapTestImpl\\HeapTestImpl.sis"); sl@0: _LIT(KSisFilePath1,"Z:\\HeapTestImpl\\HeapTestImpl1.sis"); sl@0: sl@0: /** sl@0: @SYMTestCaseID SYSLIB-ECOM-CT-0653 sl@0: @SYMTestCaseDesc Tests the case when we have a pointer to an interface, implemented sl@0: by the dll and dll is upgraded, the pointer needs to point to the upgraded version sl@0: @SYMTestPriority High sl@0: @SYMTestActions Query the interface,check the implementation UID,change its timestamp sl@0: replace with newer version(timestamp). sl@0: @SYMTestExpectedResults The test must not fail. sl@0: @SYMREQ REQ0000 sl@0: */ sl@0: sl@0: sl@0: void DoTestsL() sl@0: { sl@0: sl@0: TPtrC str(KSisFilePath); sl@0: TPtrC str1(KSisFilePath1); sl@0: TFileName sisfilename; sl@0: sisfilename.Copy(str); sl@0: TUI *Ui = new(ELeave) TUI; sl@0: CleanupStack::PushL(Ui); sl@0: sl@0: CInstallPrefs* prefs = CInstallPrefs::NewLC(); sl@0: sl@0: sl@0: REComSession& session = REComSession::OpenL(); sl@0: TRequestStatus status; sl@0: session.NotifyOnChange(status); sl@0: sl@0: RDebug::Printf("installing sis file base version:"); sl@0: //install HeapTestImpl.sis sl@0: TInt err=Launcher::Install(*Ui, sisfilename,*prefs); sl@0: test(err==KErrNone); sl@0: User::WaitForRequest(status); sl@0: sl@0: sl@0: //Create the interface sl@0: CHeapTestInterface* intrf = CHeapTestInterface::NewL(); sl@0: intrf->DisplayMessage(); sl@0: RDebug::Printf("installed HeapTestImpl.sis- Base version"); sl@0: delete intrf; sl@0: sl@0: //This API is needed to install the upgraded plugin only on winscw sl@0: REComSession::FinalClose() ; sl@0: sl@0: sisfilename.Copy(str1); sl@0: RDebug::Printf("installing HeapTestImpl.sis- Upgraded version"); sl@0: //install HeapTestImpl1.sis which is upgraded plugin sl@0: err=Launcher::Install(*Ui, sisfilename,*prefs); sl@0: test(err==KErrNone); sl@0: sl@0: CHeapTestInterface* intrf1 = CHeapTestInterface::NewL(); sl@0: intrf1->DisplayMessage(); sl@0: RDebug::Printf("installed HeapTestImpl.sis- Upgraded version"); sl@0: delete intrf1; sl@0: sl@0: CleanupStack::PopAndDestroy(2); sl@0: session.Close(); sl@0: REComSession::FinalClose() ; sl@0: } sl@0: sl@0: sl@0: GLDEF_C TInt E32Main() sl@0: { sl@0: __UHEAP_MARK; sl@0: test.Title(); sl@0: test.Start(_L(" @SYMTestCaseID:SYSLIB-ECOM-CT-0653 HeapTest. ")); sl@0: CTrapCleanup* cleanup = CTrapCleanup::New(); sl@0: sl@0: TRAPD(err, ::DoTestsL()); sl@0: delete cleanup; sl@0: test(err==KErrNone); sl@0: test.End(); sl@0: test.Close(); sl@0: __UHEAP_MARKEND; sl@0: return err; sl@0: } sl@0: