[Cocoa] API tests using the Modern WebKit API should be able to create web process...
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Aug 2015 22:31:32 +0000 (22:31 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 23 Aug 2015 22:31:32 +0000 (22:31 +0000)
commitbd256ea5387b796373b8332a05182fd0a30cecc2
treeb79c72970febf3ec4d2922b05e1832388763bd49
parentd1200cf94d0a1411f7317b8ee5fe3229f187b8bc
[Cocoa] API tests using the Modern WebKit API should be able to create web process plug-ins
https://bugs.webkit.org/show_bug.cgi?id=148317

Reviewed by Dan Bernstein.

Added the ability for Modern WebKit API tests to create WKWebProcessPlugIns. A test can create a plug-in by
creating a class that conforms to WKWebProcessPlugIn, adding it to the WebProcessPlugIn target, and using the
WKWebViewConfiguration returned by +[WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:]
when creating WKWebViews.

Since TestWebKitAPI relies on a bundle parameter to know which test class to instantiate in the plug-in, I also
added a new API test for bundle parameters.

* TestWebKitAPI/Configurations/WebProcessPlugIn.xcconfig: Added. Named the bundle TestWebKitAPI.wkbundle and
named its executable TestWebKitAPI.bundle.
* TestWebKitAPI/PlatformUtilities.h: Declared TestPlugInClassNameParameter.
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: Added the WebProcessPlugIn target.
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleParameters.mm: Added.
(TEST): Tested bundle parameters by verifying that parameter changes in the UI process are observed in the bundle.
* TestWebKitAPI/Tests/WebKit2Cocoa/BundleParametersPlugIn.mm: Added.
(-[BundleParametersPlugIn webProcessPlugIn:didCreateBrowserContextController:]): Started observing changes to a
bundle parameter and asked for an initial notification.
(-[BundleParametersPlugIn dealloc]): Stopped observing changes to a bundle parameter.
(-[BundleParametersPlugIn observeValueForKeyPath:ofObject:change:context:]): When a bundle parameter changes,
mirror its value in the main frame's JSContext.
* TestWebKitAPI/WKWebViewConfigurationExtras.h: Added.
* TestWebKitAPI/WKWebViewConfigurationExtras.mm: Added.
(+[WKWebViewConfiguration testwebkitapi_configurationWithTestPlugInClassName:]): Created a configuration with
TestWebKitAPI's bundle URL and set a bundle parameter indicating the test plug-in's class name.
* TestWebKitAPI/cocoa/PlatformUtilitiesCocoa.mm: Defined TestPlugInClassNameParameter.
* TestWebKitAPI/cocoa/WebProcessPlugIn/Info.plist: Added. Set the principal class to WebProcessPlugIn.
* TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm: Added.
(-[WebProcessPlugIn webProcessPlugIn:initializeWithObject:]): Forwarded to a newly-created test class instance.
(-[WebProcessPlugIn respondsToSelector:]): Returned YES if the test class instance response.
(-[WebProcessPlugIn forwardingTargetForSelector:]): Forwarded unimplemented methods to the test class instance.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@188844 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Tools/ChangeLog
Tools/TestWebKitAPI/Configurations/WebProcessPlugIn.xcconfig [new file with mode: 0644]
Tools/TestWebKitAPI/PlatformUtilities.h
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleParameters.mm [new file with mode: 0644]
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/BundleParametersPlugIn.mm [new file with mode: 0644]
Tools/TestWebKitAPI/WKWebViewConfigurationExtras.h [new file with mode: 0644]
Tools/TestWebKitAPI/WKWebViewConfigurationExtras.mm [new file with mode: 0644]
Tools/TestWebKitAPI/cocoa/PlatformUtilitiesCocoa.mm
Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/Info.plist [new file with mode: 0644]
Tools/TestWebKitAPI/cocoa/WebProcessPlugIn/WebProcessPlugIn.mm [new file with mode: 0644]