[webkit-dev] TestWebKitAPI doesn't initialize WKWebView from command line

Tim Horton timothy_horton at apple.com
Tue Aug 26 09:10:44 PDT 2014


On 2014.08.26, at 04:44, Daniel Lazarenko <danielo at opera.com> wrote:

> Hello,  
> 
> I’m trying to run the WKWebView API tests using this command:
> ./TestWebKitAPI --gtest_filter=_WKDownload.DownloadRequest
> This binary is located in webkit/WebKitBuild/Debug, I’ve built it using Xcode beta 6 on Yosemite.

You probably want to either use the 'run-api-tests' wrapper, or specify the DYLD_FRAMEWORK_PATH environment variable to point to your build products. Otherwise you’re probably launching TestWebKitAPI with the system version of WebKit.

> This test fails, if I run it from command line.
> It passes, if I run it from Xcode (I can set up the process to run and edit arguments if I edit scheme).
> 
> I’m new to this code, and such behaviour is quite surprising for me.
> 
> To be sure, I’ve placed “puts()” statements before, after and inside a call to [WKWebView initWithFrame:]. This call happens in runTest function in Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm . If I run it from command line, the puts() inside initWithFrame is not printing anything out.
> 
> What’s the difference? Why does it fail outside Xcode debugger?  
> 
> It also fails if the Xcode debugger is attached to the process that is run from command line.
> 
> Here’s the change I’ve made:
> 
> diff --git a/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
> index d6492df..321ac1f 100644
> --- a/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
> +++ b/Source/WebKit2/UIProcess/API/Cocoa/WKWebView.mm
> @@ -212,6 +212,7 @@ WKWebView* fromWebPageProxy(WebKit::WebPageProxy& page)
> 
> - (instancetype)initWithFrame:(CGRect)frame
> {
> + puts("WKWebView initWithFrame");
> return [self initWithFrame:frame configuration:adoptNS([[WKWebViewConfiguration alloc] init]).get()];
> }
> 
> diff --git a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm
> index ecadb6d..a442930 100644
> --- a/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm
> +++ b/Tools/TestWebKitAPI/Tests/WebKit2Cocoa/Download.mm
> @@ -120,7 +120,9 @@ TEST(_WKDownload, DownloadDelegate)
> 
> static void runTest(id <WKNavigationDelegate> navigationDelegate, id <_WKDownloadDelegate> downloadDelegate, NSURL *url)
> {
> + puts("before initWithFrame");
> RetainPtr<WKWebView> webView = adoptNS([[WKWebView alloc] initWithFrame:NSMakeRect(0, 0, 800, 600)]);
> + puts("after initWithFrame");
> [webView setNavigationDelegate:navigationDelegate];
> [[[webView configuration] processPool] _setDownloadDelegate:downloadDelegate];
> 
> 
> 
> 
> 
> --
> With best regards,
> Daniel Lazarenko
> Developer
> Opera Software ASA
> 
> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> https://lists.webkit.org/mailman/listinfo/webkit-dev



More information about the webkit-dev mailing list