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

Daniel Lazarenko danielo at opera.com
Tue Aug 26 04:44:43 PDT 2014


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.

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
Opera Software ASA

More information about the webkit-dev mailing list