[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-1049-g2e11a8e

kinuko at chromium.org kinuko at chromium.org
Fri Jan 21 15:06:53 UTC 2011


The following commit has been merged in the debian/experimental branch:
commit 42676de67b5283df18c0bae9b6d4cf028b2fba76
Author: kinuko at chromium.org <kinuko at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Jan 7 07:07:32 2011 +0000

    2011-01-06  Kinuko Yasuda  <kinuko at 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.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@75232 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index f1c7c48..50c1145 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,16 @@
+2011-01-06  Kinuko Yasuda  <kinuko at 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.
+
 2011-01-06  Mihai Parparita  <mihaip at chromium.org>
 
         Unreviewed; chromium test expectations update.
diff --git a/LayoutTests/fast/filesystem/op-get-metadata-expected.txt b/LayoutTests/fast/filesystem/op-get-metadata-expected.txt
new file mode 100644
index 0000000..7393843
--- /dev/null
+++ b/LayoutTests/fast/filesystem/op-get-metadata-expected.txt
@@ -0,0 +1,21 @@
+* Running: GetMetadata
+PASS Succeeded: "/".getMetadata()
+PASS new Date() is >= this.environment["/.modificationTime"]
+PASS Succeeded: "/".getDirectory("/a")
+PASS Succeeded: "/a".getMetadata()
+PASS this.environment["/a.modificationTime"] is >= this.roundedStartDate
+PASS new Date() is >= this.environment["/a.modificationTime"]
+PASS Succeeded: "/".getFile("/b")
+PASS Succeeded: "/b".getMetadata()
+PASS this.environment["/b.modificationTime"] is >= this.roundedStartDate
+PASS new Date() is >= this.environment["/b.modificationTime"]
+PASS Succeeded: "/tmp".remove()
+PASS this.expectedErrorCode + "" is "1"
+PASS this.environment["/a.modificationTime"] is >= this.environment["/.modificationTime"]
+PASS this.environment["/b.modificationTime"] is >= this.environment["/.modificationTime"]
+PASS this.environment["/b.modificationTime"] is >= this.environment["/a.modificationTime"]
+Finished running tests.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/fast/filesystem/op-get-metadata.html b/LayoutTests/fast/filesystem/op-get-metadata.html
new file mode 100644
index 0000000..4e1f746
--- /dev/null
+++ b/LayoutTests/fast/filesystem/op-get-metadata.html
@@ -0,0 +1,15 @@
+<html>
+<head>
+<link rel="stylesheet" href="../js/resources/js-test-style.css">
+<script src="../js/resources/js-test-pre.js"></script>
+<script src="resources/fs-test-util.js"></script>
+</head>
+<body>
+<div id="console"></div>
+<script src="resources/op-get-metadata.js"></script>
+<script src="resources/op-tests-helper.js"></script>
+<script src="../js/resources/js-test-post.js"></script>
+</body>
+</html>
+
+
diff --git a/LayoutTests/fast/filesystem/resources/op-get-metadata.js b/LayoutTests/fast/filesystem/resources/op-get-metadata.js
new file mode 100644
index 0000000..f4adea0
--- /dev/null
+++ b/LayoutTests/fast/filesystem/resources/op-get-metadata.js
@@ -0,0 +1,21 @@
+var testCases = [
+    {
+        name: 'GetMetadata',
+        precondition: [
+            {fullPath:'/tmp'},
+        ],
+        tests: [
+            function(helper) { helper.getMetadata('/'); },
+            function(helper) { helper.getDirectory('/', '/a', {create:true}); },
+            function(helper) { helper.getMetadata('/a'); },
+            function(helper) { helper.getFile('/', '/b', {create:true}); },
+            function(helper) { helper.getMetadata('/b'); },
+            function(helper) { helper.remove('/tmp'); },
+            function(helper) { helper.getMetadata('/tmp', FileError.NOT_FOUND_ERR); },
+            function(helper) { helper.shouldBeGreaterThanOrEqual('/a.modificationTime', '/.modificationTime'); },
+            function(helper) { helper.shouldBeGreaterThanOrEqual('/b.modificationTime', '/.modificationTime'); },
+            function(helper) { helper.shouldBeGreaterThanOrEqual('/b.modificationTime', '/a.modificationTime'); }
+        ],
+        postcondition: [ ],
+    },
+];
diff --git a/LayoutTests/fast/filesystem/resources/op-tests-helper.js b/LayoutTests/fast/filesystem/resources/op-tests-helper.js
index 50501ee..8ce210a 100644
--- a/LayoutTests/fast/filesystem/resources/op-tests-helper.js
+++ b/LayoutTests/fast/filesystem/resources/op-tests-helper.js
@@ -141,15 +141,18 @@ function runOperationTest(fileSystem, testCase, successCallback, errorCallback)
         this.currentReader = null;
         this.readEntries = [];
 
+        this.getSymbolString = function(symbol)
+        {
+            return 'this.environment["' + symbol + '"]';
+        };
+
         this.testSuccessCallback = function()
         {
             if (!this.expectedErrorCode) {
                 testPassed('Succeeded: ' + this.stage);
                 this.runNextTest();
-            } else {
+            } else
                 testFailed('Unexpectedly succeeded while ' + this.stage);
-                this.errorCallback();
-            }
         };
 
         this.entry = null;
@@ -162,10 +165,8 @@ function runOperationTest(fileSystem, testCase, successCallback, errorCallback)
                 shouldBe.apply(this, ['this.environment[this.entry.fullPath].isFile + ""', '"' + entry.isFile + '"']);
                 shouldBe.apply(this, ['this.environment[this.entry.fullPath].isDirectory + ""', '"' + entry.isDirectory + '"']);
                 this.runNextTest();
-            } else {
+            } else
                 testFailed('Unexpectedly succeeded while ' + this.stage);
-                this.errorCallback(error);
-            }
         };
 
         this.testCreateSuccessCallback = function(entry)
@@ -174,10 +175,8 @@ function runOperationTest(fileSystem, testCase, successCallback, errorCallback)
                 testPassed('Succeeded: ' + this.stage);
                 this.environment[entry.fullPath] = entry;
                 this.runNextTest();
-            } else {
+            } else
                 testFailed('Unexpectedly succeeded while ' + this.stage);
-                this.errorCallback();
-            }
         };
 
         this.testGetParentSuccessCallback = function(entry)
@@ -186,19 +185,14 @@ function runOperationTest(fileSystem, testCase, successCallback, errorCallback)
                 testPassed('Succeeded: ' + this.stage);
                 debug('Parent entry: ' + toString(entry));
                 this.runNextTest();
-            } else {
+            } else
                 testFailed('Unexpectedly succeeded while ' + this.stage);
-                this.errorCallback();
-            }
         };
 
         this.testReadEntriesSuccessCallback = function(entries)
         {
-            if (this.expectedErrorCode) {
+            if (this.expectedErrorCode)
                 testFailed('Unexpectedly succeeded while ' + this.stage);
-                this.errorCallback(error);
-                return;
-            }
 
             for (var i = 0; i < entries.length; ++i)
                 this.readEntries.push(entries[i]);
@@ -213,6 +207,22 @@ function runOperationTest(fileSystem, testCase, successCallback, errorCallback)
             this.runNextTest();
         };
 
+        this.testMetadataSuccessCallback = function(metadata, entry)
+        {
+            if (!this.expectedErrorCode) {
+                testPassed('Succeeded: ' + this.stage);
+                var symbol = entry + '.modificationTime';
+                this.environment[symbol] = metadata.modificationTime;
+
+                var entryMetadataString = this.getSymbolString(symbol);
+                if (entry != '/')
+                    shouldBeGreaterThanOrEqual.apply(this, [entryMetadataString, 'this.roundedStartDate']);
+                shouldBeGreaterThanOrEqual.apply(this, ['new Date()', entryMetadataString]);
+                this.runNextTest();
+            } else
+                testFailed('Unexpectedly succeeded while ' + this.stage);
+        };
+
         this.testErrorCallback = function(error)
         {
             if (this.expectedErrorCode) {
@@ -253,7 +263,7 @@ function runOperationTest(fileSystem, testCase, successCallback, errorCallback)
         {
             this.expectedErrorCode = expectedErrorCode;
             this.stage = '"' + entry + '".getMetadata()';
-            this.environment[entry].getMetadata(bindCallback(this, this.testSuccessCallback), bindCallback(this, this.testErrorCallback));
+            this.environment[entry].getMetadata(bindCallback(this, this.testMetadataSuccessCallback, entry), bindCallback(this, this.testErrorCallback));
         };
 
         this.remove = function(entry, expectedErrorCode)
@@ -293,11 +303,25 @@ function runOperationTest(fileSystem, testCase, successCallback, errorCallback)
             this.environment[entry].moveTo(this.environment[destinationParent], newName, bindCallback(this, this.testSuccessCallback), bindCallback(this, this.testErrorCallback));
         };
 
+        this.shouldBe = function(symbol1, symbol2)
+        {
+            shouldBe.apply(this, [this.getSymbolString(symbol1), this.getSymbolString(symbol2)]);
+            this.runNextTest();
+        };
+
+        this.shouldBeGreaterThanOrEqual = function(symbol1, symbol2)
+        {
+            shouldBeGreaterThanOrEqual.apply(this, [this.getSymbolString(symbol1), this.getSymbolString(symbol2)]);
+            this.runNextTest();
+        };
+
         //---------------------------------------------------------------
         this.start = function()
         {
             this.expectedErrorCode = '';
             this.stage = 'resetting filesystem';
+            // 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.
+            this.roundedStartDate = new Date((new Date()).getTime() - 999);
             removeAllInDirectory(this.fileSystem.root, bindCallback(this, this.setUp), bindCallback(this, this.testErrorCallback));
         };
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list