Bug 191493

Summary: [Curl] Add API Test for Curl cookie backend.
Product: WebKit Reporter: Basuke Suzuki <basuke>
Component: PlatformAssignee: Basuke Suzuki <basuke>
Status: RESOLVED FIXED    
Severity: Normal CC: achristensen, basuke, commit-queue, ews-watchlist, webkit-bug-importer, youennf
Priority: P2 Keywords: InRadar
Version: WebKit Nightly Build   
Hardware: Unspecified   
OS: Unspecified   
See Also: https://bugs.webkit.org/show_bug.cgi?id=191406
Attachments:
Description Flags
PATCH
none
FIX Style
none
Fix
youennf: review+
PATCH
none
PATCH AGAIN none

Basuke Suzuki
Reported 2018-11-09 16:01:20 PST
Cleanup Cookie database implementation to make them testable better. Then add unit tests.
Attachments
PATCH (27.20 KB, patch)
2018-11-09 16:17 PST, Basuke Suzuki
no flags
FIX Style (27.99 KB, patch)
2018-11-09 16:33 PST, Basuke Suzuki
no flags
Fix (28.02 KB, patch)
2018-11-12 13:28 PST, Basuke Suzuki
youennf: review+
PATCH (29.15 KB, patch)
2018-11-12 14:29 PST, Basuke Suzuki
no flags
PATCH AGAIN (29.20 KB, patch)
2018-11-12 14:41 PST, Basuke Suzuki
no flags
Basuke Suzuki
Comment 1 2018-11-09 16:17:13 PST
Basuke Suzuki
Comment 2 2018-11-09 16:18:33 PST
Separate the initial test preparation and refactoring of code from the patch. https://bugs.webkit.org/show_bug.cgi?id=191406
EWS Watchlist
Comment 3 2018-11-09 16:22:25 PST
Attachment 354405 [details] did not pass style-queue: ERROR: Source/WebCore/platform/network/curl/CookieJarDB.cpp:152: When wrapping a line, only indent 4 spaces. [whitespace/indent] [3] Total errors found: 1 in 11 files If any of these errors are false positives, please file a bug against check-webkit-style.
Basuke Suzuki
Comment 4 2018-11-09 16:33:01 PST
Created attachment 354410 [details] FIX Style
Alex Christensen
Comment 5 2018-11-10 16:46:34 PST
Comment on attachment 354410 [details] FIX Style View in context: https://bugs.webkit.org/attachment.cgi?id=354410&action=review > Source/WebCore/platform/FileSystem.h:190 > +#if OS(WINDOWS) There's already a PLATFORM(WIN) just above this. > Tools/TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp:35 > +using namespace WebCore; Could we put this inside the namespace in case we unify these sources, too?
Basuke Suzuki
Comment 6 2018-11-12 11:06:19 PST
Comment on attachment 354410 [details] FIX Style View in context: https://bugs.webkit.org/attachment.cgi?id=354410&action=review Thanks for review! >> Source/WebCore/platform/FileSystem.h:190 >> +#if OS(WINDOWS) > > There's already a PLATFORM(WIN) just above this. I meant this for both AppleWin and WinCairo because there's not WinCairo specific code. >> Tools/TestWebKitAPI/Tests/WebCore/curl/Cookies.cpp:35 >> +using namespace WebCore; > > Could we put this inside the namespace in case we unify these sources, too? Ah, okay.
Basuke Suzuki
Comment 7 2018-11-12 13:28:00 PST
Created attachment 354582 [details] Fix Move tests into its own namespace and make utility functions in FileSystem into PLATFORM(WIN_CAIRO)
youenn fablet
Comment 8 2018-11-12 13:53:47 PST
Comment on attachment 354582 [details] Fix View in context: https://bugs.webkit.org/attachment.cgi?id=354582&action=review > Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp:51 > + for (auto cookie : *result) { s/auto/auto& > Source/WebCore/platform/network/curl/CookieJarDB.cpp:434 > + SQLiteStatement* statement = getPrepareStatement(SET_COOKIE_SQL); s/SQLiteStatement/auto/ Also maybe getPrepareStatement should return a SQLiteStatement& > Source/WebCore/platform/network/curl/CookieJarDB.h:43 > + enum class Source : uint8_t { Do we need " : uint8_t"? > Source/WebCore/platform/network/curl/CookieUtil.cpp:147 > + return std::nullopt; You can also write it { }, which is shorter. Not exactly sure what is the recommended way.
Basuke Suzuki
Comment 9 2018-11-12 14:22:30 PST
Comment on attachment 354582 [details] Fix View in context: https://bugs.webkit.org/attachment.cgi?id=354582&action=review Thanks! >> Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp:51 >> + for (auto cookie : *result) { > > s/auto/auto& Sure. >> Source/WebCore/platform/network/curl/CookieJarDB.cpp:434 >> + SQLiteStatement* statement = getPrepareStatement(SET_COOKIE_SQL); > > s/SQLiteStatement/auto/ > Also maybe getPrepareStatement should return a SQLiteStatement& Got it. Also will rename getPrepareStatement to preparedStatement. >> Source/WebCore/platform/network/curl/CookieJarDB.h:43 >> + enum class Source : uint8_t { > > Do we need " : uint8_t"? Not specifically. Will remove it. >> Source/WebCore/platform/network/curl/CookieUtil.cpp:147 >> + return std::nullopt; > > You can also write it { }, which is shorter. > Not exactly sure what is the recommended way. Oh, I didn't know that. Thanks
Basuke Suzuki
Comment 10 2018-11-12 14:29:03 PST
Alex Christensen
Comment 11 2018-11-12 14:31:01 PST
(In reply to youenn fablet from comment #8) > Comment on attachment 354582 [details] > Fix > > View in context: > https://bugs.webkit.org/attachment.cgi?id=354582&action=review > > > Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp:51 > > + for (auto cookie : *result) { > > s/auto/auto& > > > Source/WebCore/platform/network/curl/CookieJarDB.cpp:434 > > + SQLiteStatement* statement = getPrepareStatement(SET_COOKIE_SQL); > > s/SQLiteStatement/auto/ > Also maybe getPrepareStatement should return a SQLiteStatement& > > > Source/WebCore/platform/network/curl/CookieJarDB.h:43 > > + enum class Source : uint8_t { > > Do we need " : uint8_t"? We are preferring this when possible in case they get stored someday. In fact, you can't send an enum class without a storage class over IPC now. > > > Source/WebCore/platform/network/curl/CookieUtil.cpp:147 > > + return std::nullopt; > > You can also write it { }, which is shorter. > Not exactly sure what is the recommended way. std::nullopt is preferred in WebKit. It's more explicit.
Basuke Suzuki
Comment 12 2018-11-12 14:34:24 PST
(In reply to Alex Christensen from comment #11) > (In reply to youenn fablet from comment #8) > > Comment on attachment 354582 [details] > > Fix > > > > View in context: > > https://bugs.webkit.org/attachment.cgi?id=354582&action=review > > > > > Source/WebCore/platform/network/curl/CookieJarCurlDatabase.cpp:51 > > > + for (auto cookie : *result) { > > > > s/auto/auto& > > > > > Source/WebCore/platform/network/curl/CookieJarDB.cpp:434 > > > + SQLiteStatement* statement = getPrepareStatement(SET_COOKIE_SQL); > > > > s/SQLiteStatement/auto/ > > Also maybe getPrepareStatement should return a SQLiteStatement& > > > > > Source/WebCore/platform/network/curl/CookieJarDB.h:43 > > > + enum class Source : uint8_t { > > > > Do we need " : uint8_t"? > We are preferring this when possible in case they get stored someday. In > fact, you can't send an enum class without a storage class over IPC now. Got it. I couldn't find any reason at this moment for this, but it may be contained in IPC someday. > > > > > Source/WebCore/platform/network/curl/CookieUtil.cpp:147 > > > + return std::nullopt; > > > > You can also write it { }, which is shorter. > > Not exactly sure what is the recommended way. > std::nullopt is preferred in WebKit. It's more explicit. Oh, okay. Thanks.
Basuke Suzuki
Comment 13 2018-11-12 14:41:13 PST
Created attachment 354594 [details] PATCH AGAIN
WebKit Commit Bot
Comment 14 2018-11-12 15:18:51 PST
Comment on attachment 354594 [details] PATCH AGAIN Clearing flags on attachment: 354594 Committed r238111: <https://trac.webkit.org/changeset/238111>
WebKit Commit Bot
Comment 15 2018-11-12 15:18:53 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 16 2018-11-12 15:19:24 PST
Note You need to log in before you can comment on or make changes to this bug.