WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
148719
Test loading from the network in TestWebKitAPI
https://bugs.webkit.org/show_bug.cgi?id=148719
Summary
Test loading from the network in TestWebKitAPI
Alex Christensen
Reported
2015-09-02 12:51:23 PDT
TestWebKitAPI doesn't successfully use the network. I wrote a little socket server.
Attachments
Patch
(15.62 KB, patch)
2015-09-02 12:56 PDT
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Patch
(16.16 KB, patch)
2015-12-09 10:28 PST
,
Alex Christensen
no flags
Details
Formatted Diff
Diff
Show Obsolete
(1)
View All
Add attachment
proposed patch, testcase, etc.
Alex Christensen
Comment 1
2015-09-02 12:56:03 PDT
rdar://problem/22543960
Alex Christensen
Comment 2
2015-09-02 12:56:50 PDT
Created
attachment 260428
[details]
Patch
Tim Horton
Comment 3
2015-09-02 18:23:12 PDT
Comment on
attachment 260428
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=260428&action=review
> Tools/ChangeLog:3 > + Test loading from the network in TestWebKitAPI.
You should discuss this with Sam, Alexey, and Brady and make sure we actually want it. But, it seems like it might (eventually) make it possible to test things that we previously couldn't.
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NetworkLoading.mm:55 > + TCPServer server("HTTP/1.1 200 OK\r\n\r\n<html><head><title>TestTitle</title></head><body>TestBody</body></html>");
Please consider factoring the 200 header into something vended by TCPServer because it looks ugly.
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NetworkLoading.mm:59 > + urlBuilder.append("
http://127.0.0.1
:");
I think the operators work
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NetworkLoading.mm:64 > + RetainPtr<WebView> webView = adoptNS([[WebView alloc] initWithFrame:NSMakeRect(0, 0, 120, 200) frameName:nil groupName:nil]);
Can you/should you use PlatformWebView? Otherwise, do you want to be using WK2?
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NetworkLoading.mm:67 > + [[webView.get() mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithCString:urlBuilder.toString().utf8().data() encoding:NSUTF8StringEncoding]]]];
There's got to be a better way to say this.
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/NetworkLoading.mm:70 > + EXPECT_STREQ([[webView.get() mainFrameTitle] UTF8String], "TestTitle");
Stop it with the .get()s
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/TCPServer.cpp:100 > +void TCPServer::replyToRequest()
This is more like waitForAndReplyToRequest (it does more than just reply)
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/TCPServer.cpp:111 > + String request = readEntireRequest();
So, someday you'll support verifying the request, and multiple request/response pairs?
> Tools/TestWebKitAPI/Tests/WebKit2Cocoa/TCPServer.cpp:114 > +
extra newline
Alexey Proskuryakov
Comment 4
2015-09-04 10:25:58 PDT
It's definitely a great idea to allow networking tests in TestWebKitAPI. However, I'm worried about adding yet another server that has to find a port for itself, to make sure that everything works in concurrent scenarios, and eventually to support https and websockets. Writing C++ code to implement trivial HTTP responses seems undesirable too. Can't we just use the same Apache setup as in layout tests? Let's discuss this before landing.
Alex Christensen
Comment 5
2015-12-09 10:28:09 PST
Created
attachment 267020
[details]
Patch
Alexey Proskuryakov
Comment 6
2015-12-09 11:23:12 PST
> It's definitely a great idea to allow networking tests in TestWebKitAPI.
Having talked to Alex in person, I now wonder if it would be better to test such things in WebKitTestRunner, because that's where our end-to-end tests are normally run.
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug