haikuwebkit/LayoutTests/resources
Aditya Keerthi 7686cbd037 [iOS] Refactor WKFileUploadPanel to use UniformTypeIdentifiers
https://bugs.webkit.org/show_bug.cgi?id=223000
<rdar://problem/75237774>

Reviewed by Tim Horton.

Source/WebKit:

Uniform type identifier APIs in MobileCoreServices were deprecated in
iOS 14. Instead, use the new APIs in the UniformTypeIdentifiers
framework.

This patch also cleans up instances of code duplication when comparing
uniform type idenfifiers and increases the test coverage for
WKFileUploadPanel.

Test: fast/forms/ios/file-upload-panel-accept.html

* Configurations/WebKit.xcconfig:

Link UniformTypeIdentifiers.framework on watchOS and tvOS.

* UIProcess/API/ios/WKWebViewPrivateForTestingIOS.h:

Expose _filePickerAcceptedTypeIdentifiers to enable testing of accepted
file types.

* UIProcess/API/ios/WKWebViewTestingIOS.mm:
(-[WKWebView _filePickerAcceptedTypeIdentifiers]):
* UIProcess/ios/WKContentViewInteraction.h:
* UIProcess/ios/WKContentViewInteraction.mm:
(-[WKContentView filePickerAcceptedTypeIdentifiers]):
* UIProcess/ios/forms/WKFileUploadPanel.h:
* UIProcess/ios/forms/WKFileUploadPanel.mm:
(setContainsUTIThatConformsTo):

Modified this helper method to take in an NSSet rather than an NSArray
to avoid unnecessary conversion. Replaced MobileCoreServices API usage
with UniformTypeIdentifiers API.

(-[WKFileUploadPanel presentWithParameters:resultListener:]):

Determine the accepted UTIs and image picker configuration once before
presentation and store them in member variables to reduce code
duplication.

(-[WKFileUploadPanel currentAvailableActionTitles]):
(-[WKFileUploadPanel acceptedTypeIdentifiers]):

Expose the accepted type identifers as a sorted array for testing.

(-[WKFileUploadPanel _mediaTypesForPickerSourceType:]):
(-[WKFileUploadPanel _cameraButtonLabel]):
(-[WKFileUploadPanel contextMenuInteraction:configurationForMenuAtLocation:]):
(-[WKFileUploadPanel showFilePickerMenu]):
(-[WKFileUploadPanel showDocumentPickerMenu]):
(-[WKFileUploadPanel _uploadItemFromMediaInfo:successBlock:failureBlock:]):

Tools:

Added UIScriptController hooks to retrieve the type identifiers for
a presented file upload panel.

* TestRunnerShared/UIScriptContext/Bindings/UIScriptController.idl:
* TestRunnerShared/UIScriptContext/UIScriptController.h:
(WTR::UIScriptController::filePickerAcceptedTypeIdentifiers):
* WebKitTestRunner/ios/UIScriptControllerIOS.h:
* WebKitTestRunner/ios/UIScriptControllerIOS.mm:
(WTR::UIScriptControllerIOS::filePickerAcceptedTypeIdentifiers):

LayoutTests:

Added a test to verify that the value of the accept attribute for file
inputs is mapped to the correct set of type identifiers.

* fast/forms/ios/file-upload-panel-accept-expected.txt: Added.
* fast/forms/ios/file-upload-panel-accept.html: Added.
* resources/ui-helper.js:
(window.UIHelper.dismissFilePicker):
(window.UIHelper.filePickerAcceptedTypeIdentifiers):


Canonical link: https://commits.webkit.org/235425@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@274581 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2021-03-17 20:10:46 +00:00
..
Ahem.otf
Ahem.ttf
Ahem.woff
Ahem_CJK.ttf
SpaceOnly.otf
WebIDLParser.js
accessibility-helper.js
basic-gestures.js
check-layout-th.js
check-layout.js
dump-as-markup.js
gc.js
idlharness.js
image-preload-helper.js
js-test-post-async.js
js-test-post.js
js-test-pre.js
js-test.js
magnitude-perf.js
platform-helper.js
plugin.js
regress-post.js
regress-pre.js
srcset-helper.js
standalone-post.js
standalone-pre.js
test.swf
testharness.css
testharness.js
testharnessreport.js
ui-debugging.js
ui-helper.js [iOS] Refactor WKFileUploadPanel to use UniformTypeIdentifiers 2021-03-17 20:10:46 +00:00
wasm-builder.js
window-postmessage-open-close.html