WebKit Bugzilla
Attachment 341735 Details for
Bug 186184
: Some tests for webkitdirectory API fail when tests are in an APFS file system
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fixes the tests
bug-186184-20180531221837.patch (text/plain), 7.95 KB, created by
Ryosuke Niwa
on 2018-05-31 22:18:38 PDT
(
hide
)
Description:
Fixes the tests
Filename:
MIME Type:
Creator:
Ryosuke Niwa
Created:
2018-05-31 22:18:38 PDT
Size:
7.95 KB
patch
obsolete
>Index: LayoutTests/ChangeLog >=================================================================== >--- LayoutTests/ChangeLog (revision 232388) >+++ LayoutTests/ChangeLog (working copy) >@@ -1,3 +1,25 @@ >+2018-05-31 Ryosuke Niwa <rniwa@webkit.org> >+ >+ Some tests for webkitdirectory API fail when tests are in an APFS file system >+ https://bugs.webkit.org/show_bug.cgi?id=186184 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ On an APFS volume, files may not be listed in the lexicologically order and the size of a directory >+ may defer from that of HFS+. To make the test results consistent on either file systems, >+ sort file entries lexicologically by the name and list two possible directory sizes as the expectation. >+ >+ Added a new helper function, shouldBeOneOfValues, which takes an array of values as the expectation. >+ >+ * editing/pasteboard/entries-api/datatransfer-items-drop-directoryReader.html: >+ * editing/pasteboard/entries-api/datatransfer-items-drop-getAsEntry-expected.txt: >+ * editing/pasteboard/entries-api/datatransfer-items-drop-getAsEntry.html: >+ * fast/forms/file/entries-api/drag-folder-webkitEntries-expected.txt: >+ * fast/forms/file/entries-api/drag-folder-webkitEntries.html: >+ * fast/forms/file/entries-api/webkitdirectory-drag-folder.html: >+ * resources/js-test.js: >+ (shouldBeOneOfValues): Added. >+ > 2018-05-31 Per Arne Vollan <pvollan@apple.com> > > Skip http/tests/security/referrer-policy-header.html on Windows. >Index: LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-directoryReader.html >=================================================================== >--- LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-directoryReader.html (revision 232385) >+++ LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-directoryReader.html (working copy) >@@ -20,7 +20,13 @@ function getEntriesAsPromise(dirEntry) { > entries.forEach(e => result.push(e)); > doBatch(); > } else { >- resolve(result); >+ resolve(result.sort(function (a, b) { >+ if (a.name > b.name) >+ return 1; >+ else if (a.name < b.name) >+ return -1; >+ return 0; >+ })); > } > }, reject); > }; >Index: LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getAsEntry-expected.txt >=================================================================== >--- LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getAsEntry-expected.txt (revision 232385) >+++ LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getAsEntry-expected.txt (working copy) >@@ -16,7 +16,7 @@ PASS firstEntry.fullPath is "/test.txt" > PASS secondDataTransferItem.kind is "file" > PASS secondDataTransferItem.type is "" > PASS secondFile.name is "testFiles" >-PASS secondFile.size is 272 >+PASS secondFile.size is one of `272`, and `256` > PASS secondFile.type is "" > PASS secondEntry.isDirectory is true > PASS secondEntry.isFile is false >Index: LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getAsEntry.html >=================================================================== >--- LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getAsEntry.html (revision 232385) >+++ LayoutTests/editing/pasteboard/entries-api/datatransfer-items-drop-getAsEntry.html (working copy) >@@ -37,7 +37,7 @@ dropzone.ondrop = function(e) { > shouldBeEqualToString("secondDataTransferItem.type", ""); > secondFile = secondDataTransferItem.getAsFile(); > shouldBeEqualToString("secondFile.name", "testFiles"); >- shouldBe("secondFile.size", "272"); // Chrome returns folder size, Firefox returns 0. >+ shouldBeOneOfValues("secondFile.size", [272, 256]); // Chrome returns folder size, Firefox returns 0. 256 in APFS, 272 in HFS+ > shouldBeEqualToString("secondFile.type", ""); > > secondEntry = secondDataTransferItem.webkitGetAsEntry(); >Index: LayoutTests/fast/forms/file/entries-api/drag-folder-webkitEntries-expected.txt >=================================================================== >--- LayoutTests/fast/forms/file/entries-api/drag-folder-webkitEntries-expected.txt (revision 232385) >+++ LayoutTests/fast/forms/file/entries-api/drag-folder-webkitEntries-expected.txt (working copy) >@@ -16,7 +16,7 @@ PASS files[0].name is "test.txt" > PASS files[0].size is 5 > PASS files[0].type is "text/plain" > PASS files[1].name is "testFiles" >-PASS files[1].size is 272 >+PASS files[1].size is one of `272`, and `256` > PASS files[1].type is "" > PASS successfullyParsed is true > >Index: LayoutTests/fast/forms/file/entries-api/drag-folder-webkitEntries.html >=================================================================== >--- LayoutTests/fast/forms/file/entries-api/drag-folder-webkitEntries.html (revision 232385) >+++ LayoutTests/fast/forms/file/entries-api/drag-folder-webkitEntries.html (working copy) >@@ -48,7 +48,7 @@ function changed(event) > shouldBeEqualToString("files[0].type", "text/plain"); > > shouldBeEqualToString("files[1].name", "testFiles"); >- shouldBe("files[1].size", "272"); >+ shouldBeOneOfValues("files[1].size", [272, 256]); > shouldBeEqualToString("files[1].type", ""); > > finishJSTest(); >Index: LayoutTests/fast/forms/file/entries-api/webkitdirectory-drag-folder.html >=================================================================== >--- LayoutTests/fast/forms/file/entries-api/webkitdirectory-drag-folder.html (revision 232385) >+++ LayoutTests/fast/forms/file/entries-api/webkitdirectory-drag-folder.html (working copy) >@@ -31,7 +31,13 @@ function dragFilesOntoInput(input, files > > function changed(event) > { >- fileList = event.target.files; >+ fileList = Array.from(event.target.files).sort(function (a, b) { >+ if (a.name > b.name) >+ return 1; >+ else if (a.name < b.name) >+ return -1; >+ return 0; >+ }); > shouldBe("fileList.length", "5"); > shouldBeEqualToString("fileList[0].name", "file1.txt"); > shouldBeEqualToString("fileList[0].webkitRelativePath", "testFiles/file1.txt"); >Index: LayoutTests/resources/js-test.js >=================================================================== >--- LayoutTests/resources/js-test.js (revision 232385) >+++ LayoutTests/resources/js-test.js (working copy) >@@ -284,6 +284,45 @@ function shouldBe(_a, _b, _quiet) > testFailed(_a + " should be " + stringify(_bv) + " (of type " + typeof _bv + "). Was " + _av + " (of type " + typeof _av + ")."); > } > >+function shouldBeOneOfValues(_a, _values) >+{ >+ if ((typeof _a != "function" && typeof _a != "string")) >+ debug("WARN: shouldBeOneOfValues() expects the first argument to be a function or a string"); >+ if (!Array.isArray(_values)) { >+ testFailed("The second argument to shouldBeOneOfValues() must be an array of values"); >+ return; >+ } >+ >+ var _exception; >+ var _av; >+ try { >+ _av = (typeof _a == "function" ? _a() : eval(_a)); >+ } catch (e) { >+ _exception = e; >+ } >+ >+ var stringifiedValues = ''; >+ for (var i = 0; i < _values.length; ++i) { >+ if (i) { >+ if (i + 1 == _values.length) >+ stringifiedValues += ', and '; >+ else >+ stringifiedValues += ',' >+ } >+ stringifiedValues += "`" + stringify(_values[i]) + "`"; >+ } >+ if (_exception) >+ testFailed(_a + " should be one of " + stringifiedValues + ". Threw exception " + _exception); >+ else { >+ var matchedValue = _values.find(function (value) { return isResultCorrect(_av, value); }); >+ if (matchedValue) { >+ testPassed(_a + " is one of " + stringifiedValues); >+ } else { >+ testFailed(_a + " should be one of " + stringifiedValues + ". Was " + stringify(_av) + "."); >+ } >+ } >+} >+ > // Execute condition every 5 milliseconds until it succeeds. > function _waitForCondition(condition, completionHandler) > {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
cdumez
:
review+
ews-watchlist
:
commit-queue-
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 186184
: 341735 |
341761