Title: [295237] trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm
- Revision
- 295237
- Author
- [email protected]
- Date
- 2022-06-03 15:08:21 -0700 (Fri, 03 Jun 2022)
Log Message
REGRESSION: [ iOS ] Six TestWebKitAPI.AppPrivacyRep ort API tests are a consistent timeout (241233)
https://bugs.webkit.org/show_bug.cgi?id=241233
rdar://94298162
Reviewed by Ryan Haddad.
Avoid connecting to the internet in API tests.
* Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm:
(TEST):
Canonical link: https://commits.webkit.org/251292@main
Modified Paths
Diff
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm (295236 => 295237)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm 2022-06-03 22:02:34 UTC (rev 295236)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/AppPrivacyReport.mm 2022-06-03 22:08:21 UTC (rev 295237)
@@ -44,10 +44,12 @@
#if ENABLE(APP_PRIVACY_REPORT)
TEST(AppPrivacyReport, DefaultRequestIsAppInitiated)
{
+ TestWebKitAPI::HTTPServer server(TestWebKitAPI::HTTPServer::respondWithChallengeThenOK);
+
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
- NSString *url = ""
+ NSString *url = "" stringWithFormat:@"http://127.0.0.1:%d/", server.port()];
__block bool isDone = false;
// Don't set the attribution API on NSURLRequest to make sure the default is app initiated.
@@ -73,10 +75,11 @@
TEST(AppPrivacyReport, AppInitiatedRequest)
{
+ TestWebKitAPI::HTTPServer server(TestWebKitAPI::HTTPServer::respondWithChallengeThenOK);
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
- NSString *url = ""
+ NSString *url = "" stringWithFormat:@"http://127.0.0.1:%d/", server.port()];
__block bool isDone = false;
NSMutableURLRequest *appInitiatedRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
@@ -104,10 +107,12 @@
TEST(AppPrivacyReport, NonAppInitiatedRequest)
{
+ TestWebKitAPI::HTTPServer server(TestWebKitAPI::HTTPServer::respondWithChallengeThenOK);
+
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
- NSString *url = ""
+ NSString *url = "" stringWithFormat:@"http://127.0.0.1:%d/", server.port()];
__block bool isDone = false;
NSMutableURLRequest *nonAppInitiatedRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:url]];
@@ -135,11 +140,13 @@
TEST(AppPrivacyReport, AppInitiatedRequestWithNavigation)
{
+ TestWebKitAPI::HTTPServer server(TestWebKitAPI::HTTPServer::respondWithChallengeThenOK);
+
auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
auto webView = adoptNS([[TestWKWebView alloc] initWithFrame:CGRectZero configuration:configuration.get()]);
- NSString *appInitiatedURL = @"https://www.webkit.org";
- NSString *nonAppInitiatedURL = @"https://www.apple.com";
+ NSString *appInitiatedURL = [NSString stringWithFormat:@"http://127.0.0.1:%d/", server.port()];
+ NSString *nonAppInitiatedURL = [NSString stringWithFormat:@"http://localhost:%d/", server.port()];
NSMutableURLRequest *appInitiatedRequest = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:appInitiatedURL]];
appInitiatedRequest.attribution = NSURLRequestAttributionDeveloper;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes