RESOLVED FIXED 225773
Add unit test using WKHTTPCookieStoreObserver and cookies received from HTTP
https://bugs.webkit.org/show_bug.cgi?id=225773
Summary Add unit test using WKHTTPCookieStoreObserver and cookies received from HTTP
Alex Christensen
Reported 2021-05-13 11:03:44 PDT
Add unit test using WKHTTPCookieStoreObserver and cookies received from HTTP
Attachments
Patch (3.98 KB, patch)
2021-05-13 11:04 PDT, Alex Christensen
no flags
Patch (3.99 KB, patch)
2021-05-13 13:09 PDT, Alex Christensen
ews-feeder: commit-queue-
Alex Christensen
Comment 1 2021-05-13 11:04:37 PDT
Chris Dumez
Comment 2 2021-05-13 11:12:23 PDT
Comment on attachment 428534 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=428534&action=review r=me with suggestions. > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:462 > +static void deleteAllCookies(WKHTTPCookieStore *store, RetainPtr<NSMutableArray> array, BlockPtr<void(void)> completionBlock) Maybe we should call this deleteCookies() instead of deleteAllCookies() given that it only deletes the cookies in the provided array. Maybe we could rename array to cookies too for clarity. > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:466 > + [store deleteCookie:[array lastObject] completionHandler:^(void) { We're not really testing the parallelism here and it is slower than could be. I wish we'd use WTF's CallbackAggregator and do the removals in parallel. > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:479 > + deleteAllCookies(store, adoptNS([cookies mutableCopy]), ^{ Why `adoptNS([cookies mutableCopy]` instead of just `cookies` ? > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:501 > + EXPECT_EQ(cookies.count, 1u); Should probably be ASSERT_EQ() in case we get 0 cookies.
Alex Christensen
Comment 3 2021-05-13 11:15:00 PDT
(In reply to Chris Dumez from comment #2) > Comment on attachment 428534 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=428534&action=review > > r=me with suggestions. > > > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:462 > > +static void deleteAllCookies(WKHTTPCookieStore *store, RetainPtr<NSMutableArray> array, BlockPtr<void(void)> completionBlock) > > Maybe we should call this deleteCookies() instead of deleteAllCookies() > given that it only deletes the cookies in the provided array. > > Maybe we could rename array to cookies too for clarity. Brilliant. > > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:466 > > + [store deleteCookie:[array lastObject] completionHandler:^(void) { > > We're not really testing the parallelism here and it is slower than could > be. I wish we'd use WTF's CallbackAggregator and do the removals in parallel. Parallelism isn't important here. I'm just removing any leftovers from previous tests. > > Tools/TestWebKitAPI/Tests/WebKitCocoa/WKHTTPCookieStore.mm:479 > > + deleteAllCookies(store, adoptNS([cookies mutableCopy]), ^{ > > Why `adoptNS([cookies mutableCopy]` instead of just `cookies` ? It needs to be mutable because I remove them one by one.
Alex Christensen
Comment 4 2021-05-13 13:09:00 PDT
EWS
Comment 5 2021-05-13 14:28:42 PDT
Committed r277451 (237699@main): <https://commits.webkit.org/237699@main> All reviewed patches have been landed. Closing bug and clearing flags on attachment 428552 [details].
Radar WebKit Bug Importer
Comment 6 2021-05-13 15:08:23 PDT
Note You need to log in before you can comment on or make changes to this bug.