Update contrib.
2 * Copyright (c) 2003-2009 Nokia Corporation and/or its subsidiary(-ies).
4 * This component and the accompanying materials are made available
5 * under the terms of the License "Eclipse Public License v1.0"
6 * which accompanies this distribution, and is available
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
19 #include <ecom/ecom.h>
20 #include <caf/content.h>
24 #include <ecom/implementationinformation.h>
26 using namespace ContentAccess;
28 CTestConsole* CTestConsole::NewL(CConsoleBase* aCon)
31 self=new (ELeave) CTestConsole;
37 CTestConsole::CTestConsole(void):CConsoleBase()
40 CTestConsole::~CTestConsole(void)
49 void CTestConsole::Write(const TDesC16& aString)
61 void CTestConsole::SetLogFile(RFile* aFile)
66 RTest test(_L("CAF Build Test"));
70 test.Start(_L(" @SYMTestCaseID:SEC-CAF-SMOKE-0001 CAF Test "));
72 CTestConsole* con=NULL;
73 TRAPD(ret, con=CTestConsole::NewL(test.Console()));
78 file=new (ELeave) RFile;
80 file->Replace(fs,_L("c:\\DRMLog.txt"),EFileShareAny|EFileWrite);
81 con->SetLogFile(file);
84 const TUid KInterfaceUID = {0x101FC2CE};
86 RImplInfoPtrArray aImplInfoArray;
89 test.Printf(_L("\nCAF Test Starting\n"));
92 test.Printf(_L("Ready to get implementations of %08X\n"),KInterfaceUID);
95 __UHEAP_MARK; // start heap debug
97 REComSession::ListImplementationsL(KInterfaceUID , aImplInfoArray);
99 TUint count = aImplInfoArray.Count();
100 CImplementationInformation *infoptr = aImplInfoArray[0];
102 TBufC<30> temp = infoptr->DisplayName();
103 test.Printf(_L("Found %d agent implementation(s).\n"),count);
104 test.Printf(_L("Name: %S\n"),&temp);
107 // Need to delete implementation array
108 aImplInfoArray.ResetAndDestroy();
112 TAgentCreationParams params;
113 params.iURIPtr = &temp;
114 params.iIntentPtr = &temp;
116 // Note that we have no idea about the real type of CAgent...
118 reinterpret_cast<CAgent *>(REComSession::CreateImplementationL(KF32ImplementationUID,
121 TUint major=0, minor=0;
122 agent->Version(major, minor);
123 test.Printf(_L("\nVersion (key %d) returned %d:%d\n"),key,major,minor);
125 REComSession::DestroyedImplementation(key);
128 _LIT(KDummyContent,"c:\\dummy.txt");
129 test.Printf(_L("Hit enter to create content object (accessing %S)...\n"),&KDummyContent);
132 CContent *myContent = 0; ret = 0;
134 TRAP(ret, myContent = CContent::NewL(KDummyContent));
137 test.Printf(_L("Content create failed (%d)..."),ret);
141 test.Printf(_L("Hit enter to create data object..."),ret);
144 CData *myData = NULL;
146 TRAP(ret, myData = myContent->OpenContentL(EPeek));
150 test.Printf(_L("Data create failed (%d)..."),ret);
155 myData->DataSizeL(mySize);
156 test.Printf(_L("\nAgent reports data size as %d bytes\n"),mySize);
159 test.Printf(_L("\nTest Ending\n"));
161 __UHEAP_MARKEND; // end heap debug
168 GLDEF_C TInt E32Main(void)
170 CTrapCleanup* cleanup;
171 cleanup = CTrapCleanup::New();
172 // CActiveScheduler* s = new CActiveScheduler;
175 TRAP_IGNORE(RunTest1());