Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Unified Diff: chrome/browser/browsing_data/browsing_data_remover_unittest.cc

Issue 1701063002: CookieStore: Remove reference counting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@threadsafe
Patch Set: Fix includes Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/browsing_data/browsing_data_remover_unittest.cc
diff --git a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
index 782bb05f26f3cb4dcbd95b0e2e7de646ce351724..0a3b7647bfbe6d8061a175f5968d8a2cc332735f 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -376,8 +376,8 @@ class RemoveCookieTester {
}
protected:
- void SetMonster(net::CookieStore* monster) {
- cookie_store_ = monster;
+ void SetCookieStore(net::CookieStore* cookie_store) {
+ cookie_store_ = cookie_store;
}
private:
@@ -398,11 +398,18 @@ class RemoveCookieTester {
bool get_cookie_success_ = false;
base::Closure quit_closure_;
+
+ // CookieStore must out live |this|.
net::CookieStore* cookie_store_ = nullptr;
DISALLOW_COPY_AND_ASSIGN(RemoveCookieTester);
};
+void RunClosureAfterCookiesCleared(const base::Closure& task,
+ int cookies_deleted) {
+ task.Run();
+}
+
class RemoveSafeBrowsingCookieTester : public RemoveCookieTester {
public:
RemoveSafeBrowsingCookieTester()
@@ -413,13 +420,16 @@ class RemoveSafeBrowsingCookieTester : public RemoveCookieTester {
sb_service->Initialize();
base::MessageLoop::current()->RunUntilIdle();
- // Create a cookiemonster that does not have persistant storage, and replace
- // the SafeBrowsingService created one with it.
- net::CookieStore* monster =
- content::CreateCookieStore(content::CookieStoreConfig());
- sb_service->url_request_context()->GetURLRequestContext()->
- set_cookie_store(monster);
- SetMonster(monster);
+ // Make sure the safe browsing cookie store has no cookies.
+ // TODO(mmenke): Is this really needed?
+ base::RunLoop run_loop;
+ net::URLRequestContext* request_context =
+ sb_service->url_request_context()->GetURLRequestContext();
+ request_context->cookie_store()->DeleteAllAsync(
+ base::Bind(&RunClosureAfterCookiesCleared, run_loop.QuitClosure()));
+ run_loop.Run();
+
+ SetCookieStore(request_context->cookie_store());
}
virtual ~RemoveSafeBrowsingCookieTester() {

Powered by Google App Engine
This is Rietveld 408576698