os/graphics/windowing/windowserver/test/tauto/twindowsizecache.h
changeset 0 bde4ae8d615e
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/os/graphics/windowing/windowserver/test/tauto/twindowsizecache.h	Fri Jun 15 03:10:57 2012 +0200
     1.3 @@ -0,0 +1,143 @@
     1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
     1.5 +// All rights reserved.
     1.6 +// This component and the accompanying materials are made available
     1.7 +// under the terms of "Eclipse Public License v1.0"
     1.8 +// which accompanies this distribution, and is available
     1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
    1.10 +//
    1.11 +// Initial Contributors:
    1.12 +// Nokia Corporation - initial contribution.
    1.13 +//
    1.14 +// Contributors:
    1.15 +//
    1.16 +// Description:
    1.17 +//
    1.18 +
    1.19 +/**
    1.20 + @file
    1.21 + @test
    1.22 + @internalComponent - Internal Symbian test code
    1.23 +*/
    1.24 +
    1.25 +#ifndef __TWINDOWSIZECACHE_H__
    1.26 +#define __TWINDOWSIZECACHE_H__
    1.27 +
    1.28 +#include <e32std.h>
    1.29 +#include <w32std.h>
    1.30 +#include "AUTO.H"
    1.31 +
    1.32 +#include "../nga/CLIENT/w32comm.h"
    1.33 +
    1.34 +#include "../tlib/testbase.h"
    1.35 +#include "TGraphicsHarness.h"
    1.36 +
    1.37 +//-----------------------------------------------------------
    1.38 +class CTWindowSizeCacheTest : public CTWsGraphicsBase
    1.39 +    {
    1.40 +public:
    1.41 +    enum TSizeCacheStatus
    1.42 +        {
    1.43 +        ETestSizeCacheNotEnabled,
    1.44 +        ETestSizeCacheEnabled,
    1.45 +        };
    1.46 +    enum TRWindowAction
    1.47 +        {
    1.48 +        ESetExtent,
    1.49 +        ESetExtentErr,
    1.50 +        ESetSize,
    1.51 +        ESetSizeErr,
    1.52 +        ECheckSize,
    1.53 +        EFlushSession,
    1.54 +        EEnableWindowSizeCache,
    1.55 +        EMaxAction,
    1.56 +        };
    1.57 +public:
    1.58 +    CTWindowSizeCacheTest(CTestStep* aStep);
    1.59 +    ~CTWindowSizeCacheTest();
    1.60 +    TestState DoTestL();
    1.61 +    void ConstructL();
    1.62 +//    
    1.63 +    void TestCreateRWindowL(TSizeCacheStatus aEnableWindowSizeCache);
    1.64 +    void TestCreateRBlankWindowL(TSizeCacheStatus aEnableWindowSizeCache);
    1.65 +    void TestCreateRBackedUpWindowL(TSizeCacheStatus aEnableWindowSizeCache, TDisplayMode aDisplayMode);
    1.66 +//    
    1.67 +    void TestRWindowNoCacheEntryL(TSizeCacheStatus aEnableWindowSizeCache);
    1.68 +    void TestRWindowNoCacheEntrySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.69 +    void TestRWindowNoCacheEntrySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.70 +    void TestRWindowNoCacheEntrySetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
    1.71 +    void TestRWindowNoCacheEntrySetSizeL(TSizeCacheStatus aEnableWindowSizeCache);
    1.72 +    void TestRWindowNoCacheEntryEnableWindowSizeCacheL();
    1.73 +//
    1.74 +    void TestRWindowCacheEntryExistsCacheCleanL(TSizeCacheStatus aEnableWindowSizeCache);
    1.75 +    void TestRWindowCacheEntryExistsCacheCleanSizeL(TSizeCacheStatus aEnableWindowSizeCache);
    1.76 +    void TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheL();
    1.77 +    void TestRWindowCacheEntryExistsCacheCleanEnableWindowSizeCacheLSizeL();
    1.78 +//
    1.79 +    void TestRWindowCacheEntryExistsCacheDirtySetSizeL(TSizeCacheStatus aEnableWindowSizeCache);
    1.80 +    void TestRWindowCacheEntryExistsCacheDirtySetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
    1.81 +    void TestRWindowCacheEntryExistsCacheDirtySetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.82 +    void TestRWindowCacheEntryExistsCacheDirtySetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.83 +    void TestRWindowCacheEntryExistsCacheDirtySetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache);
    1.84 +    void TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
    1.85 +    void TestRWindowCacheEntryExistsCacheDirtySetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.86 +    void TestRWindowCacheEntryExistsCacheDirtySetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.87 +    void TestRWindowCacheEntryExistsCacheDirtySetSizeEnableWindowSizeCacheL();
    1.88 +//    
    1.89 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeL(TSizeCacheStatus aEnableWindowSizeCache);
    1.90 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
    1.91 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.92 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.93 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeTwiceL(TSizeCacheStatus aEnableWindowSizeCache);
    1.94 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
    1.95 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetSizeErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.96 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
    1.97 +    void TestRWindowCacheEntryExistsCacheDirtyToCleanSetSizeEnableWindowSizeCacheL();
    1.98 +//
    1.99 +    void TestRBlankWindowSetSizeSetExtentL(TSizeCacheStatus aEnableWindowSizeCache);
   1.100 +    void TestRBackedUpWindowSetSizeErrSetExtentErrL(TSizeCacheStatus aEnableWindowSizeCache);
   1.101 +//    
   1.102 +    void SetRandomSeed(TInt64 aSeed);
   1.103 +    inline TInt NextRandom(TUint aMax = 0);
   1.104 +//    
   1.105 +    TUint64 TestRWindowSizePerformanceL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations);
   1.106 +//    
   1.107 +    static void CleanupWindowPool(TAny* aPtr);
   1.108 +    void RWindowPerformAction(TRWindowAction aAction, TSizeCacheStatus aEnableWindowSizeCache, RWsSession& aWs, RWindow& aWindow, TSize& aExpectedSize);
   1.109 +    void TestRandomisedStressL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations);
   1.110 +    void TestRandomisedStressMultiSessionL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations);
   1.111 +    void TestRandomisedStressCacheEntryVolumeL(TSizeCacheStatus aEnableWindowSizeCache, TUint aIterations, TUint aWindowPoolSize);
   1.112 +    void TestStressEnableWindowSizeCacheL(TUint aIterations);
   1.113 +    
   1.114 +protected:
   1.115 +//from  CTGraphicsStep
   1.116 +    virtual void RunTestCaseL(TInt aCurTestCase);
   1.117 +    
   1.118 +private:
   1.119 +    TInt64 iSeed;
   1.120 +    };
   1.121 +
   1.122 +//-----------------------------------------------------------
   1.123 +inline TInt CTWindowSizeCacheTest::NextRandom(TUint aMax)
   1.124 +    {
   1.125 +    TInt random = Math::Rand(iSeed);
   1.126 +    if (aMax != 0)
   1.127 +        {
   1.128 +        random = random % aMax;
   1.129 +        }
   1.130 +    return random;
   1.131 +    }
   1.132 +
   1.133 +//-----------------------------------------------------------
   1.134 +class CTWindowSizeCacheTestStep : public CTGraphicsStep
   1.135 +    {
   1.136 +public:
   1.137 +    CTWindowSizeCacheTestStep();
   1.138 +protected:
   1.139 +    //from CTGraphicsStep
   1.140 +    virtual CTGraphicsBase* CreateTestL();
   1.141 +    };
   1.142 +
   1.143 +_LIT(KTWindowSizeCacheTestStep,"TWindowSizeCacheTest");
   1.144 +
   1.145 +//-----------------------------------------------------------
   1.146 +#endif // TWINDOWSIZECACHE