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

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: merge Created 4 years, 9 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
« no previous file with comments | « android_webview/native/cookie_manager.cc ('k') | chrome/browser/io_thread.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 85936951205d45c6c8b10acf9b4520fde65187a1..223fd0cd9a0824d4ae4aa76db0df698b3a80c376 100644
--- a/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
+++ b/chrome/browser/browsing_data/browsing_data_remover_unittest.cc
@@ -343,8 +343,8 @@ class RemoveCookieTester {
}
protected:
- void SetMonster(net::CookieStore* monster) {
- cookie_store_ = monster;
+ void SetCookieStore(net::CookieStore* cookie_store) {
+ cookie_store_ = cookie_store;
}
private:
@@ -365,11 +365,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()
@@ -380,13 +387,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() {
« no previous file with comments | « android_webview/native/cookie_manager.cc ('k') | chrome/browser/io_thread.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698