Add basic tests for WebEnginePartCookieJar

Authored by stefanocrocco on Sep 17 2018, 12:20 PM.

Description

Add basic tests for WebEnginePartCookieJar

Summary:
Currently, this only tests that cookies are correctly added to
KCookieServer in response to the QWebEngineCookieStore::cookieAdded
signal.

There are some limitations:

  • ideally, to test the correct behaviour of WebEnginePartCookieJar::cookieAdded, one should call QWebEngineCookieStore::setCookie, so that QWebEngineCookieStore processes the cookie and emits the cookieAdded signal as it would in the real application. Unfortunately, in the tests, calling setCookie doesn't trigger the cookieAdded signal. Because of this, I manually emitted the signal. However, this bypasses any processing by the cookie store (such as calling QNetworkCookie::normalize, which I do manually);
  • I don't know how to start a separate instance of the Cookie Server service, so the tests use the default one. This has two drawbacks: it's impossible to start with a clean state and the tests pollute the user's configuration (this second issue could be avoided by adding clean up code to each test)

Reviewers: dfaure

Reviewed By: dfaure

Differential Revision: https://phabricator.kde.org/D15381

Details

Committed
stefanocroccoSep 23 2018, 9:59 AM
Reviewer
dfaure
Differential Revision
D15381: Add basic tests for WebEnginePartCookieJar
Parents
R226:8b0406081fe4: Fix minor EBN issues and minor porting
Branches
Unknown
Tags
Unknown