Changeset 14648 for S60/trunk/S60WebUi

Show
Ignore:
Timestamp:
05/31/06 11:11:08 (3 years ago)
Author:
brmorris
Message:

S60WebKit:

2006-05-30 Pat <vincent.bradley@nokia.com>

Reviewed by Bradley/Zalan


  • S60WebUi/WebUi/data/WebUi.rss
  • S60WebUi/WebUi/inc/WebUi.hrh
  • S60WebUi/WebUi/inc/WebUiAutomatedTests.h
  • S60WebUi/WebUi/src/WebUiAutomatedTests.cpp
  • S60WebUi/WebUi/src/WebUiLoadObserver.cpp
  • S60WebUi/WebUi/src/WebUiWindowContainer.cpp


Location:
S60/trunk/S60WebUi/WebUi
Files:
7 modified

Legend:

Unmodified
Added
Removed
  • S60/trunk/S60WebUi/WebUi/data/WebUi.rss

    r14549 r14648  
    146146    items = 
    147147        { 
    148                 MENU_ITEM { command = ECmdRunNextTest; txt = "Run next test"; }, 
    149                 MENU_ITEM { command = ECmdRunFirstTest; txt = "Run first test"; }, 
    150                 MENU_ITEM { command = ECmdRunTestByIndex; txt = "Run test by index"; }, 
    151                 MENU_ITEM { command = ECmdRunAllTests; txt = "Run all tests"; }, 
     148                MENU_ITEM { command = ECmdRunNextLayoutTest; txt = "Run next layout test"; }, 
     149                MENU_ITEM { command = ECmdRunFirstLayoutTest; txt = "Run first layout test"; }, 
     150                MENU_ITEM { command = ECmdRunLayoutTestByIndex; txt = "Run layout test by index"; }, 
     151                MENU_ITEM { command = ECmdRunAllLayoutTests; txt = "Run all layout tests"; }, 
    152152                MENU_ITEM { command = ECmdListAllTests; txt = "List all tests"; } 
    153153        }; 
  • S60/trunk/S60WebUi/WebUi/inc/WebUi.hrh

    r14549 r14648  
    8282    ECmdCloseAll, 
    8383    ECmdRunAllTests, 
    84     ECmdRunFirstTest, 
    85     ECmdRunNextTest, 
    86     ECmdListAllTests, 
    87     ECmdRunTestByIndex 
     84    ECmdRunAllLayoutTests, 
     85    ECmdRunFirstLayoutTest, 
     86    ECmdRunNextLayoutTest, 
     87    ECmdRunLayoutTestByIndex, 
     88    ECmdListAllTests 
    8889    }; 
    8990 
  • S60/trunk/S60WebUi/WebUi/inc/WebUiAutomatedTests.h

    r14549 r14648  
    1010*    All rights reserved. 
    1111 
    12      Redistribution and use in source and binary forms, with or without 
    13      modification, are permitted provided that the following conditions 
    14      are met: 
     12 Redistribution and use in source and binary forms, with or without 
     13 modification, are permitted provided that the following conditions 
     14 are met: 
    1515 
    1616*      * Redistributions of source code must retain the above copyright 
     
    2424*        from this software without specific prior written permission. 
    2525 
    26      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    27      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    28      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    29      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    30      OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    31      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    32      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
    33      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
    34      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    35      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
    36      USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
    37      DAMAGE. 
     26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
     36 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
     37 DAMAGE. 
    3838 
    3939*    Please see file patentlicense.txt for further grants. 
     
    5656// the automated tests. 
    5757// Layout test commands 
     58_LIT(KRunAllTests, "runalltests"); 
    5859_LIT(KRunAllLayoutTests, "runalllayouttests"); 
    5960_LIT(KRunFirstLayoutTest, "runfirstlayouttest"); 
     
    114115        CWebUiAutomatedTests( CBrCtlInterface* aEngine ); 
    115116 
    116             /** 
     117      /** 
    117118        * ConstructL 
    118119        * EPOC default constructor.         
     
    131132        * @return TInt 
    132133        */ 
    133         TInt DoAutomatedTestsActionL( TDesC& aActionString ); 
     134        TInt DoAutomatedTestsActionL( const TDesC& aActionString ); 
    134135 
    135136        /** 
     
    192193 
    193194    private:    // new methods 
     195 
     196        /** 
     197        * RunAllTestsL 
     198        * @since 3.1 
     199        * @param none 
     200        * @return TInt 
     201        */ 
     202        TInt RunAllTestsL(); 
     203 
    194204        /** 
    195205        * RunAllLayoutTestsL 
     
    257267        TInt LoadTestUrlsL( const TDesC& aDirectory, 
    258268                            const TDesC& aExtension ); 
     269 
     270        /** 
     271        * PrepPerformanceResultsFileL 
     272        * @since 3.1 
     273        * @return void 
     274        */ 
     275        void PrepPerformanceResultsFileL(); 
    259276 
    260277        /** 
  • S60/trunk/S60WebUi/WebUi/src/WebUiAutomatedTests.cpp

    <
    r14549 r14648  
    1010*    All rights reserved. 
    1111* 
    12      Redistribution and use in source and binary forms, with or without 
    13      modification, are permitted provided that the following conditions 
    14      are met: 
     12 Redistribution and use in source and binary forms, with or without 
     13 modification, are permitted provided that the following conditions 
     14 are met: 
    1515* 
    1616*      * Redistributions of source code must retain the above copyright 
     
    2424*        from this software without specific prior written permission. 
    2525* 
    26      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
    27      "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
    28      LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
    29      A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
    30      OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
    31      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
    32      LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
    33      DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
    34      THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
    35      (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
    36      USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
    37      DAMAGE. 
     26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 
     27 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 
     28 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR 
     29 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT 
     30 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
     31 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT 
     32 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 
     33 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 
     34 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 
     35 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE 
     36 USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 
     37 DAMAGE. 
    3838* 
    3939*    Please see file patentlicense.txt for further grants. 
     
    7676 
    7777// These strings are used to create the html test result files (ie Content) 
    78 _LIT8(KPagesLoadedContent, "<html>\r\n<head>\r\n<title>Automated Test Results</title>\r\n</head>\r\n<body bgcolor=\"lightgreen\">\r\n"); 
    79 _LIT8(KLayoutResultsContent, "<html>\r\n<head>\r\n<title>Layout Test Results</title>\r\n</head>\r\n<body>\r\n"); 
    80 _LIT8(KPerfResultContent, "<html>\r\n<head>\r\n<title>Performance Test Results</title>\r\n</head>\r\n<body>\r\n"); 
    81 _LIT8(KTestPageListContent, "<html>\r\n<head>\r\n<title>Automated Test Page List</title>\r\n</head>\r\n<body bgcolor=\"cyan\">\r\n"); 
     78_LIT8(KPagesLoadedContent, "<html>\r\n<head>\r\n<title>Test Page Loaded</title>\r\n</head>\r\n<body bgcolor=\"lightgreen\">\r\n"); 
     79_LIT8(KLayoutResultsContent, "<html>\r\n<head>\r\n<title>Layout Test Results</title>\r\n</head>\r\n<body bgcolor=\"red\">\r\n"); 
     80_LIT8(KPerfResultContent, "<html>\r\n<head>\r\n<title>Performance Test Results</title>\r\n</head>\r\n<body bgcolor=\"pink\">\r\n"); 
     81_LIT8(KTestPageListContent, "<html>\r\n<head>\r\n<title>Test Page List</title>\r\n</head>\r\n<body bgcolor=\"cyan\">\r\n"); 
    8282_LIT8(KBR, "<br>\r\n"); 
    8383_LIT8(KNBSP, "&nbsp;&nbsp;"); 
    84 _LIT8(KFileName, "<hr>\r\nFile: "); 
    85 _LIT8(KLayoutCompleteTime, "Layout complete time: "); 
    86 _LIT8(KDocumentCompleteTime, "Document complete time: "); 
     84_LIT8(KLayoutCompleteTime, "Layout complete time"); 
     85_LIT8(KDocumentCompleteTime, "Document complete time"); 
    8786_LIT8(KMicroSecs, " microsecs"); 
    8887_LIT8(KTableStart, "\r\n<table border=\"1\"><tr><th>Index</th><th>Path and Filename</th></tr>"); 
    8988_LIT8(KIndexTDEntry, "\r\n<tr><td> "); 
     89_LIT8(KIndexCenterTDEntry, "\r\n<tr><td align=\"center\"> "); 
    9090_LIT8(KFileTDEntry, " </td><td> "); 
    91 _LIT8(KEndTDEntry, " </td><tr>\r\n"); 
    92 _LIT8(KTableEnding, "</table>\r\n"); 
     91_LIT8(KEndTDEntry, " </td></tr>"); 
     92_LIT8(KTableEnding, "\r\n</table>\r\n"); 
    9393_LIT8(KCurrentPageLoading, "<br>\r\nCurrent page loading<br>"); 
    9494_LIT8(KTotalNumPages, "<b>Total number of test pages:</b> "); 
     
    145145    RFs rfs; 
    146146    TInt err = rfs.Connect(); 
    147     if ( !err ) 
     147    if ( err == KErrNone ) 
    148148        { 
    149149        rfs.MkDirAll( KTestingResultsDir ); 
     
    180180// --------------------------------------------------------- 
    181181// 
    182 TInt CWebUiAutomatedTests::DoAutomatedTestsActionL( TDesC& aActionString ) 
     182TInt CWebUiAutomatedTests::DoAutomatedTestsActionL( const TDesC& aActionString ) 
    183183    { 
    184184    TInt err( KErrNotFound ); 
    185185 
     186    if ( aActionString.Find( KRunAllTests ) != KErrNotFound ) 
     187        { 
     188        // This will run all of the tests from beginning until completed 
     189        err = RunAllTestsL(); 
     190        } 
    186191    if ( aActionString.Find( KRunAllLayoutTests ) != KErrNotFound ) 
    187192        { 
    188         // This will run all of the tests from beginning until completed 
     193        // This will run all of the layout tests from beginning until completed 
    189194        err = RunAllLayoutTestsL(); 
    190195        } 
    191196    else if ( aActionString.Find( KRunFirstLayoutTest ) != KErrNotFound ) 
    192197        { 
    193         // This will run the first test case, iPageIndex = 0 
     198        // This will run the first layout test case, iPageIndex = 0 
    194199        err = RunFirstLayoutTestL(); 
    195200        } 
    196201    else if ( aActionString.Find( KRunNextLayoutTest ) != KErrNotFound ) 
    197202        { 
    198         // This will run the next test case, using current iPageIndex 
     203        // This will run the next layout test case, using current iPageIndex 
    199204        err = RunNextLayoutTestL(); 
    200205        } 
     
    207212    else if ( aActionString.Find( KRunLayoutTestByIndex ) != KErrNotFound ) 
    208213        { 
     214        // This will run the layout test case, using a specified iPageIndex 
    209215        err = RunLayoutTestByIndexL(); 
    210216        } 
    211217    else if ( aActionString.Find( KRunPerformanceTests ) != KErrNotFound ) 
    212218        { 
     219        // This will run the next layout test case, using current iPageIndex 
    213220        err = RunAllPerformanceTestsL(); 
    214221        } 
     
    218225 
    219226// --------------------------------------------------------- 
    220 // CWebUiAutomatedTests::RunLayoutTestsL 
     227// CWebUiAutomatedTests::RunAllTestsL 
     228// Run all of the test cases until complete. This loads all 
     229// of the test cases urls into iUrlArray. This method will run 
     230// both the layout render tree and performance tests. It is currently 
     231// called by the launcher (ATF script). 
     232// --------------------------------------------------------- 
     233// 
     234TInt CWebUiAutomatedTests::RunAllTestsL() 
     235    { 
     236    TInt err( KErrNone ); 
     237 
     238    // If we haven't already, get the test pages url 
     239    if ( iUrlArray->Count() == 0 ) 
     240        { 
     241        err = LoadTestUrlsL( KLayoutTestsDir(), KHtmlTestFiles() ); 
     242        } 
     243 
     244    // If we found layout test pages, start loading 
     245    if ( err == KErrNone && iUrlArray->Count() ) 
     246        { 
     247        // If we found test pages, prep the performance results file. 
     248        PrepPerformanceResultsFileL(); 
     249         
     250        // Set Layout test mode, ie run layout tests 
     251        iLayoutTestMode = ETrue; 
     252        // Set Performance test mode, ie run performance tests 
     253        iPerformanceTestMode = ETrue; 
     254        // Set run all tests, ie run all test cases until complete 
     255        iRunAllTests = ETrue; 
     256        // Set the test page index to run the first page 
     257        iPageIndex = 0; 
     258         
     259        LoadTestPageL(); 
     260        } 
     261 
     262    return err; 
     263    } 
     264 
     265// --------------------------------------------------------- 
     266// CWebUiAutomatedTests::RunAllLayoutTestsL 
    221267// Run all of the layout test cases until complete. This loads all 
    222268// of the test cases urls into iUrlArray. 
     
    234280 
    235281    // If we found layout test pages, start loading 
    236     if ( !err && iUrlArray->Count() ) 
    237         { 
     282    if ( err  == KErrNone && iUrlArray->Count() ) 
     283        { 
     284        // Set our testing mode 
    238285        iLayoutTestMode = ETrue; 
    239286        iRunAllTests = ETrue; 
     287 
     288        // Set our testing page index 
     289        iPageIndex = 0; 
    240290        LoadTestPageL(); 
    241291        } 
     
    261311 
    262312    // If we found layout test pages, start loading 
    263     if ( !err && iUrlArray->Count() ) 
    264         { 
     313    if ( err == KErrNone && iUrlArray->Count() ) 
     314        { 
     315        // Set our testing mode 
    265316        iLayoutTestMode = ETrue; 
    266317        iRunAllTests = EFalse; 
     318 
     319        // Set our testing page index 
    267320        iPageIndex = 0; 
    268321        LoadTestPageL(); 
     
    286339        { 
    287340        err = LoadTestUrlsL( KLayoutTestsDir(), KHtmlTestFiles() ); 
     341        // We are doing this for the first time, the increment below will 
     342        // make iPageIndex=0 (first test case) 
     343        iPageIndex = -1; 
    288344        } 
    289345 
    290346    // If we found layout test pages, start loading 
    291     if ( !err && iUrlArray->Count() ) 
    292         { 
     347    if ( err == KErrNone && iUrlArray->Count() ) 
     348        { 
     349        // Set our testing mode 
    293350        iLayoutTestMode = ETrue; 
    294351        iRunAllTests = EFalse; 
     352 
     353        // Set our next testing page index 
     354        ++iPageIndex; 
    295355        LoadTestPageL(); 
    296356        } 
     
    317377 
    318378    // If we found layout test pages, start loading test page using index 
    319     if ( !err && iUrlArray->Count() ) 
     379    if ( err == KErrNone && iUrlArray->Count() ) 
    320380        { 
    321381        // Get the index of the test page we want to load 
     
    345405            } 
    346406 
    347         // We have a valid index, so use it 
    348         iPageIndex = pageIndex; 
     407        // Set our testing mode 
    349408        iLayoutTestMode = ETrue; 
    350409        iRunAllTests = EFalse; 
     410 
     411        // We have a valid testing page index, use it 
     412        iPageIndex = pageIndex; 
    351413        LoadTestPageL(); 
    352414        } 
     
    365427    // developer can go to thier developement machine file system and review 
    366428    // the delta's introduced and make any code changes necessary to correct 
    367     // the layout (render tree). 
     429    // the layout (render tree). See ATF script. 
    368430 
    369431    return KErrNone; 
     
    385447        } 
    386448 
    387     // If we found test pages, prep the results file and start loading 
    388     if ( !err && iUrlArray->Count() ) 
    389         { 
    390         // Get the total number of test pages 
    391         HBufC8* numTestsRun = HBufC8::NewLC( KMaxBufferSize ); 
    392         ++cleanupCount; 
    393         numTestsRun->Des().AppendNum( iUrlArray->Count() ); 
    394  
    395         // Add the number of test line 
    396         TInt numTestsLen( KTotalNumPages().Length() + numTestsRun->Des().Length() + 
    397                           KBR().Length() + KHtmlEnding().Length() ); 
    398         TInt htmlLen( KPerfResultContent().Length() + numTestsLen ); 
    399  
    400         // Don't put this pointer on cleanup stack 
    401         delete iHtmlFileBuffer; 
    402         iHtmlFileBuffer = NULL; 
    403         iHtmlFileBuffer = HBufC8::NewL( htmlLen ); 
    404  
    405         // Prepare the beginning of performance results buffer (html page) 
    406         TPtr8 perfResultsPtr( iHtmlFileBuffer->Des() ); 
    407         perfResultsPtr.Copy( KPerfResultContent() ); 
    408         perfResultsPtr.Append( KTotalNumPages() ); 
    409         perfResultsPtr.Append( *numTestsRun ); 
    410         perfResultsPtr.Append( KBR() ); 
    411         perfResultsPtr.Append( KHtmlEnding() ); 
    412  
     449    // If we found test pages, prep the performance results file 
     450    // and start loading 
     451    if ( err == KErrNone && iUrlArray->Count() ) 
     452        { 
     453        // If we found test pages, prep the performance results file. 
     454        PrepPerformanceResultsFileL(); 
     455         
     456        // Set our test mode 
    413457        iPerformanceTestMode = ETrue; 
    414458        iRunAllTests = ETrue; 
     459         
    415460        LoadTestPageL(); 
    416461        } 
     
    460505    CDir* currentDirEntries = NULL; 
    461506 
    462         do 
    463             { 
     507  do 
     508      { 
    464509        delete currentDirEntries; 
    465510        dirScan->NextL( currentDirEntries ); 
     
    495540                } 
    496541            } 
    497                 } while ( currentDirEntries ); 
     542    } while ( currentDirEntries ); 
    498543 
    499544    // Clean up our memory 
     
    510555 
    511556// --------------------------------------------------------- 
     557// CWebUiAutomatedTests::PrepPerformanceResultsFileL 
     558// Prepare the initial content for the performance results file. 
     559// --------------------------------------------------------- 
     560// 
     561void CWebUiAutomatedTests::PrepPerformanceResultsFileL() 
     562    { 
     563    // Get the total number of test pages. 
     564    HBufC8* numTestsRun = HBufC8::NewLC( KMaxBufferSize ); 
     565    numTestsRun->Des().AppendNum( iUrlArray->Count() ); 
     566 
     567    // Add the number of test line 
     568    TInt htmlLen( KPerfResultContent().Length() + KTotalNumPages().Length() + 
     569                  numTestsRun->Length() + KBR().Length() + 
     570                  KTableStart().Length() ); 
     571 
     572    // Don't put this pointer on cleanup stack 
     573    delete iHtmlFileBuffer; 
     574    iHtmlFileBuffer = NULL; 
     575    iHtmlFileBuffer = HBufC8::NewL( htmlLen ); 
     576 
     577    // Prepare the beginning of performance results buffer (html page) 
     578    TPtr8 perfResultsPtr( iHtmlFileBuffer->Des() ); 
     579    perfResultsPtr.Copy( KPerfResultContent() ); 
     580    perfResultsPtr.Append( KTotalNumPages() ); 
     581    perfResultsPtr.Append( *numTestsRun ); 
     582    perfResultsPtr.Append( KBR() ); 
     583    perfResultsPtr.Append( KTableStart() ); 
     584 
     585    // Clean up memory 
     586    CleanupStack::PopAndDestroy( 1 );   // numTestsRun 
     587    } 
     588 
     589// --------------------------------------------------------- 
    512590// CWebUiAutomatedTests::DumpLayoutResults 
    513591// --------------------------------------------------------- 
     
    530608                                TPerformanceTimes& aPerformance ) 
    531609    { 
    532     if ( !iHtmlFileBuffer ) 
    533         { 
    534         // We don't have a performance test results buffer 
     610    if ( !iHtmlFileBuffer || iPageIndex < 0 || iPageIndex >= iUrlArray->Count() ) 
     611        { 
     612        // We don't have a performance test results buffer, or page index 
     613        // is out of range, i.e. we are at the end of the url array 
    535614        return; 
    536615        } 
     
    540619    TInt cleanupCount( 0 ); 
    541620 
    542     // Get the path and filename of the last url loaded (Convert 16->8bit) 
    543     TPtr filename( iUrlArray->At( iPageIndex-1 )->Des() ); 
    544     HBufC8* filename8 = HBufC8::NewLC( filename.Length() ); 
    545     ++cleanupCount; 
    546     filename8->Des().Copy( filename ); 
    547  
    548     // Get the time to layout document 
     621    // Create the index and path filename line. 
     622    // Get the index of current test page running. 
     623    HBufC8* currentPageIndex = HBufC8::NewLC( KMaxBufferSize ); 
     624    ++cleanupCount; 
     625    currentPageIndex->Des().AppendNum( iPageIndex ); 
     626 
     627    // Get the path filename of the current test page loading (Convert 16->8bit) 
     628    TPtr currentFile( iUrlArray->At( iPageIndex )->Des() ); 
     629    HBufC8* currentFilename8 = HBufC8::NewLC( currentFile.Length() ); 
     630    ++cleanupCount; 
     631    currentFilename8->Des().Copy( currentFile ); 
     632 
     633    // Remove the file scheme from the current filename 
     634    TInt parseLen( currentFilename8->Des().Length() - 
     635                   KFileScheme().Length() ); 
     636    TPtrC8 filename8( currentFilename8->Des().Right( parseLen ) ); 
     637 
     638    TInt fileLen( KIndexCenterTDEntry().Length() + 
     639                  currentPageIndex->Des().Length() + KFileTDEntry().Length() + 
     640                  filename8.Length() + KEndTDEntry().Length() ); 
     641 
     642    HBufC8* fileEntry = HBufC8::NewLC( fileLen ); 
     643    ++cleanupCount; 
     644    TPtr8 fileEntryPtr( fileEntry->Des() ); 
     645    fileEntryPtr.Copy( KIndexCenterTDEntry() ); 
     646    fileEntryPtr.Append( *currentPageIndex ); 
     647    fileEntryPtr.Append( KFileTDEntry() ); 
     648    fileEntryPtr.Append( filename8 ); 
     649    fileEntryPtr.Append( KEndTDEntry() ); 
     650 
     651    // Create the layout complete time line 
    549652    timeDelta = aPerformance.timeLayoutComplete.Int64(); 
    550653    HBufC8* layoutTime = HBufC8::NewLC( KMaxBufferSize ); 
     
    552655    layoutTime->Des().AppendNum( timeDelta ); 
    553656 
    554     // Get the time to complete document 
     657    TInt layoutLen( KIndexTDEntry().Length() + KLayoutCompleteTime().Length() + 
     658                    KFileTDEntry().Length() + layoutTime->Des().Length() + 
     659                    KMicroSecs().Length() + KEndTDEntry().Length() ); 
     660 
     661    HBufC8* layoutEntry = HBufC8::NewLC( layoutLen ); 
     662    ++cleanupCount; 
     663    TPtr8 layoutEntryPtr( layoutEntry->Des() ); 
     664    layoutEntryPtr.Copy( KIndexTDEntry() ); 
     665    layoutEntryPtr.Append( KLayoutCompleteTime() ); 
     666    layoutEntryPtr.Append( KFileTDEntry() ); 
     667    layoutEntryPtr.Append( *layoutTime ); 
     668    layoutEntryPtr.Append( KMicroSecs() ); 
     669    layoutEntryPtr.Append( KEndTDEntry() ); 
     670 
     671    // Create the Document complete time line 
    555672    timeDelta = aPerformance.timeDocumentComplete.Int64(); 
    556673    HBufC8* completeTime = HBufC8::NewLC( KMaxBufferSize ); 
     
    558675    completeTime->Des().AppendNum( timeDelta ); 
    559676 
    560     // Add the filename line 
    561     TInt fileLen( KFileName().Length() + filename8->Des().Length() + 
    562                   KBR().Length() ); 
    563  
    564     HBufC8* fileEntry = HBufC8::NewLC( fileLen ); 
    565     ++cleanupCount; 
    566     TPtr8 fileEntryPtr( fileEntry->Des() ); 
    567     fileEntryPtr.Append( KFileName() ); 
    568     fileEntryPtr.Append( *filename8 ); 
    569     fileEntryPtr.Append( KBR() ); 
    570  
    571     // Add the layout complete time line 
    572     TInt layoutLen( KLayoutCompleteTime().Length() + 
    573                     layoutTime->Des().Length() + KMicroSecs().Length() + 
    574                     KBR().Length() ); 
    575  
    576     HBufC8* layoutEntry = HBufC8::NewLC( layoutLen ); 
    577     ++cleanupCount; 
    578     TPtr8 layoutEntryPtr( layoutEntry->Des() ); 
    579     layoutEntryPtr.Append( KLayoutCompleteTime() ); 
    580     layoutEntryPtr.Append( *layoutTime ); 
    581     layoutEntryPtr.Append( KMicroSecs() ); 
    582     layoutEntryPtr.Append( KBR() ); 
    583  
    584     // Add the document complete time line 
    585     TInt completeLen( KDocumentCompleteTime().Length() + 
    586                       completeTime->Des().Length() + KMicroSecs().Length() + 
    587                       KBR().Length() ); 
     677    TInt completeLen( KIndexTDEntry().Length() + KDocumentCompleteTime().Length() + 
     678                      KFileTDEntry().Length() + completeTime->Des().Length() + 
     679                      KMicroSecs().Length() + KEndTDEntry().Length() ); 
    588680 
    589681    HBufC8* completeEntry = HBufC8::NewLC( completeLen ); 
    590682    ++cleanupCount; 
    591683    TPtr8 completeEntryPtr( completeEntry->Des() ); 
     684    completeEntryPtr.Copy( KIndexTDEntry() ); 
    592685    completeEntryPtr.Append( KDocumentCompleteTime() ); 
     686    completeEntryPtr.Append( KFileTDEntry() ); 
    593687    completeEntryPtr.Append( *completeTime ); 
    594688    completeEntryPtr.Append( KMicroSecs() ); 
    595     completeEntryPtr.Append( KBR() ); 
    596  
    597     // Expand the results buffer to hold the new entry 
     689    completeEntryPtr.Append( KEndTDEntry() ); 
     690 
     691    // Expand the results buffer to hold the new entries 
    598692    TInt newLen( iHtmlFileBuffer->Des().Length() + fileLen + 
    599693                 layoutLen + completeLen ); 
     
    603697    HBufC8* tempResult = HBufC8::NewL( newLen ); 
    604698    TPtr8 tempResultPtr( tempResult->Des() ); 
    605     tempResultPtr.Append( iHtmlFileBuffer->Des() ); 
     699    tempResultPtr.Copy( iHtmlFileBuffer->Des() ); 
    606700    tempResultPtr.Append( *fileEntry ); 
    607701    tempResultPtr.Append( *layoutEntry ); 
     
    656750 
    657751    TInt err = resultFile.Replace( fs, KLayoutResultFile, EFileWrite ); 
    658     if ( !err ) 
     752    if ( err == KErrNone ) 
    659753        { 
    660754        resultFile.Write( layoutEntry->Des() );