kerneltest/e32test/misc/t_zip.cpp
changeset 0 a41df078684a
child 231 75252ea6123b
equal deleted inserted replaced
-1:000000000000 0:a41df078684a
       
     1 // Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of the License "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // e32test\misc\t_zip.cpp
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <e32test.h>
       
    19 #include <f32file.h>
       
    20 #include "crash_gzip.h"
       
    21 
       
    22 
       
    23 TInt64 CrashTime() {return 0;}
       
    24 
       
    25 RFs TheFs;
       
    26 RFile TheOutFile;
       
    27 				
       
    28 class TCrashTestGzip : public MCrashGzip
       
    29 	{
       
    30 public:
       
    31 
       
    32 	void SetOutput();
       
    33 	virtual TBool Out(const TDesC8& aDes);
       
    34 	virtual TInt32 GetMaxLength();
       
    35 	};
       
    36 
       
    37 RTest test(_L("T_ZIP"));
       
    38 
       
    39 void TCrashTestGzip::SetOutput()
       
    40 	{
       
    41 	TInt r=TheOutFile.Replace(TheFs, _L("c:\\out.zip"),EFileWrite);
       
    42 	test(r==KErrNone);
       
    43 	Init();
       
    44 	}
       
    45 
       
    46 
       
    47 TInt TCrashTestGzip::Out(const TDesC8& aDes)
       
    48 	{
       
    49 	TInt r = TheOutFile.Write(aDes);
       
    50 	test(r==KErrNone);
       
    51 	return KErrNone;
       
    52 	}
       
    53 
       
    54 
       
    55 TInt32 TCrashTestGzip::GetMaxLength()
       
    56 	{
       
    57 	return -1;
       
    58 	}
       
    59 
       
    60 
       
    61 _LIT8(KText, "12345");
       
    62 
       
    63 
       
    64 GLDEF_C TInt E32Main()
       
    65 	{
       
    66 	test.Title();
       
    67 
       
    68 	test.Start(_L("Connect to file server"));
       
    69 	TInt r=TheFs.Connect();
       
    70 	test(r==KErrNone);
       
    71 
       
    72 	test.Next(_L("Making zip file"));
       
    73 	TCrashTestGzip zip;
       
    74 	zip.SetOutput();
       
    75 	zip.Write(KText);
       
    76 	zip.FlushEnd();
       
    77 
       
    78 	TheOutFile.Close();
       
    79 	TheFs.Close();
       
    80 
       
    81 	return KErrNone;
       
    82 	}
       
    83