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

Unified Diff: net/url_request/url_request_unittest.cc

Issue 7598001: Remove the old synchronous CookieMonster API. (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 9 years, 4 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
« net/base/cookie_monster.cc ('K') | « net/base/cookie_store.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/url_request/url_request_unittest.cc
===================================================================
--- net/url_request/url_request_unittest.cc (revision 96178)
+++ net/url_request/url_request_unittest.cc (working copy)
@@ -13,6 +13,7 @@
#include <string>
#include "base/basictypes.h"
+#include "base/bind.h"
#include "base/compiler_specific.h"
#include "base/file_util.h"
#include "base/format_macros.h"
@@ -1982,6 +1983,13 @@
}
}
+void CheckCookiePolicyCallback(bool* was_run, const CookieList& cookies) {
+ EXPECT_EQ(1U, cookies.size());
+ EXPECT_FALSE(cookies[0].IsPersistent());
+ *was_run = true;
+ MessageLoop::current()->PostTask(FROM_HERE, new MessageLoop::QuitTask());
+}
+
TEST_F(URLRequestTest, CookiePolicy_ForceSession) {
TestServer test_server(TestServer::TYPE_HTTP, FilePath());
ASSERT_TRUE(test_server.Start());
@@ -2002,10 +2010,11 @@
}
// Now, check the cookie store.
- CookieList cookies =
- default_context_->cookie_store()->GetCookieMonster()->GetAllCookies();
- EXPECT_EQ(1U, cookies.size());
- EXPECT_FALSE(cookies[0].IsPersistent());
+ bool was_run = false;
+ default_context_->cookie_store()->GetCookieMonster()->GetAllCookiesAsync(
+ base::Bind(&CheckCookiePolicyCallback, &was_run));
+ MessageLoop::current()->RunAllPending();
+ DCHECK(was_run);
}
// In this test, we do a POST which the server will 302 redirect.
« net/base/cookie_monster.cc ('K') | « net/base/cookie_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698