WebKit Bugzilla
Attachment 348169 Details for
Bug 188827
: Translate 4 tests using WKPageLoaderClient to ObjC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch with updated title
patch (text/plain), 74.81 KB, created by
Alex Christensen
on 2018-08-27 11:14:25 PDT
(
hide
)
Description:
patch with updated title
Filename:
MIME Type:
Creator:
Alex Christensen
Created:
2018-08-27 11:14:25 PDT
Size:
74.81 KB
patch
obsolete
>Index: Tools/ChangeLog >=================================================================== >--- Tools/ChangeLog (revision 235372) >+++ Tools/ChangeLog (working copy) >@@ -1,3 +1,54 @@ >+2018-08-27 Alex Christensen <achristensen@webkit.org> >+ >+ 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 Alex Christensen <achristensen@webkit.org> > > Unreviewed, rolling out r235367. >Index: Tools/TestWebKitAPI/JavaScriptTest.h >=================================================================== >--- Tools/TestWebKitAPI/JavaScriptTest.h (revision 235371) >+++ Tools/TestWebKitAPI/JavaScriptTest.h (working copy) >@@ -27,6 +27,7 @@ > OBJC_CLASS WKView; > OBJC_CLASS WebView; > #endif >+#include <WebKit/WKBase.h> > > namespace TestWebKitAPI { > >Index: Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj >=================================================================== >--- Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (revision 235372) >+++ Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj (working copy) >@@ -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 /* JavaScriptTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptTest.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,12 +2380,16 @@ > 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 */, > 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 */, >Index: Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp (nonexistent) >@@ -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 >Index: Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp (nonexistent) >@@ -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 > >Index: Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp (nonexistent) >@@ -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 "JavaScriptTest.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 = createSessionStateData(context.get()); >- 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 >Index: Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp (nonexistent) >@@ -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 >Index: Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem_Bundle.cpp >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem_Bundle.cpp (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem_Bundle.cpp (nonexistent) >@@ -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 >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm (revision 235372) (from Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimer.cpp:235372) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm (working copy) >@@ -0,0 +1,96 @@ >+/* >+ * 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 >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimer.mm (working copy) >@@ -25,64 +25,66 @@ > > #include "config.h" > >-#if WK_HAVE_C_SPI >+#if WK_API_ENABLED > >-#include "PlatformUtilities.h" >-#include "PlatformWebView.h" >- >-namespace TestWebKitAPI { >+#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 }; > >-static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*) >+@interface ResponsivenessTimerDelegate : NSObject <WKNavigationDelegate> >+@end >+ >+@implementation ResponsivenessTimerDelegate >+ >+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation > { > didFinishLoad = true; > } > >-static void processDidBecomeUnresponsive(WKPageRef page, const void*) >+- (void)_webViewWebProcessDidBecomeUnresponsive:(WKWebView *)webView > { > didBecomeUnresponsive = true; > } > >-static void setPageLoaderClient(WKPageRef page) >-{ >- WKPageLoaderClientV0 loaderClient; >- memset(&loaderClient, 0, sizeof(loaderClient)); >- >- loaderClient.base.version = 0; >- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; >- loaderClient.processDidBecomeUnresponsive = processDidBecomeUnresponsive; >+@end > >- WKPageSetPageLoaderClient(page, &loaderClient.base); >-} >+namespace TestWebKitAPI { > > 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()); >+ 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); > >- PlatformWebView webView2(context.get()); >- setPageLoaderClient(webView2.page()); >+ auto webView2 = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600) configuration:configuration.get()]); >+ [webView2 setNavigationDelegate:delegate.get()]; > > didFinishLoad = false; >- WKPageLoadURL(webView2.page(), adoptWK(Util::createURLForResource("simple", "html")).get()); >+ [webView2 loadRequest:request]; > Util::run(&didFinishLoad); > > EXPECT_FALSE(didBecomeUnresponsive); > > // Call stopLoading() and close() on the first page in quick succession. >- WKPageStopLoading(webView1.page()); >- WKPageClose(webView1.page()); >+ [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); >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm (revision 235372) (from Tools/TestWebKitAPI/Tests/WebKit/ResponsivenessTimerDoesntFireEarly.cpp:235372) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm (working copy) >@@ -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 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 > >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ResponsivenessTimerDoesntFireEarly.mm (working copy) >@@ -25,12 +25,12 @@ > > #include "config.h" > >-#if WK_HAVE_C_SPI >+#if PLATFORM(MAC) && WK_API_ENABLED > > #include "PlatformUtilities.h" > #include "PlatformWebView.h" >- >-namespace TestWebKitAPI { >+#include "TestWKWebView.h" >+#include <wtf/RetainPtr.h> > > static bool didFinishLoad; > static bool didBecomeUnresponsive; >@@ -42,16 +42,6 @@ static void didReceiveMessageFromInjecte > 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; >@@ -63,27 +53,37 @@ static void setInjectedBundleClient(WKCo > WKContextSetInjectedBundleClient(context, &injectedBundleClient.base); > } > >-static void setPageLoaderClient(WKPageRef page) >-{ >- WKPageLoaderClientV0 loaderClient; >- memset(&loaderClient, 0, sizeof(loaderClient)); >+@interface ResponsivenessDelegate : NSObject <WKNavigationDelegate> >+@end >+ >+@implementation ResponsivenessDelegate > >- loaderClient.base.version = 0; >- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; >- loaderClient.processDidBecomeUnresponsive = processDidBecomeUnresponsive; >+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation >+{ >+ didFinishLoad = true; >+} > >- WKPageSetPageLoaderClient(page, &loaderClient.base); >+- (void)_webViewWebProcessDidBecomeUnresponsive:(WKWebView *)webView >+{ >+ didBecomeUnresponsive = true; > } > >+@end >+ >+namespace TestWebKitAPI { >+ > TEST(WebKit, ResponsivenessTimerDoesntFireEarly) > { > WKRetainPtr<WKContextRef> context = adoptWK(Util::createContextForInjectedBundleTest("ResponsivenessTimerDoesntFireEarlyTest")); > setInjectedBundleClient(context.get()); > >- PlatformWebView webView(context.get()); >- setPageLoaderClient(webView.page()); >+ 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()]; > >- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).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); >@@ -91,7 +91,7 @@ TEST(WebKit, ResponsivenessTimerDoesntFi > // 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(); >+ [webView typeCharacter:' ']; > > Util::run(&didBrieflyPause); > >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm (revision 235372) (from Tools/TestWebKitAPI/Tests/WebKit/RestoreSessionStateWithoutNavigation.cpp:235372) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm (working copy) >@@ -0,0 +1,105 @@ >+/* >+ * 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 "JavaScriptTest.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 = createSessionStateData(context.get()); >+ 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 >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/RestoreSessionStateWithoutNavigation.mm (working copy) >@@ -25,77 +25,80 @@ > > #include "config.h" > >-#if WK_HAVE_C_SPI >+#if WK_API_ENABLED > > #include "JavaScriptTest.h" > #include "PlatformUtilities.h" > #include "PlatformWebView.h" > #include "Test.h" >+#include <WebKit/WKBackForwardListItemRef.h> >+#include <WebKit/WKBackForwardListRef.h> >+#include <WebKit/WKData.h> > #include <WebKit/WKPagePrivate.h> > #include <WebKit/WKSessionStateRef.h> >- >-namespace TestWebKitAPI { >+#include <WebKit/WKURL.h> >+#include <WebKit/WKURLCF.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 > >-static void didFinishLoadForFrame(WKPageRef, WKFrameRef, WKTypeRef, const void*) >+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation > { > didFinishLoad = true; > } > >-static void didChangeBackForwardListForPage(WKPageRef, WKBackForwardListItemRef addedItem, WKArrayRef, const void*) >+- (void)_webView:(WKWebView *)webView backForwardListItemAdded:(WKBackForwardListItem *)itemAdded removed:(NSArray<WKBackForwardListItem *> *)itemsRemoved > { > didChangeBackForwardList = true; > } > >-static void setPageLoaderClient(WKPageRef page) >-{ >- WKPageLoaderClientV0 loaderClient; >- memset(&loaderClient, 0, sizeof(loaderClient)); >- >- loaderClient.base.version = 0; >- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; >- loaderClient.didChangeBackForwardList = didChangeBackForwardListForPage; >+@end > >- WKPageSetPageLoaderClient(page, &loaderClient.base); >-} >+namespace TestWebKitAPI { > >-static WKRetainPtr<WKDataRef> createSessionStateData(WKContextRef context) >+static WKRetainPtr<WKDataRef> createSessionStateData() > { >- PlatformWebView webView(context); >- setPageLoaderClient(webView.page()); >- >- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get()); >+ 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; > >- auto sessionState = adoptWK(static_cast<WKSessionStateRef>(WKPageCopySessionState(webView.page(), reinterpret_cast<void*>(1), nullptr))); >- return adoptWK(WKSessionStateCopyData(sessionState.get())); >+ NSData *data = [view _sessionStateData]; >+ return adoptWK(WKDataCreate(static_cast<const unsigned char*>(data.bytes), data.length)); > } > > TEST(WebKit, RestoreSessionStateWithoutNavigation) > { >- WKRetainPtr<WKContextRef> context(AdoptWK, WKContextCreate()); >- >- PlatformWebView webView(context.get()); >- setPageLoaderClient(webView.page()); >- >- WKRetainPtr<WKDataRef> data = createSessionStateData(context.get()); >+ auto data = createSessionStateData(); > EXPECT_NOT_NULL(data); > >+ auto webView = adoptNS([WKWebView new]); > auto sessionState = adoptWK(WKSessionStateCreateFromData(data.get())); >- WKPageRestoreFromSessionStateWithoutNavigation(webView.page(), sessionState.get()); >+ WKPageRestoreFromSessionStateWithoutNavigation([webView _pageForTesting], sessionState.get()); > > Util::run(&didChangeBackForwardList); > >- WKRetainPtr<WKURLRef> committedURL = adoptWK(WKPageCopyCommittedURL(webView.page())); >+ WKRetainPtr<WKURLRef> committedURL = adoptWK(WKPageCopyCommittedURL([webView _pageForTesting])); > EXPECT_NULL(committedURL.get()); > >- auto backForwardList = WKPageGetBackForwardList(webView.page()); >+ auto backForwardList = WKPageGetBackForwardList([webView _pageForTesting]); > auto currentItem = WKBackForwardListGetCurrentItem(backForwardList); > auto currentItemURL = adoptWK(WKBackForwardListItemCopyURL(currentItem)); >- auto expectedURL = adoptWK(Util::createURLForResource("simple", "html")); >+ >+ auto expectedURL = adoptWK(WKURLCreateWithCFURL((CFURLRef)[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"])); > EXPECT_NOT_NULL(expectedURL); > EXPECT_TRUE(WKURLIsEqual(currentItemURL.get(), expectedURL.get())); > } >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm (revision 235372) (from Tools/TestWebKitAPI/Tests/WebKit/ShouldGoToBackForwardListItem.cpp:235372) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm (working copy) >@@ -0,0 +1,97 @@ >+/* >+ * 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 >Index: Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm >=================================================================== >--- Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm (revision 235372) >+++ Tools/TestWebKitAPI/Tests/WebKitCocoa/ShouldGoToBackForwardListItem.mm (working copy) >@@ -25,71 +25,51 @@ > > #include "config.h" > >-#if WK_HAVE_C_SPI >+#if WK_API_ENABLED > > #include "PlatformUtilities.h" > #include "PlatformWebView.h" > #include "Test.h" >- > #include <WebKit/WKString.h> >- >-namespace TestWebKitAPI { >+#include <wtf/RetainPtr.h> > > 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; >+@interface BackForwardClient : NSObject <WKNavigationDelegate> >+@end > >- finished = true; >-} >+@implementation BackForwardClient > >-static void willGoToBackForwardListItem(WKPageRef, WKBackForwardListItemRef, WKTypeRef userData, const void*) >+- (void)webView:(WKWebView *)webView didFinishNavigation:(WKNavigation *)navigation > { >- if (WKGetTypeID(userData) == WKStringGetTypeID()) { >- if (WKStringIsEqualToUTF8CString((WKStringRef)userData, "shouldGoToBackForwardListItemCallback called as expected")) >- receivedProperBackForwardCallbacks = true; >- } >- > finished = true; > } > >-static void setPageLoaderClient(WKPageRef page) >+- (void)_webView:(WKWebView *)webView willGoToBackForwardListItem:(WKBackForwardListItem *)item inPageCache:(BOOL)inPageCache > { >- WKPageLoaderClientV1 loaderClient; >- memset(&loaderClient, 0, sizeof(loaderClient)); >+ finished = true; >+} > >- loaderClient.base.version = 1; >- loaderClient.didFinishLoadForFrame = didFinishLoadForFrame; >- loaderClient.willGoToBackForwardListItem = willGoToBackForwardListItem; >+@end > >- WKPageSetPageLoaderClient(page, &loaderClient.base); >-} >+namespace TestWebKitAPI { > > 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()); >+ auto delegate = adoptNS([BackForwardClient new]); >+ auto webView = adoptNS([WKWebView new]); >+ [webView setNavigationDelegate:delegate.get()]; > >- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple", "html")).get()); >+ [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; > Util::run(&finished); > > finished = false; >- WKPageLoadURL(webView.page(), adoptWK(Util::createURLForResource("simple-iframe", "html")).get()); >+ [webView loadRequest:[NSURLRequest requestWithURL:[[NSBundle mainBundle] URLForResource:@"simple-iframe" withExtension:@"html" subdirectory:@"TestWebKitAPI.resources"]]]; > Util::run(&finished); > > finished = false; >- WKPageGoBack(webView.page()); >+ [webView goBack]; > Util::run(&finished); >- >- EXPECT_EQ(receivedProperBackForwardCallbacks, true); > } > > } // namespace TestWebKitAPI
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
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 188827
:
347725
|
347730
|
347739
|
348145
|
348150
|
348168
| 348169