Changeset 75232 in webkit


Ignore:
Timestamp:
Jan 6, 2011 11:07:32 PM (13 years ago)
Author:
kinuko@chromium.org
Message:

2011-01-06 Kinuko Yasuda <kinuko@chromium.org>

Reviewed by David Levin.

Add layout tests for Entry.getMetadata (FileSystem API)
https://bugs.webkit.org/show_bug.cgi?id=47311

  • fast/filesystem/op-get-metadata-expected.txt: Added.
  • fast/filesystem/op-get-metadata.html: Added.
  • fast/filesystem/resources/op-get-metadata.js: Added.
  • fast/filesystem/resources/op-tests-helper.js: Updated getMetadata implementation.
Location:
trunk/LayoutTests
Files:
3 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r75231 r75232  
     12011-01-06  Kinuko Yasuda  <kinuko@chromium.org>
     2
     3        Reviewed by David Levin.
     4
     5        Add layout tests for Entry.getMetadata (FileSystem API)
     6        https://bugs.webkit.org/show_bug.cgi?id=47311
     7
     8        * fast/filesystem/op-get-metadata-expected.txt: Added.
     9        * fast/filesystem/op-get-metadata.html: Added.
     10        * fast/filesystem/resources/op-get-metadata.js: Added.
     11        * fast/filesystem/resources/op-tests-helper.js: Updated getMetadata
     12        implementation.
     13
    1142011-01-06  Mihai Parparita  <mihaip@chromium.org>
    215
  • trunk/LayoutTests/fast/filesystem/resources/op-tests-helper.js

    r69485 r75232  
    142142        this.readEntries = [];
    143143
     144        this.getSymbolString = function(symbol)
     145        {
     146            return 'this.environment["' + symbol + '"]';
     147        };
     148
    144149        this.testSuccessCallback = function()
    145150        {
     
    147152                testPassed('Succeeded: ' + this.stage);
    148153                this.runNextTest();
    149             } else {
    150                 testFailed('Unexpectedly succeeded while ' + this.stage);
    151                 this.errorCallback();
    152             }
     154            } else
     155                testFailed('Unexpectedly succeeded while ' + this.stage);
    153156        };
    154157
     
    163166                shouldBe.apply(this, ['this.environment[this.entry.fullPath].isDirectory + ""', '"' + entry.isDirectory + '"']);
    164167                this.runNextTest();
    165             } else {
    166                 testFailed('Unexpectedly succeeded while ' + this.stage);
    167                 this.errorCallback(error);
    168             }
     168            } else
     169                testFailed('Unexpectedly succeeded while ' + this.stage);
    169170        };
    170171
     
    175176                this.environment[entry.fullPath] = entry;
    176177                this.runNextTest();
    177             } else {
    178                 testFailed('Unexpectedly succeeded while ' + this.stage);
    179                 this.errorCallback();
    180             }
     178            } else
     179                testFailed('Unexpectedly succeeded while ' + this.stage);
    181180        };
    182181
     
    187186                debug('Parent entry: ' + toString(entry));
    188187                this.runNextTest();
    189             } else {
    190                 testFailed('Unexpectedly succeeded while ' + this.stage);
    191                 this.errorCallback();
    192             }
     188            } else
     189                testFailed('Unexpectedly succeeded while ' + this.stage);
    193190        };
    194191
    195192        this.testReadEntriesSuccessCallback = function(entries)
    196193        {
    197             if (this.expectedErrorCode) {
    198                 testFailed('Unexpectedly succeeded while ' + this.stage);
    199                 this.errorCallback(error);
    200                 return;
    201             }
     194            if (this.expectedErrorCode)
     195                testFailed('Unexpectedly succeeded while ' + this.stage);
    202196
    203197            for (var i = 0; i < entries.length; ++i)
     
    214208        };
    215209
     210        this.testMetadataSuccessCallback = function(metadata, entry)
     211        {
     212            if (!this.expectedErrorCode) {
     213                testPassed('Succeeded: ' + this.stage);
     214                var symbol = entry + '.modificationTime';
     215                this.environment[symbol] = metadata.modificationTime;
     216
     217                var entryMetadataString = this.getSymbolString(symbol);
     218                if (entry != '/')
     219                    shouldBeGreaterThanOrEqual.apply(this, [entryMetadataString, 'this.roundedStartDate']);
     220                shouldBeGreaterThanOrEqual.apply(this, ['new Date()', entryMetadataString]);
     221                this.runNextTest();
     222            } else
     223                testFailed('Unexpectedly succeeded while ' + this.stage);
     224        };
     225
    216226        this.testErrorCallback = function(error)
    217227        {
     
    254264            this.expectedErrorCode = expectedErrorCode;
    255265            this.stage = '"' + entry + '".getMetadata()';
    256             this.environment[entry].getMetadata(bindCallback(this, this.testSuccessCallback), bindCallback(this, this.testErrorCallback));
     266            this.environment[entry].getMetadata(bindCallback(this, this.testMetadataSuccessCallback, entry), bindCallback(this, this.testErrorCallback));
    257267        };
    258268
     
    294304        };
    295305
     306        this.shouldBe = function(symbol1, symbol2)
     307        {
     308            shouldBe.apply(this, [this.getSymbolString(symbol1), this.getSymbolString(symbol2)]);
     309            this.runNextTest();
     310        };
     311
     312        this.shouldBeGreaterThanOrEqual = function(symbol1, symbol2)
     313        {
     314            shouldBeGreaterThanOrEqual.apply(this, [this.getSymbolString(symbol1), this.getSymbolString(symbol2)]);
     315            this.runNextTest();
     316        };
     317
    296318        //---------------------------------------------------------------
    297319        this.start = function()
     
    299321            this.expectedErrorCode = '';
    300322            this.stage = 'resetting filesystem';
     323            // Record rounded start date (current time minus 999 msec) here for the comparison. Entry.getMetadata() may return the last mod time in seconds accuracy while new Date() is milliseconds accuracy.
     324            this.roundedStartDate = new Date((new Date()).getTime() - 999);
    301325            removeAllInDirectory(this.fileSystem.root, bindCallback(this, this.setUp), bindCallback(this, this.testErrorCallback));
    302326        };
Note: See TracChangeset for help on using the changeset viewer.