Diff
Modified: trunk/Tools/ChangeLog (235366 => 235367)
--- trunk/Tools/ChangeLog 2018-08-27 15:57:40 UTC (rev 235366)
+++ trunk/Tools/ChangeLog 2018-08-27 16:08:17 UTC (rev 235367)
@@ -1,3 +1,54 @@
+2018-08-27 Alex Christensen <[email protected]>
+
+ Translate 4 tests using WKPageLoaderClient to ObjC
+ https://bugs.webkit.org/show_bug.cgi?id=188827
+
+ Reviewed by Tim Horton.
+
+ They use processDidBecomeUnresponsive, didChangeBackForwardList, or willGoToBackForwardListItem.
+ Rather than introduce these to WKPageNavigationClient, I just translated the tests to use WKNavigationDelegate, which already have equivalent callbacks.
+ willGoToBackForwardListItem had userData from the InjectedBundle, but nobody was using it so I did not add that to the ObjC SPI, so I don't test that unused
+ bundle functionality any more.
+
+ * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
+ * TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem_Bundle.cpp: Removed.
+ * TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp.
+ (-[ResponsivenessTimerDelegate webView:didFinishNavigation:]):
+ (-[ResponsivenessTimerDelegate _webViewWebProcessDidBecomeUnresponsive:]):
+ (TestWebKitAPI::TEST):
+ (): Deleted.
+ (TestWebKitAPI::didFinishLoadForFrame): Deleted.
+ (TestWebKitAPI::processDidBecomeUnresponsive): Deleted.
+ (TestWebKitAPI::setPageLoaderClient): Deleted.
+ * TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp.
+ (-[ResponsivenessDelegate webView:didFinishNavigation:]):
+ (-[ResponsivenessDelegate _webViewWebProcessDidBecomeUnresponsive:]):
+ (TestWebKitAPI::TEST):
+ (TestWebKitAPI::didReceiveMessageFromInjectedBundle): Deleted.
+ (TestWebKitAPI::didFinishLoadForFrame): Deleted.
+ (TestWebKitAPI::processDidBecomeUnresponsive): Deleted.
+ (TestWebKitAPI::setInjectedBundleClient): Deleted.
+ (TestWebKitAPI::setPageLoaderClient): Deleted.
+ * TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp.
+ (-[SessionStateDelegate webView:didFinishNavigation:]):
+ (-[SessionStateDelegate _webView:backForwardListItemAdded:removed:]):
+ (TestWebKitAPI::createSessionStateData):
+ (TestWebKitAPI::TEST):
+ (TestWebKitAPI::didFinishLoadForFrame): Deleted.
+ (TestWebKitAPI::didChangeBackForwardListForPage): Deleted.
+ (TestWebKitAPI::setPageLoaderClient): Deleted.
+ * TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm: Copied from Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp.
+ (-[BackForwardClient webView:didFinishNavigation:]):
+ (-[BackForwardClient _webView:willGoToBackForwardListItem:inPageCache:]):
+ (TestWebKitAPI::TEST):
+ (TestWebKitAPI::didFinishLoadForFrame): Deleted.
+ (TestWebKitAPI::willGoToBackForwardListItem): Deleted.
+ (TestWebKitAPI::setPageLoaderClient): Deleted.
+
2018-08-27 Keith Miller <[email protected]>
test262-runner -s --test-only should replace test results
Modified: trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (235366 => 235367)
--- trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-08-27 15:57:40 UTC (rev 235366)
+++ trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj 2018-08-27 16:08:17 UTC (rev 235367)
@@ -223,7 +223,6 @@
51E6A8941D2F1C0A00C004B6 /* LocalStorageClear.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51E6A8921D2F1BEC00C004B6 /* LocalStorageClear.mm */; };
51E6A8961D2F1CA700C004B6 /* LocalStorageClear.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 51E6A8951D2F1C7700C004B6 /* LocalStorageClear.html */; };
51EB12941FDF052500A5A1BD /* ServiceWorkerBasic.mm in Sources */ = {isa = PBXBuildFile; fileRef = 51EB12931FDF050500A5A1BD /* ServiceWorkerBasic.mm */; };
- 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */; };
520BCF4C141EB09E00937EA8 /* WebArchive_Bundle.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */; };
524BBC9E19DF72C0002F1AF1 /* file-with-video.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 524BBC9B19DF3714002F1AF1 /* file-with-video.html */; };
524BBCA119E30C77002F1AF1 /* test.mp4 in Copy Resources */ = {isa = PBXBuildFile; fileRef = 524BBCA019E30C63002F1AF1 /* test.mp4 */; };
@@ -290,6 +289,10 @@
5CB3CE391FA1697F00C3A2D6 /* WKWebViewConfiguration.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB3CE381FA1691700C3A2D6 /* WKWebViewConfiguration.mm */; };
5CB40B4E1F4B98D3007DC7B9 /* UIDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB40B4D1F4B98BE007DC7B9 /* UIDelegate.mm */; };
5CB5B3C21FFC55CF00C27BB0 /* FrameHandleSerialization.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB5B3BD1FFC517E00C27BB0 /* FrameHandleSerialization.mm */; };
+ 5CCB10E1213457D300AC5AF0 /* ResponsivenessTimer.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CCB10E02134579D00AC5AF0 /* ResponsivenessTimer.mm */; };
+ 5CCB10E2213457D500AC5AF0 /* ResponsivenessTimerDoesntFireEarly.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CCB10DD2134579C00AC5AF0 /* ResponsivenessTimerDoesntFireEarly.mm */; };
+ 5CCB10E3213457D800AC5AF0 /* RestoreSessionStateWithoutNavigation.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CCB10DE2134579D00AC5AF0 /* RestoreSessionStateWithoutNavigation.mm */; };
+ 5CCB10E4213457E000AC5AF0 /* ShouldGoToBackForwardListItem.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CCB10DF2134579D00AC5AF0 /* ShouldGoToBackForwardListItem.mm */; };
5CE354D91E70DA5C00BEFE3B /* WKContentExtensionStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */; };
5CEAB5E11FA939F400A77FAA /* _WKInputDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CEAB5DF1FA937CB00A77FAA /* _WKInputDelegate.mm */; };
5E4B1D2E1D404C6100053621 /* WKScrollViewDelegate.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5E4B1D2C1D404C6100053621 /* WKScrollViewDelegate.mm */; };
@@ -529,10 +532,8 @@
7CCE7F0D1A411AE600447C4C /* ReloadPageAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A3AF93A16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp */; };
7CCE7F0E1A411AE600447C4C /* ResizeReversePaginatedWebView.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DD7D3A9178205D00026E1E3 /* ResizeReversePaginatedWebView.cpp */; };
7CCE7F0F1A411AE600447C4C /* ResizeWindowAfterCrash.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */; };
- 7CCE7F101A411AE600447C4C /* ResponsivenessTimerDoesntFireEarly.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */; };
7CCE7F111A411AE600447C4C /* RestoreSessionStateContainingFormData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C0ADBE8212FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp */; };
7CCE7F121A411AE600447C4C /* ScrollPinningBehaviors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */; };
- 7CCE7F131A411AE600447C4C /* ShouldGoToBackForwardListItem.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */; };
7CCE7F141A411AE600447C4C /* ShouldKeepCurrentBackForwardListItemInList.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */; };
7CCE7F151A411AE600447C4C /* SpacebarScrolling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */; };
7CCE7F161A411AE600447C4C /* TerminateTwice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 1AE72F47173EB214006362F0 /* TerminateTwice.cpp */; };
@@ -570,7 +571,6 @@
834138C7203261CA00F26960 /* AsyncPolicyForNavigationResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 834138C6203261B900F26960 /* AsyncPolicyForNavigationResponse.mm */; };
8349D3C21DB96DDE004A9F65 /* ContextMenuDownload.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8349D3C11DB96DDA004A9F65 /* ContextMenuDownload.mm */; };
8349D3C41DB9728E004A9F65 /* link-with-download-attribute.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */; };
- 835CF9671D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */; };
8361F1781E610B4E00759B25 /* link-with-download-attribute-with-slashes.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 8361F1771E610B2100759B25 /* link-with-download-attribute-with-slashes.html */; };
83779C381F82FECE007CDA8A /* VisitedLinkStore.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83779C371F82FEB0007CDA8A /* VisitedLinkStore.mm */; };
837A35F11D9A1E7D00663C57 /* DownloadRequestBlobURL.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */; };
@@ -578,7 +578,6 @@
83BAEE8D1EF4625500DDE894 /* PluginLoadClientPolicies.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83BAEE8C1EF4625500DDE894 /* PluginLoadClientPolicies.mm */; };
83BC5AC020E6C0DF00F5879F /* StartLoadInDidFailProvisionalLoad.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83BC5ABF20E6C0D300F5879F /* StartLoadInDidFailProvisionalLoad.mm */; };
83DB79691EF63B3C00BFA5E5 /* Function.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83DB79671EF63B3C00BFA5E5 /* Function.cpp */; };
- 83DE134D1EF1C50800C1B355 /* ResponsivenessTimer.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 83DE134C1EF1C4FE00C1B355 /* ResponsivenessTimer.cpp */; };
83F22C6420B355F80034277E /* NoPolicyDelegateResponse.mm in Sources */ = {isa = PBXBuildFile; fileRef = 83F22C6320B355EB0034277E /* NoPolicyDelegateResponse.mm */; };
8C10AF98206467920018FD90 /* localstorage-empty-string-value.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = 8C10AF97206467830018FD90 /* localstorage-empty-string-value.html */; };
8C10AF99206467A90018FD90 /* LocalStoragePersistence.mm in Sources */ = {isa = PBXBuildFile; fileRef = 8C10AF96206467770018FD90 /* LocalStoragePersistence.mm */; };
@@ -1506,8 +1505,6 @@
51E93016156B13E1004C99DF /* WKPageGetScaleFactorNotZero.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WKPageGetScaleFactorNotZero.cpp; sourceTree = "<group>"; };
51EB12931FDF050500A5A1BD /* ServiceWorkerBasic.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ServiceWorkerBasic.mm; sourceTree = "<group>"; };
51FBBB4C1513D4E900822738 /* WebViewCanPasteURL.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebViewCanPasteURL.mm; sourceTree = "<group>"; };
- 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldGoToBackForwardListItem_Bundle.cpp; sourceTree = "<group>"; };
- 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ShouldGoToBackForwardListItem.cpp; sourceTree = "<group>"; };
520BCF4A141EB09E00937EA8 /* WebArchive_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive_Bundle.cpp; sourceTree = "<group>"; };
520BCF4B141EB09E00937EA8 /* WebArchive.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WebArchive.cpp; sourceTree = "<group>"; };
524BBC9B19DF3714002F1AF1 /* file-with-video.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "file-with-video.html"; sourceTree = "<group>"; };
@@ -1580,6 +1577,10 @@
5CB3CE381FA1691700C3A2D6 /* WKWebViewConfiguration.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKWebViewConfiguration.mm; sourceTree = "<group>"; };
5CB40B4D1F4B98BE007DC7B9 /* UIDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = UIDelegate.mm; sourceTree = "<group>"; };
5CB5B3BD1FFC517E00C27BB0 /* FrameHandleSerialization.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = FrameHandleSerialization.mm; sourceTree = "<group>"; };
+ 5CCB10DD2134579C00AC5AF0 /* ResponsivenessTimerDoesntFireEarly.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResponsivenessTimerDoesntFireEarly.mm; sourceTree = "<group>"; };
+ 5CCB10DE2134579D00AC5AF0 /* RestoreSessionStateWithoutNavigation.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RestoreSessionStateWithoutNavigation.mm; sourceTree = "<group>"; };
+ 5CCB10DF2134579D00AC5AF0 /* ShouldGoToBackForwardListItem.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ShouldGoToBackForwardListItem.mm; sourceTree = "<group>"; };
+ 5CCB10E02134579D00AC5AF0 /* ResponsivenessTimer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ResponsivenessTimer.mm; sourceTree = "<group>"; };
5CE354D81E70D9C300BEFE3B /* WKContentExtensionStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WKContentExtensionStore.mm; sourceTree = "<group>"; };
5CEAB5DF1FA937CB00A77FAA /* _WKInputDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKInputDelegate.mm; sourceTree = "<group>"; };
5E4B1D2C1D404C6100053621 /* WKScrollViewDelegate.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKScrollViewDelegate.mm; path = ../ios/WKScrollViewDelegate.mm; sourceTree = "<group>"; };
@@ -1677,7 +1678,6 @@
834138C6203261B900F26960 /* AsyncPolicyForNavigationResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = AsyncPolicyForNavigationResponse.mm; sourceTree = "<group>"; };
8349D3C11DB96DDA004A9F65 /* ContextMenuDownload.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = ContextMenuDownload.mm; sourceTree = "<group>"; };
8349D3C31DB9724F004A9F65 /* link-with-download-attribute.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "link-with-download-attribute.html"; sourceTree = "<group>"; };
- 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestoreSessionStateWithoutNavigation.cpp; sourceTree = "<group>"; };
8361F1771E610B2100759B25 /* link-with-download-attribute-with-slashes.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "link-with-download-attribute-with-slashes.html"; sourceTree = "<group>"; };
83779C371F82FEB0007CDA8A /* VisitedLinkStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = VisitedLinkStore.mm; sourceTree = "<group>"; };
837A35F01D9A1E6400663C57 /* DownloadRequestBlobURL.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = DownloadRequestBlobURL.html; sourceTree = "<group>"; };
@@ -1686,7 +1686,6 @@
83BAEE8C1EF4625500DDE894 /* PluginLoadClientPolicies.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = PluginLoadClientPolicies.mm; sourceTree = "<group>"; };
83BC5ABF20E6C0D300F5879F /* StartLoadInDidFailProvisionalLoad.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = StartLoadInDidFailProvisionalLoad.mm; sourceTree = "<group>"; };
83DB79671EF63B3C00BFA5E5 /* Function.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = Function.cpp; sourceTree = "<group>"; };
- 83DE134C1EF1C4FE00C1B355 /* ResponsivenessTimer.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimer.cpp; sourceTree = "<group>"; };
83F22C6320B355EB0034277E /* NoPolicyDelegateResponse.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = NoPolicyDelegateResponse.mm; sourceTree = "<group>"; };
86BD19971A2DB05B006DCF0A /* RefCounter.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RefCounter.cpp; sourceTree = "<group>"; };
8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResizeWindowAfterCrash.cpp; sourceTree = "<group>"; };
@@ -1895,7 +1894,6 @@
C0ADBE7B12FCA4D000D2C129 /* _javascript_Test.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = _javascript_Test.h; sourceTree = "<group>"; };
C0ADBE8212FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RestoreSessionStateContainingFormData.cpp; sourceTree = "<group>"; };
C0ADBE8412FCA6B600D2C129 /* simple-form.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "simple-form.html"; sourceTree = "<group>"; };
- C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimerDoesntFireEarly.cpp; sourceTree = "<group>"; };
C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ResponsivenessTimerDoesntFireEarly_Bundle.cpp; sourceTree = "<group>"; };
C0C5D3BC14598B6F00A802A6 /* GetBackingScaleFactor.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor.mm; sourceTree = "<group>"; };
C0C5D3BD14598B6F00A802A6 /* GetBackingScaleFactor_Bundle.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = GetBackingScaleFactor_Bundle.mm; sourceTree = "<group>"; };
@@ -2382,6 +2380,9 @@
A12DDC011E8374F500CF6CAE /* RenderedImageWithOptionsProtocol.h */,
CD9E292B1C90A71F000BB800 /* RequiresUserActionForPlayback.mm */,
51C8E1A41F26AC5400BF731B /* ResourceLoadStatistics.mm */,
+ 5CCB10E02134579D00AC5AF0 /* ResponsivenessTimer.mm */,
+ 5CCB10DD2134579C00AC5AF0 /* ResponsivenessTimerDoesntFireEarly.mm */,
+ 5CCB10DE2134579D00AC5AF0 /* RestoreSessionStateWithoutNavigation.mm */,
A180C0F91EE67DF000468F47 /* RunOpenPanel.mm */,
F4D2986D20FEE7370092D636 /* RunScriptAfterDocumentLoad.mm */,
5CA985512113CB8C0057EB6B /* SafeBrowsing.mm */,
@@ -2388,6 +2389,7 @@
CE0947362063223B003C9BA0 /* SchemeRegistry.mm */,
51EB12931FDF050500A5A1BD /* ServiceWorkerBasic.mm */,
41882F0221010A70002FF288 /* SetMaximumPrewarmedProcessCount.mm */,
+ 5CCB10DF2134579D00AC5AF0 /* ShouldGoToBackForwardListItem.mm */,
37BCA61B1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm */,
2D9A53AE1B31FA8D0074D5AA /* ShrinkToFit.mm */,
2DFF7B6C1DA487AF00814614 /* SnapshotStore.mm */,
@@ -2925,16 +2927,11 @@
8A3AF93A16C9ED2700D248C1 /* ReloadPageAfterCrash.cpp */,
2DD7D3A9178205D00026E1E3 /* ResizeReversePaginatedWebView.cpp */,
8A2C750D16CED9550024F352 /* ResizeWindowAfterCrash.cpp */,
- 83DE134C1EF1C4FE00C1B355 /* ResponsivenessTimer.cpp */,
512C4C9D20EAA405004945EA /* ResponsivenessTimerCrash.mm */,
- C0BD669C131D3CF700E18F2A /* ResponsivenessTimerDoesntFireEarly.cpp */,
C0BD669E131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp */,
83B6DE6E1EE7520F001E792F /* RestoreSessionState.cpp */,
C0ADBE8212FCA6AA00D2C129 /* RestoreSessionStateContainingFormData.cpp */,
- 835CF9661D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp */,
2D640B5417875DFF00BFAF99 /* ScrollPinningBehaviors.cpp */,
- 51FCF7981534AC6D00104491 /* ShouldGoToBackForwardListItem.cpp */,
- 51FCF7971534AC6D00104491 /* ShouldGoToBackForwardListItem_Bundle.cpp */,
51E5C7041919EA5F00D8B3E1 /* ShouldKeepCurrentBackForwardListItemInList.cpp */,
C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */,
76734997193016DC00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad.cpp */,
@@ -3917,12 +3914,12 @@
7CCE7F0E1A411AE600447C4C /* ResizeReversePaginatedWebView.cpp in Sources */,
7CCE7F0F1A411AE600447C4C /* ResizeWindowAfterCrash.cpp in Sources */,
51C8E1A51F26AF4C00BF731B /* ResourceLoadStatistics.mm in Sources */,
- 83DE134D1EF1C50800C1B355 /* ResponsivenessTimer.cpp in Sources */,
+ 5CCB10E1213457D300AC5AF0 /* ResponsivenessTimer.mm in Sources */,
512C4C9E20EAA40D004945EA /* ResponsivenessTimerCrash.mm in Sources */,
- 7CCE7F101A411AE600447C4C /* ResponsivenessTimerDoesntFireEarly.cpp in Sources */,
+ 5CCB10E2213457D500AC5AF0 /* ResponsivenessTimerDoesntFireEarly.mm in Sources */,
83B6DE6F1EE75221001E792F /* RestoreSessionState.cpp in Sources */,
7CCE7F111A411AE600447C4C /* RestoreSessionStateContainingFormData.cpp in Sources */,
- 835CF9671D25FCD6001A65D4 /* RestoreSessionStateWithoutNavigation.cpp in Sources */,
+ 5CCB10E3213457D800AC5AF0 /* RestoreSessionStateWithoutNavigation.mm in Sources */,
46E816F81E79E29C00375ADC /* RestoreStateAfterTermination.mm in Sources */,
F418BE151F71B7DC001970E6 /* RoundedRectTests.cpp in Sources */,
A180C0FA1EE67DF000468F47 /* RunOpenPanel.mm in Sources */,
@@ -3942,7 +3939,7 @@
7C83E0521D0A641800FEBCF3 /* SharedBuffer.cpp in Sources */,
A17991881E1C994E00A505ED /* SharedBuffer.mm in Sources */,
A179918B1E1CA24100A505ED /* SharedBufferTest.cpp in Sources */,
- 7CCE7F131A411AE600447C4C /* ShouldGoToBackForwardListItem.cpp in Sources */,
+ 5CCB10E4213457E000AC5AF0 /* ShouldGoToBackForwardListItem.mm in Sources */,
7CCE7F141A411AE600447C4C /* ShouldKeepCurrentBackForwardListItemInList.cpp in Sources */,
37BCA61C1B596BA9002012CA /* ShouldOpenExternalURLsInNewWindowActions.mm in Sources */,
7C83E0C51D0A654600FEBCF3 /* ShrinkToFit.mm in Sources */,
@@ -4146,7 +4143,6 @@
BC575BE0126F590D006F0F12 /* PlatformUtilitiesMac.mm in Sources */,
B55AD1D5179F3B3000AC1494 /* PreventImageLoadWithAutoResizing_Bundle.cpp in Sources */,
C0BD669F131D3CFF00E18F2A /* ResponsivenessTimerDoesntFireEarly_Bundle.cpp in Sources */,
- 51FCF7A11534B2A000104491 /* ShouldGoToBackForwardListItem_Bundle.cpp in Sources */,
7673499D1930C5BB00E44DF9 /* StopLoadingDuringDidFailProvisionalLoad_bundle.cpp in Sources */,
CE3524F81B1431F60028A7C5 /* TextFieldDidBeginAndEndEditing_Bundle.cpp in Sources */,
BC22D31914DC68B900FFB1DD /* UserMessage_Bundle.cpp in Sources */,
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp (235366 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp 2018-08-27 15:57:40 UTC (rev 235366)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp 2018-08-27 16:08:17 UTC (rev 235367)
@@ -1,96 +0,0 @@
-/*
- * Copyright (C) 2017 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if WK_HAVE_C_SPI
-
-#include "PlatformUtilities.h"
-#include "PlatformWebView.h"
-
-namespace TestWebKitAPI {
-
-static bool didFinishLoad { false };
-static bool didBecomeUnresponsive { false };
-
-static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
-{
- didFinishLoad = true;
-}
-
-static void processDidBecomeUnresponsive(WKPageRef page, const void*)
-{
- didBecomeUnresponsive = true;
-}
-
-static void setPageLoaderClient(WKPageRef page)
-{
- WKPageLoaderClientV0 loaderClient;
- memset(&loaderClient, 0, sizeof(loaderClient));
-
- loaderClient.base.version = 0;
- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
- loaderClient.processDidBecomeUnresponsive = processDidBecomeUnresponsive;
-
- WKPageSetPageLoaderClient(page, &loaderClient.base);
-}
-
-TEST(WebKit, ResponsivenessTimerShouldNotFireAfterTearDown)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
- // The two views need to share the same WebContent process.
- WKContextSetMaximumNumberOfProcesses(context.get(), 1);
-
- PlatformWebView webView1(context.get());
- setPageLoaderClient(webView1.page());
-
- WKPageLoadURL(webView1.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
- Util::run(&didFinishLoad);
-
- EXPECT_FALSE(didBecomeUnresponsive);
-
- PlatformWebView webView2(context.get());
- setPageLoaderClient(webView2.page());
-
- didFinishLoad = false;
- WKPageLoadURL(webView2.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
- Util::run(&didFinishLoad);
-
- EXPECT_FALSE(didBecomeUnresponsive);
-
- // Call stopLoading() and close() on the first page in quick succession.
- WKPageStopLoading(webView1.page());
- WKPageClose(webView1.page());
-
- // We need to wait here because it takes 3 seconds for a process to be recognized as unresponsive.
- Util::sleep(4);
-
- // We should not report the second page sharing the same process as unresponsive.
- EXPECT_FALSE(didBecomeUnresponsive);
-}
-
-} // namespace TestWebKitAPI
-
-#endif
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp (235366 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp 2018-08-27 15:57:40 UTC (rev 235366)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp 2018-08-27 16:08:17 UTC (rev 235367)
@@ -1,103 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if WK_HAVE_C_SPI
-
-#include "PlatformUtilities.h"
-#include "PlatformWebView.h"
-
-namespace TestWebKitAPI {
-
-static bool didFinishLoad;
-static bool didBecomeUnresponsive;
-static bool didBrieflyPause;
-
-static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef, const void*)
-{
- didBrieflyPause = true;
- EXPECT_WK_STREQ("DidBrieflyPause", messageName);
-}
-
-static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
-{
- didFinishLoad = true;
-}
-
-static void processDidBecomeUnresponsive(WKPageRef, const void*)
-{
- didBecomeUnresponsive = true;
-}
-
-static void setInjectedBundleClient(WKContextRef context)
-{
- WKContextInjectedBundleClientV0 injectedBundleClient;
- memset(&injectedBundleClient, 0, sizeof(injectedBundleClient));
-
- injectedBundleClient.base.version = 0;
- injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
-
- WKContextSetInjectedBundleClient(context, &injectedBundleClient.base);
-}
-
-static void setPageLoaderClient(WKPageRef page)
-{
- WKPageLoaderClientV0 loaderClient;
- memset(&loaderClient, 0, sizeof(loaderClient));
-
- loaderClient.base.version = 0;
- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
- loaderClient.processDidBecomeUnresponsive = processDidBecomeUnresponsive;
-
- WKPageSetPageLoaderClient(page, &loaderClient.base);
-}
-
-TEST(WebKit, ResponsivenessTimerDoesntFireEarly)
-{
- WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("ResponsivenessTimerDoesntFireEarlyTest"));
- setInjectedBundleClient(context.get());
-
- PlatformWebView webView(context.get());
- setPageLoaderClient(webView.page());
-
- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
- Util::run(&didFinishLoad);
-
- WKContextPostMessageToInjectedBundle(context.get(), Util::toWK("BrieflyPause").get(), 0);
-
- // Pressing a key on the keyboard should start the responsiveness timer. Since the web process
- // is going to pause before it receives this keypress, it should take a little while to respond
- // (but not so long that the responsiveness timer fires).
- webView.simulateSpacebarKeyPress();
-
- Util::run(&didBrieflyPause);
-
- EXPECT_FALSE(didBecomeUnresponsive);
-}
-
-} // namespace TestWebKitAPI
-
-#endif
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp (235366 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp 2018-08-27 15:57:40 UTC (rev 235366)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp 2018-08-27 16:08:17 UTC (rev 235367)
@@ -1,105 +0,0 @@
-/*
- * Copyright (C) 2016 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if WK_HAVE_C_SPI
-
-#include "_javascript_Test.h"
-#include "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include "Test.h"
-#include <WebKit/WKPagePrivate.h>
-#include <WebKit/WKSessionStateRef.h>
-
-namespace TestWebKitAPI {
-
-static bool didFinishLoad;
-static bool didChangeBackForwardList;
-
-static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*)
-{
- didFinishLoad = true;
-}
-
-static void didChangeBackForwardListForPage(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef, const void*)
-{
- didChangeBackForwardList = true;
-}
-
-static void setPageLoaderClient(WKPageRef page)
-{
- WKPageLoaderClientV0 loaderClient;
- memset(&loaderClient, 0, sizeof(loaderClient));
-
- loaderClient.base.version = 0;
- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
- loaderClient.didChangeBackForwardList = didChangeBackForwardListForPage;
-
- WKPageSetPageLoaderClient(page, &loaderClient.base);
-}
-
-static WKRetainPtr<WKDataRef> createSessionStateData(WKContextRef context)
-{
- PlatformWebView webView(context);
- setPageLoaderClient(webView.page());
-
- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
- Util::run(&didFinishLoad);
- didFinishLoad = false;
-
- auto sessionState = adoptWK(static_cast<WKSessionStateRef>(WKPageCopySessionState(webView.page(), reinterpret_cast<void*>(1), nullptr)));
- return adoptWK(WKSessionStateCopyData(sessionState.get()));
-}
-
-TEST(WebKit, RestoreSessionStateWithoutNavigation)
-{
- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate());
-
- PlatformWebView webView(context.get());
- setPageLoaderClient(webView.page());
-
- WKRetainPtr<WKDataRef> data = ""
- EXPECT_NOT_NULL(data);
-
- auto sessionState = adoptWK(WKSessionStateCreateFromData(data.get()));
- WKPageRestoreFromSessionStateWithoutNavigation(webView.page(), sessionState.get());
-
- Util::run(&didChangeBackForwardList);
-
- WKRetainPtr<WKURLRef> committedURL = adoptWK(WKPageCopyCommittedURL(webView.page()));
- EXPECT_NULL(committedURL.get());
-
- auto backForwardList = WKPageGetBackForwardList(webView.page());
- auto currentItem = WKBackForwardListGetCurrentItem(backForwardList);
- auto currentItemURL = adoptWK(WKBackForwardListItemCopyURL(currentItem));
- auto expectedURL = adoptWK(Util::createURLForResource("simple", "html"));
- EXPECT_NOT_NULL(expectedURL);
- EXPECT_TRUE(WKURLIsEqual(currentItemURL.get(), expectedURL.get()));
-}
-
-} // namespace TestWebKitAPI
-
-#endif
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp (235366 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp 2018-08-27 15:57:40 UTC (rev 235366)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp 2018-08-27 16:08:17 UTC (rev 235367)
@@ -1,97 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if WK_HAVE_C_SPI
-
-#include "PlatformUtilities.h"
-#include "PlatformWebView.h"
-#include "Test.h"
-
-#include <WebKit/WKString.h>
-
-namespace TestWebKitAPI {
-
-static bool finished = false;
-static bool receivedProperBackForwardCallbacks = false;
-
-static void didFinishLoadForFrame(WKPageRef, WKFrameRef frame, WKTypeRef, const void*)
-{
- // Only mark finished when the main frame loads
- if (!WKFrameIsMainFrame(frame))
- return;
-
- finished = true;
-}
-
-static void willGoToBackForwardListItem(WKPageRef, WKBackForwardListItemRef, WKTypeRef userData, const void*)
-{
- if (WKGetTypeID(userData) == WKStringGetTypeID()) {
- if (WKStringIsEqualToUTF8CString((WKStringRef)userData, "shouldGoToBackForwardListItemCallback called as expected"))
- receivedProperBackForwardCallbacks = true;
- }
-
- finished = true;
-}
-
-static void setPageLoaderClient(WKPageRef page)
-{
- WKPageLoaderClientV1 loaderClient;
- memset(&loaderClient, 0, sizeof(loaderClient));
-
- loaderClient.base.version = 1;
- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame;
- loaderClient.willGoToBackForwardListItem = willGoToBackForwardListItem;
-
- WKPageSetPageLoaderClient(page, &loaderClient.base);
-}
-
-TEST(WebKit, ShouldGoToBackForwardListItem)
-{
- WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("ShouldGoToBackForwardListItemTest"));
- // Enable the page cache so we can test the WKBundleBackForwardListItemIsInPageCache API
- WKContextSetCacheModel(context.get(), kWKCacheModelDocumentBrowser);
-
- PlatformWebView webView(context.get());
- setPageLoaderClient(webView.page());
-
- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get());
- Util::run(&finished);
-
- finished = false;
- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple-iframe", "html")).get());
- Util::run(&finished);
-
- finished = false;
- WKPageGoBack(webView.page());
- Util::run(&finished);
-
- EXPECT_EQ(receivedProperBackForwardCallbacks, true);
-}
-
-} // namespace TestWebKitAPI
-
-#endif
Deleted: trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem_Bundle.cpp (235366 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem_Bundle.cpp 2018-08-27 15:57:40 UTC (rev 235366)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem_Bundle.cpp 2018-08-27 16:08:17 UTC (rev 235367)
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-
-#if WK_HAVE_C_SPI
-
-#include "InjectedBundleTest.h"
-
-#include "PlatformUtilities.h"
-#include <WebKit/WKBundlePage.h>
-#include <WebKit/WKBundleBackForwardListItem.h>
-
-namespace TestWebKitAPI {
-
-class ShouldGoToBackForwardListItemTest : public InjectedBundleTest {
-public:
- ShouldGoToBackForwardListItemTest(const std::string& identifier);
-
- virtual void didCreatePage(WKBundleRef bundle, WKBundlePageRef page);
-};
-
-static InjectedBundleTest::Register<ShouldGoToBackForwardListItemTest> registrar("ShouldGoToBackForwardListItemTest");
-
-static bool shouldGoToBackForwardListItemCallback(WKBundlePageRef, WKBundleBackForwardListItemRef item, WKTypeRef* userData, const void*)
-{
- // The item should be in the page cache
- if (WKBundleBackForwardListItemIsInPageCache(item))
- *userData = WKStringCreateWithUTF8CString("shouldGoToBackForwardListItemCallback called as expected");
-
- return true;
-}
-
-ShouldGoToBackForwardListItemTest::ShouldGoToBackForwardListItemTest(const std::string& identifier)
- : InjectedBundleTest(identifier)
-{
-}
-
-void ShouldGoToBackForwardListItemTest::didCreatePage(WKBundleRef bundle, WKBundlePageRef page)
-{
- WKBundlePageLoaderClientV1 pageLoaderClient;
- memset(&pageLoaderClient, 0, sizeof(pageLoaderClient));
-
- pageLoaderClient.base.version = 1;
- pageLoaderClient.base.clientInfo = this;
- pageLoaderClient.shouldGoToBackForwardListItem = shouldGoToBackForwardListItemCallback;
-
- WKBundlePageSetPageLoaderClient(page, &pageLoaderClient.base);
-}
-
-} // namespace TestWebKitAPI
-
-#endif
Copied: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm (from rev 235364, trunk/Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp) (0 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm 2018-08-27 16:08:17 UTC (rev 235367)
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2017 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_API_ENABLED
+
+#import "PlatformUtilities.h"
+#import "PlatformWebView.h"
+#import <WebKit/WKProcessPoolPrivate.h>
+#import <WebKit/WKWebViewPrivate.h>
+#import <WebKit/_WKProcessPoolConfiguration.h>
+#import <wtf/RetainPtr.h>
+
+static bool didFinishLoad { false };
+static bool didBecomeUnresponsive { false };
+
+@interface ResponsivenessTimerDelegate : NSObject <WKNavigationDelegate>
+@end
+
+@implementation ResponsivenessTimerDelegate
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ didFinishLoad = true;
+}
+
+- (void)_webViewWebProcessDidBecomeUnresponsive:(WKWebView *)webView
+{
+ didBecomeUnresponsive = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WebKit, ResponsivenessTimerShouldNotFireAfterTearDown)
+{
+ auto processPoolConfiguration = adoptNS([_WKProcessPoolConfiguration new]);
+ auto processPool = adoptNS([[WKProcessPool alloc] _initWithConfiguration:processPoolConfiguration.get()]);
+ [processPool _setMaximumNumberOfProcesses:1];
+ auto delegate = adoptNS([ResponsivenessTimerDelegate new]);
+
+ auto configuration = adoptNS([WKWebViewConfiguration new]);
+ [configuration setProcessPool:processPool.get()];
+ auto webView1 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ [webView1 setNavigationDelegate:delegate.get()];
+ NSURLRequest *request = [NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]];
+ [webView1 loadRequest:request];
+ Util::run(&didFinishLoad);
+
+ EXPECT_FALSE(didBecomeUnresponsive);
+
+ auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ [webView2 setNavigationDelegate:delegate.get()];
+
+ didFinishLoad = false;
+ [webView2 loadRequest:request];
+ Util::run(&didFinishLoad);
+
+ EXPECT_FALSE(didBecomeUnresponsive);
+
+ // Call stopLoading() and close() on the first page in quick succession.
+ [webView1 stopLoading];
+ [webView1 _close];
+
+ // We need to wait here because it takes 3 seconds for a process to be recognized as unresponsive.
+ Util::sleep(4);
+
+ // We should not report the second page sharing the same process as unresponsive.
+ EXPECT_FALSE(didBecomeUnresponsive);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
Copied: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm (from rev 235364, trunk/Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp) (0 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm 2018-08-27 16:08:17 UTC (rev 235367)
@@ -0,0 +1,103 @@
+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if PLATFORM(MAC) && WK_API_ENABLED
+
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "TestWKWebView.h"
+#include <wtf/RetainPtr.h>
+
+static bool didFinishLoad;
+static bool didBecomeUnresponsive;
+static bool didBrieflyPause;
+
+static void didReceiveMessageFromInjectedBundle(WKContextRef, WKStringRef messageName, WKTypeRef, const void*)
+{
+ didBrieflyPause = true;
+ EXPECT_WK_STREQ("DidBrieflyPause", messageName);
+}
+
+static void setInjectedBundleClient(WKContextRef context)
+{
+ WKContextInjectedBundleClientV0 injectedBundleClient;
+ memset(&injectedBundleClient, 0, sizeof(injectedBundleClient));
+
+ injectedBundleClient.base.version = 0;
+ injectedBundleClient.didReceiveMessageFromInjectedBundle = didReceiveMessageFromInjectedBundle;
+
+ WKContextSetInjectedBundleClient(context, &injectedBundleClient.base);
+}
+
+@interface ResponsivenessDelegate : NSObject <WKNavigationDelegate>
+@end
+
+@implementation ResponsivenessDelegate
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ didFinishLoad = true;
+}
+
+- (void)_webViewWebProcessDidBecomeUnresponsive:(WKWebView *)webView
+{
+ didBecomeUnresponsive = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WebKit, ResponsivenessTimerDoesntFireEarly)
+{
+ WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("ResponsivenessTimerDoesntFireEarlyTest"));
+ setInjectedBundleClient(context.get());
+
+ auto delegate = adoptNS([ResponsivenessDelegate new]);
+ auto configuration = adoptNS([WKWebViewConfiguration new]);
+ [configuration setProcessPool:(WKProcessPool *)context.get()];
+ auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]);
+ [webView setNavigationDelegate:delegate.get()];
+
+ [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+ Util::run(&didFinishLoad);
+
+ WKContextPostMessageToInjectedBundle(context.get(), Util::toWK("BrieflyPause").get(), 0);
+
+ // Pressing a key on the keyboard should start the responsiveness timer. Since the web process
+ // is going to pause before it receives this keypress, it should take a little while to respond
+ // (but not so long that the responsiveness timer fires).
+ [webView typeCharacter:' '];
+
+ Util::run(&didBrieflyPause);
+
+ EXPECT_FALSE(didBecomeUnresponsive);
+}
+
+} // namespace TestWebKitAPI
+
+#endif
Copied: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm (from rev 235364, trunk/Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp) (0 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm 2018-08-27 16:08:17 UTC (rev 235367)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_API_ENABLED
+
+#include "_javascript_Test.h"
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+#include <WebKit/WKPagePrivate.h>
+#include <WebKit/WKSessionStateRef.h>
+#include <WebKit/WKWebViewPrivate.h>
+#include <wtf/RetainPtr.h>
+
+@interface WKWebView ()
+- (WKPageRef)_pageForTesting;
+@end
+
+static bool didFinishLoad;
+static bool didChangeBackForwardList;
+
+@interface SessionStateDelegate : NSObject <WKNavigationDelegate>
+@end
+
+@implementation SessionStateDelegate
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ didFinishLoad = true;
+}
+
+- (void)_webView:(WKWebView *)webView backForwardListItemAdded:(WKBackForwardListItem *)itemAdded removed:(NSArray<WKBackForwardListItem *> *)itemsRemoved
+{
+ didChangeBackForwardList = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+static WKRetainPtr<WKDataRef> createSessionStateData()
+{
+ auto delegate = adoptNS([SessionStateDelegate new]);
+ auto view = adoptNS([WKWebView new]);
+ [view setNavigationDelegate:delegate.get()];
+ [view loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+ Util::run(&didFinishLoad);
+ didFinishLoad = false;
+
+ NSData *data = "" _sessionStateData];
+ return adoptWK(WKDataCreate(static_cast<const unsigned char*>(data.bytes), data.length));
+}
+
+TEST(WebKit, RestoreSessionStateWithoutNavigation)
+{
+ auto data = ""
+ EXPECT_NOT_NULL(data);
+
+ auto webView = adoptNS([WKWebView new]);
+ auto sessionState = adoptWK(WKSessionStateCreateFromData(data.get()));
+ WKPageRestoreFromSessionStateWithoutNavigation([webView _pageForTesting], sessionState.get());
+
+ Util::run(&didChangeBackForwardList);
+
+ WKRetainPtr<WKURLRef> committedURL = adoptWK(WKPageCopyCommittedURL([webView _pageForTesting]));
+ EXPECT_NULL(committedURL.get());
+
+ auto backForwardList = WKPageGetBackForwardList([webView _pageForTesting]);
+ auto currentItem = WKBackForwardListGetCurrentItem(backForwardList);
+ auto currentItemURL = adoptWK(WKBackForwardListItemCopyURL(currentItem));
+ auto expectedURL = adoptWK(Util::createURLForResource("simple", "html"));
+ EXPECT_NOT_NULL(expectedURL);
+ EXPECT_TRUE(WKURLIsEqual(currentItemURL.get(), expectedURL.get()));
+}
+
+} // namespace TestWebKitAPI
+
+#endif
Copied: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm (from rev 235364, trunk/Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp) (0 => 235367)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm (rev 0)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm 2018-08-27 16:08:17 UTC (rev 235367)
@@ -0,0 +1,77 @@
+/*
+ * Copyright (C) 2012 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if WK_API_ENABLED
+
+#include "PlatformUtilities.h"
+#include "PlatformWebView.h"
+#include "Test.h"
+#include <WebKit/WKString.h>
+#include <wtf/RetainPtr.h>
+
+static bool finished = false;
+
+@interface BackForwardClient : NSObject <WKNavigationDelegate>
+@end
+
+@implementation BackForwardClient
+
+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation
+{
+ finished = true;
+}
+
+- (void)_webView:(WKWebView *)webView willGoToBackForwardListItem:(WKBackForwardListItem *)item inPageCache:(BOOL)inPageCache
+{
+ finished = true;
+}
+
+@end
+
+namespace TestWebKitAPI {
+
+TEST(WebKit, ShouldGoToBackForwardListItem)
+{
+ auto delegate = adoptNS([BackForwardClient new]);
+ auto webView = adoptNS([WKWebView new]);
+ [webView setNavigationDelegate:delegate.get()];
+
+ [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+ Util::run(&finished);
+
+ finished = false;
+ [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple-iframe" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]];
+ Util::run(&finished);
+
+ finished = false;
+ [webView goBack];
+ Util::run(&finished);
+}
+
+} // namespace TestWebKitAPI
+
+#endif