Title: [287365] trunk/Tools
Revision
287365
Author
achristen...@apple.com
Date
2021-12-22 10:52:52 -0800 (Wed, 22 Dec 2021)

Log Message

Re-enable WebpagePreferences.WebsitePoliciesDuringRedirect API test on Monterey
https://bugs.webkit.org/show_bug.cgi?id=234607

Reviewed by Brady Eidson.

This is the same as r285057 where we were responding with one byte short of the ranges requested,
which used to give a playing event but since Monterey it doesn't.  The fix is to respond with all
the bytes requested.  If the request is for bytes 0-1, we need to respond with two bytes, for example.

* TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
(-[TestSchemeHandler webView:startURLSchemeTask:]):
(TEST):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (287364 => 287365)


--- trunk/Tools/ChangeLog	2021-12-22 18:48:55 UTC (rev 287364)
+++ trunk/Tools/ChangeLog	2021-12-22 18:52:52 UTC (rev 287365)
@@ -1,3 +1,18 @@
+2021-12-22  Alex Christensen  <achristen...@webkit.org>
+
+        Re-enable WebpagePreferences.WebsitePoliciesDuringRedirect API test on Monterey
+        https://bugs.webkit.org/show_bug.cgi?id=234607
+
+        Reviewed by Brady Eidson.
+
+        This is the same as r285057 where we were responding with one byte short of the ranges requested,
+        which used to give a playing event but since Monterey it doesn't.  The fix is to respond with all
+        the bytes requested.  If the request is for bytes 0-1, we need to respond with two bytes, for example.
+
+        * TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm:
+        (-[TestSchemeHandler webView:startURLSchemeTask:]):
+        (TEST):
+
 2021-12-22  J Pascoe  <j_pas...@apple.com>
 
         [WebAuthn] Set Web Authentication experimental feature flag as default true

Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm (287364 => 287365)


--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm	2021-12-22 18:48:55 UTC (rev 287364)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/WebsitePolicies.mm	2021-12-22 18:52:52 UTC (rev 287365)
@@ -695,10 +695,10 @@
     ASSERT_TRUE(!!parsedRange.range);
     auto& range = *parsedRange.range;
     
-    NSDictionary *headerFields = @{ @"Content-Length": [@(range.second - range.first) stringValue], @"Content-Range": [NSString stringWithFormat:@"bytes %lu-%lu/%lu", range.first, range.second, [videoData length]] };
+    NSDictionary *headerFields = @{ @"Content-Length": [@(range.second - range.first + 1) stringValue], @"Content-Range": [NSString stringWithFormat:@"bytes %lu-%lu/%lu", range.first, range.second, [videoData length]] };
     auto response = adoptNS([[NSHTTPURLResponse alloc] initWithURL:task.request.URL statusCode:200 HTTPVersion:(NSString *)kCFHTTPVersion1_1 headerFields:headerFields]);
     [task didReceiveResponse:response.get()];
-    [task didReceiveData:[videoData subdataWithRange:NSMakeRange(range.first, range.second - range.first)]];
+    [task didReceiveData:[videoData subdataWithRange:NSMakeRange(range.first, range.second - range.first + 1)]];
     [task didFinish];
     
 }
@@ -709,12 +709,7 @@
 
 @end
 
-// FIXME: Re-enable this test for Monterey+ once rdar://80476146 is resolved.
-#if __MAC_OS_X_VERSION_MIN_REQUIRED >= 120000
-TEST(WebpagePreferences, DISABLED_WebsitePoliciesDuringRedirect)
-#else
 TEST(WebpagePreferences, WebsitePoliciesDuringRedirect)
-#endif
 {
     auto configuration = adoptNS([[WKWebViewConfiguration alloc] init]);
     auto videoData = adoptNS([[NSData alloc] initWithContentsOfURL:[[NSBundle mainBundle] URLForResource:@"test" withExtension:@"mp4" subdirectory:@"TestWebKitAPI.resources"]]);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to