Provide a TestWebKitAPI-wide WKNavigationDelegate to simplify tests
authortimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2016 01:16:56 +0000 (01:16 +0000)
committertimothy_horton@apple.com <timothy_horton@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 2 Sep 2016 01:16:56 +0000 (01:16 +0000)
commit9a6f95ed9aafc16a1dd6ed1a72d9c0816641574a
treed322c13100532f236ac767c9f9c9bc2de2a871a2
parent49bcbc2128f49f43ecce5f0f6c2069bae95ed18f
Provide a TestWebKitAPI-wide WKNavigationDelegate to simplify tests
https://bugs.webkit.org/show_bug.cgi?id=161413

Reviewed by Simon Fraser.

Add TestNavigationDelegate, which provides block properties to make
writing tests feel a little more natural (the callbacks can be inline),
and also add WKWebView _test_waitForDidFinishNavigation, so that many
tests don't even need to manually allocate a navigation delegate at all.

Adopt in some of the simpler tests; there are a few navigation delegates
left behind, which we can move to the new model in the future.

* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKit2/WKBackForwardList.mm:
(TEST):
(-[WKBackForwardListTestNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/AlwaysRevalidatedURLSchemes.mm:
(TEST):
(-[AlwaysRevalidatedURLSchemesDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm:
(animatedResizeWebView):
(-[AnimatedResizeNavigationDelegate _webView:renderingProgressDidChange:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/AutoLayoutIntegration.mm:
(-[AutoLayoutWKWebView initWithFrame:configuration:]):
(-[AutoLayoutWKWebView load:withWidth:expectingContentSize:resettingWidth:]):
(TEST):
(-[AutoLayoutNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/CancelFontSubresource.mm:
(TEST):
(-[CancelFontSubresourceNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/CommandBackForward.mm:
(WebKit2_CommandBackForwardTestWKWebView::SetUp):
(WebKit2_CommandBackForwardTestWKWebView::loadFiles):
(TEST_F):
(-[CommandBackForwardNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm:
(expectLinkCount):
(TEST):
(-[DataDetectionNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/FindInPage.mm:
(TEST):
(-[FindInPageNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/FixedLayoutSize.mm:
(TEST):
(-[FixedLayoutSizeNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBDatabaseProcessKill.mm:
(TEST):
(-[DatabaseProcessKillNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence.mm:
(-[IndexedDBNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLNotChange.mm:
(TEST):
(-[ProvisionalURLNotChangeController webView:didFinishNavigation:]): Deleted.
(-[ProvisionalURLNotChangeController webView:didFailProvisionalNavigation:withError:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm:
(RequiresUserActionForPlaybackTest::createWebView):
(RequiresUserActionForPlaybackTest::testVideoWithAudio):
(RequiresUserActionForPlaybackTest::testVideoWithoutAudio):
(RequiresUserActionForPlaybackTest::testAudioOnly):
(-[RequiresUserActionForPlaybackNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/ShrinkToFit.mm:
(TEST):
(-[ShrinkToFitNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm:
(TEST):
(webViewForScriptMessageHandlerMultipleHandlerRemovalTest):
* TestWebKitAPI/Tests/WebKit2Cocoa/UserContentWorld.mm:
(TEST):
(-[SimpleDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm:
(TEST):
(-[WKPDFViewResizeNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm:
(TEST):
(-[EvaluateJavaScriptNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewTextInput.mm:
(TEST):
(-[DummyNavigationDelegate webView:didFinishNavigation:]): Deleted.
* TestWebKitAPI/cocoa/TestNavigationDelegate.h: Added.
* TestWebKitAPI/cocoa/TestNavigationDelegate.mm: Added.
(-[TestNavigationDelegate webView:didFailProvisionalNavigation:withError:]):
(-[TestNavigationDelegate webView:didFinishNavigation:]):
(-[TestNavigationDelegate _webView:renderingProgressDidChange:]):
(-[TestNavigationDelegate waitForDidFinishNavigation]):
(-[WKWebView _test_waitForDidFinishNavigation]):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205329 268f45cc-cd09-0410-ab3c-d52691b4dbfc
23 files changed:
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
Tools/TestWebKitAPI/Tests/WebKit2/WKBackForwardList.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AlwaysRevalidatedURLSchemes.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AnimatedResize.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/AutoLayoutIntegration.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/CancelFontSubresource.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/CommandBackForward.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/DataDetection.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FindInPage.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/FixedLayoutSize.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBDatabaseProcessKill.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/IndexedDBPersistence.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ProvisionalURLNotChange.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/RequiresUserActionForPlayback.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/ShrinkToFit.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentController.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/UserContentWorld.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKPDFViewResizeCrash.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewEvaluateJavaScript.mm
Tools/TestWebKitAPI/Tests/WebKit2Cocoa/WKWebViewTextInput.mm
Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.h [new file with mode: 0644]
Tools/TestWebKitAPI/cocoa/TestNavigationDelegate.mm [new file with mode: 0644]