Bug 191493 - [Curl] Add API Test for Curl cookie backend.
Summary: [Curl] Add API Test for Curl cookie backend.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: Platform (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Basuke Suzuki
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2018-11-09 16:01 PST by Basuke Suzuki
Modified: 2018-11-12 15:19 PST (History)
6 users (show)

See Also:


Attachments
PATCH (27.20 KB, patch)
2018-11-09 16:17 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff
FIX Style (27.99 KB, patch)
2018-11-09 16:33 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff
Fix (28.02 KB, patch)
2018-11-12 13:28 PST, Basuke Suzuki
youennf: review+
Details | Formatted Diff | Diff
PATCH (29.15 KB, patch)
2018-11-12 14:29 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff
PATCH AGAIN (29.20 KB, patch)
2018-11-12 14:41 PST, Basuke Suzuki
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Basuke Suzuki 2018-11-09 16:01:20 PST
Cleanup Cookie database implementation to make them testable better. Then add unit tests.
Comment 1 Basuke Suzuki 2018-11-09 16:17:13 PST
Created attachment 354405 [details]
PATCH
Comment 2 Basuke Suzuki 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
Comment 3 EWS Watchlist 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.
Comment 4 Basuke Suzuki 2018-11-09 16:33:01 PST
Created attachment 354410 [details]
FIX Style
Comment 5 Alex Christensen 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?
Comment 6 Basuke Suzuki 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.
Comment 7 Basuke Suzuki 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)
Comment 8 youenn fablet 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.
Comment 9 Basuke Suzuki 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
Comment 10 Basuke Suzuki 2018-11-12 14:29:03 PST
Created attachment 354592 [details]
PATCH
Comment 11 Alex Christensen 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.
Comment 12 Basuke Suzuki 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.
Comment 13 Basuke Suzuki 2018-11-12 14:41:13 PST
Created attachment 354594 [details]
PATCH AGAIN
Comment 14 WebKit Commit Bot 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>
Comment 15 WebKit Commit Bot 2018-11-12 15:18:53 PST
All reviewed patches have been landed.  Closing bug.
Comment 16 Radar WebKit Bug Importer 2018-11-12 15:19:24 PST
<rdar://problem/46005812>