New issue
Advanced search Search tips

Issue 770269 link

Starred by 0 users

Issue metadata

Status: Fixed
Owner:
Closed: Feb 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Callback tests for cookies not implemented on non-CookieMonster CookieStore implementations

Project Member Reported by rdsmith@chromium.org, Sep 29 2017

Issue description

In the course of investigating issue 761319 I realized that there were two problems with the current cookie implementation:

* The tests for AddCallbackForCookie are only for CookieMonster, but there's an implementation of that function in both AndroidWebview and iOS.  The tests should be moved to cookie store tests and any bugs fixed.

* I believe (haven't checked) that the use after free bug surfaced in issue 761319 exists in AndroidWebview as well (but only for AddCallbackForCookie, which isn't surfacing this problem), so a similar fix as that for CookieMonster will need to be applied there.  I think (tests aren't run, so am not sure) that iOS doesn't have the problem because it does synchronous callbacks.


 
Cc: reillyg@chromium.org
Owner: ----
Status: Available (was: Assigned)
+reillyg FYI--I don't think this really matters, but when you modify Android Webview you might want to have solid tests, which would suggest fixing this.

Cc: pwnall@chromium.org

Comment 3 by pwnall@chromium.org, Feb 20 2018

Thanks for cc-ing me on this. I added the bug reference to https://crrev.com/c/925694
Project Member

Comment 4 by bugdroid1@chromium.org, Feb 21 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/f8cb27d6e3051319643aef24c79cd94db0b52aa1

commit f8cb27d6e3051319643aef24c79cd94db0b52aa1
Author: Victor Costan <pwnall@chromium.org>
Date: Wed Feb 21 09:16:23 2018

Cookie Store: Revamp change observation tests.

//net/cookies/cookie_store_unittest.h contains tests against the
net::CookieStore interface, which is implemented by net::CookieMonster
(in //net/cookies), android_webview::AwCookieStoreWrapper (in
//android_webview/browser/net), and net::CookieStoreIOS and
net::CookieStoreIOSPersistent (in //ios/net/cookies).

Currently, the tests for net::CookieStore::AddCallbackForCookie() are in
//net/cookies/cookie_monster_unittest.cc, so they are not run against
the other net::CookieStore implementations. This is highly undesirable,
as it opens up the possibility for bugs to creep into the other
implementations.

This CL takes the following steps to fix this situation:

1) Move AddCallbackForCookie() tests from cookie_monster_unittest.h to a
   new header file, cooie_store_change_unittest.h.
2) Move AddCallbackForAllChange() tests from cookie_store_unittest.h to
   to the same new new header file, cooie_store_change_unittest.h.
3) Harmonize test styles.
4) Sync the tests for AddCallbackForCookie() with the tests for
   AllCallbackForAllChanges(), so they have the same coverage. This
   results in new tests for both cases.
5) Add more tests covering the change filtering in AddCallbackForCookie().
6) Fix the bugs uncovered by running the tests against
   AwCookieStoreWrapper.

The iOS cookie store implementations will be fixed in a separate CL.

Bug: 729800,  770269 
Cq-Include-Trybots: master.tryserver.chromium.mac:ios-simulator-cronet;master.tryserver.chromium.mac:ios-simulator-full-configs
Change-Id: I10f0a24755a5858d2faa291ef6b855f43a880ec3
Reviewed-on: https://chromium-review.googlesource.com/925694
Reviewed-by: David Roger <droger@chromium.org>
Reviewed-by: Randy Smith <rdsmith@chromium.org>
Reviewed-by: Richard Coles <torne@chromium.org>
Commit-Queue: Victor Costan <pwnall@chromium.org>
Cr-Commit-Position: refs/heads/master@{#538047}
[modify] https://crrev.com/f8cb27d6e3051319643aef24c79cd94db0b52aa1/android_webview/browser/net/aw_cookie_store_wrapper.cc
[modify] https://crrev.com/f8cb27d6e3051319643aef24c79cd94db0b52aa1/android_webview/browser/net/aw_cookie_store_wrapper_unittest.cc
[modify] https://crrev.com/f8cb27d6e3051319643aef24c79cd94db0b52aa1/ios/net/cookies/cookie_store_ios_persistent_unittest.mm
[modify] https://crrev.com/f8cb27d6e3051319643aef24c79cd94db0b52aa1/ios/net/cookies/cookie_store_ios_unittest.mm
[modify] https://crrev.com/f8cb27d6e3051319643aef24c79cd94db0b52aa1/net/BUILD.gn
[modify] https://crrev.com/f8cb27d6e3051319643aef24c79cd94db0b52aa1/net/cookies/cookie_monster_unittest.cc
[add] https://crrev.com/f8cb27d6e3051319643aef24c79cd94db0b52aa1/net/cookies/cookie_store_change_unittest.h
[modify] https://crrev.com/f8cb27d6e3051319643aef24c79cd94db0b52aa1/net/cookies/cookie_store_unittest.h

Comment 5 by pwnall@chromium.org, Feb 21 2018

Cc: -pwnall@chromium.org
Owner: pwnall@chromium.org
Status: Fixed (was: Available)
I think I fixed this with the CL above. Please reopen if you disagree.

Sign in to add a comment