Bug 91639

Summary: [EFL][WK2] Add unit tests for Ewk_Cookie_Manager
Product: WebKit Reporter: Chris Dumez <cdumez>
Component: WebKit EFLAssignee: Chris Dumez <cdumez>
Status: RESOLVED FIXED    
Severity: Normal CC: danw, gyuyoung.kim, gyuyoung.kim, kenneth, lucas.de.marchi, rakuco, ryuan.choi, sw0524.lee, tmpsantos, tonikitoo, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 91647, 91741, 91747    
Bug Blocks: 91345    
Attachments:
Description Flags
Patch
gyuyoung.kim: commit-queue-
Patch
none
Patch
none
Patch
none
Patch
none
Patch
tonikitoo: review+
Patch for landing none

Chris Dumez
Reported 2012-07-18 10:32:58 PDT
We need to add unit tests for Ewk_Cookie_Manager.
Attachments
Patch (17.77 KB, patch)
2012-07-18 11:24 PDT, Chris Dumez
gyuyoung.kim: commit-queue-
Patch (17.77 KB, patch)
2012-07-18 13:29 PDT, Chris Dumez
no flags
Patch (17.79 KB, patch)
2012-07-18 23:46 PDT, Chris Dumez
no flags
Patch (18.52 KB, patch)
2012-07-19 07:34 PDT, Chris Dumez
no flags
Patch (18.65 KB, patch)
2012-07-20 00:33 PDT, Chris Dumez
no flags
Patch (18.65 KB, patch)
2012-07-20 01:18 PDT, Chris Dumez
tonikitoo: review+
Patch for landing (18.97 KB, patch)
2012-07-23 12:04 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2012-07-18 11:24:05 PDT
Gyuyoung Kim
Comment 2 2012-07-18 11:38:02 PDT
Chris Dumez
Comment 3 2012-07-18 13:29:24 PDT
Created attachment 153077 [details] Patch Reuploading the same patch again to make ewk-efl happy, now that the dependency landed.
Gyuyoung Kim
Comment 4 2012-07-18 18:43:36 PDT
Comment on attachment 153077 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153077&action=review > Source/WebKit2/PlatformEfl.cmake:7 > + ${CAIRO_LIBRARIES} This one should be changed CAIRO_LIBRARIES with CAIRO_LDFLAGS. > Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp:50 > + gchar* uriString = soup_uri_to_string(uri, FALSE); Should we use gchar ? I think we avoid to use glib type in EFL port, if possible. > Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.h:29 > + Nit: Unneeded line.
Chris Dumez
Comment 5 2012-07-18 23:46:54 PDT
Created attachment 153188 [details] Patch Take Gyuyoung's feedback into consideration.
Thiago Marcos P. Santos
Comment 6 2012-07-19 02:20:22 PDT
Comment on attachment 153188 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153188&action=review One final consideration: I can see that you are using a lot of ASSERT_EQ. They are all "fatal" exceptions and will stop that particular test block in case it is hit. If the the tests on the block don't depend on each other, I recommend using EXPECT_* instead. If you did it on purpose, just ignore this comment. > Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp:51 > + CString ret = uriString; WebKit doesn't like variables named "ret". You should use something more descriptive. > Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:68 > + ASSERT(!error); Use gtest assertions (i.e. ASSERT_TRUE/ASSERT_FALSE) on the test. Otherwise you wont get this error when testing a release build. > Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:84 > + ASSERT(!error); Ditto. > Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:120 > + g_type_init(); > + ecore_main_loop_glib_integrate(); This would be a nice addition for the fixture SetUp(). > Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:126 > + ASSERT(cookieManager); Use gtest fatal assertion. > Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:218 > + ASSERT(cookieManager); Use gtest. > Source/WebKit2/UIProcess/API/efl/tests/test_ewk2_cookie_manager.cpp:224 > + ewk_cookie_manager_persistent_storage_set(cookieManager, TMP_COOKIE_FILE_TXT, EWK_COOKIE_PERSISTENT_STORAGE_TEXT); I'm concerned here because we always use the same file name for the cookie storage. This has the following implications: your test might be tainted by a previous run that crashed before the unlink and it will not work when running the same test parallel (i.e. you have 2 build bots on the same machine). A cheap solution for this is to use tempnam() at this test case. Ideally the TestEvironment should provide a temporary directory and cleanup this directory at its teardown. IMO it can be done in another bug.
Chris Dumez
Comment 7 2012-07-19 05:10:00 PDT
Comment on attachment 153188 [details] Patch Clearing flags until I update the patch.
Chris Dumez
Comment 8 2012-07-19 06:53:50 PDT
Well, the good news is that this patch revealed a regression in libsoup v2.39.3 (bumped yesterday). Thankfully, the issue has been resolved with v2.39.4.1 (confirmed with the unit tests) so I'm bumping libsoup again in bug 91741).
Chris Dumez
Comment 9 2012-07-19 07:34:16 PDT
Created attachment 153258 [details] Patch Take Thiago's feedback into consideration.
Thiago Marcos P. Santos
Comment 10 2012-07-19 07:45:21 PDT
Comment on attachment 153258 [details] Patch LGTM. Thanks!
Chris Dumez
Comment 11 2012-07-20 00:33:43 PDT
Created attachment 153436 [details] Patch Rebase on master.
Gyuyoung Kim
Comment 12 2012-07-20 00:45:56 PDT
Comment on attachment 153436 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153436&action=review LGTM except for trivial nit. > Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp:50 > + char* uri = soup_uri_to_string(soupURI, FALSE); nit(?) : is FALSE gtk style ? EFL port have used false so far except for public APIs.
Chris Dumez
Comment 13 2012-07-20 00:47:27 PDT
(In reply to comment #12) > (From update of attachment 153436 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=153436&action=review > > LGTM except for trivial nit. > > > Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp:50 > > + char* uri = soup_uri_to_string(soupURI, FALSE); > > nit(?) : is FALSE gtk style ? EFL port have used false so far except for public APIs. Yes, I missed that one. Will fix it.
Chris Dumez
Comment 14 2012-07-20 01:18:03 PDT
Created attachment 153443 [details] Patch Remove some glib'ism.
Gyuyoung Kim
Comment 15 2012-07-20 01:29:16 PDT
Comment on attachment 153443 [details] Patch LGTM, thanks.
Thiago Marcos P. Santos
Comment 16 2012-07-20 01:41:08 PDT
Comment on attachment 153443 [details] Patch LGTM and the mini webserver is a great addition to the test suite. Thanks.
Chris Dumez
Comment 17 2012-07-20 07:53:06 PDT
All the dependencies have landed, this patch is ready to land.
Antonio Gomes
Comment 18 2012-07-23 11:40:53 PDT
Comment on attachment 153443 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=153443&action=review > Source/WebKit2/ChangeLog:12 > + to indicate that only cookies for the main page are accepted by default. main frame? > Source/WebKit2/UIProcess/API/efl/tests/UnitTestUtils/EWK2UnitTestServer.cpp:58 > +} > + > + nit: extra line
Chris Dumez
Comment 19 2012-07-23 12:04:01 PDT
Created attachment 153829 [details] Patch for landing Fix nits spotted by Antonio.
WebKit Review Bot
Comment 20 2012-07-23 13:26:18 PDT
Comment on attachment 153829 [details] Patch for landing Clearing flags on attachment: 153829 Committed r123372: <http://trac.webkit.org/changeset/123372>
WebKit Review Bot
Comment 21 2012-07-23 13:26:25 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.