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

Unified Diff: net/cookies/cookie_store_test_callbacks.cc

Issue 1634803004: Convert CookieMonster tests to use base::RunLoop (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add an out-of-line destructor Created 4 years, 11 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: net/cookies/cookie_store_test_callbacks.cc
diff --git a/net/cookies/cookie_store_test_callbacks.cc b/net/cookies/cookie_store_test_callbacks.cc
index 2a8a659e79f3f601f5ac2c610467628051b5dc46..48335fdb319d61c106eb1707fe0e562298459e91 100644
--- a/net/cookies/cookie_store_test_callbacks.cc
+++ b/net/cookies/cookie_store_test_callbacks.cc
@@ -16,15 +16,15 @@ CookieCallback::CookieCallback(base::Thread* run_in_thread)
: did_run_(false),
run_in_thread_(run_in_thread),
run_in_loop_(NULL),
- parent_loop_(base::MessageLoop::current()),
- loop_to_quit_(base::MessageLoop::current()) {}
+ loop_to_quit_(new base::RunLoop) {}
CookieCallback::CookieCallback()
: did_run_(false),
run_in_thread_(NULL),
run_in_loop_(base::MessageLoop::current()),
- parent_loop_(NULL),
- loop_to_quit_(base::MessageLoop::current()) {}
+ loop_to_quit_(new base::RunLoop) {}
mmenke 2016/01/27 16:55:42 nit: Can just replace this with: CookieCallback:
xunjieli 2016/01/27 18:35:02 Hmm.. Not sure if I understand. I don't think I c
mmenke 2016/01/27 18:52:17 No, I'm suggest defining this constructor in terms
xunjieli 2016/01/27 18:54:53 The other constructor takes in a base::Thread, not
mmenke 2016/01/27 21:36:25 Oops...sorry about that.
+
+CookieCallback::~CookieCallback() {}
void CookieCallback::CallbackEpilogue() {
base::MessageLoop* expected_loop = NULL;
@@ -38,8 +38,11 @@ void CookieCallback::CallbackEpilogue() {
did_run_ = true;
EXPECT_EQ(expected_loop, base::MessageLoop::current());
- loop_to_quit_->task_runner()->PostTask(
- FROM_HERE, base::MessageLoop::QuitWhenIdleClosure());
+ loop_to_quit_->Quit();
+}
+
+void CookieCallback::WaitUntilDone() {
+ loop_to_quit_->Run();
}
StringResultCookieCallback::StringResultCookieCallback() {}

Powered by Google App Engine
This is Rietveld 408576698