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

Unified Diff: chrome/browser/fast_shutdown_interactive_uitest.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
Index: chrome/browser/fast_shutdown_interactive_uitest.cc
===================================================================
--- chrome/browser/fast_shutdown_interactive_uitest.cc (revision 96178)
+++ chrome/browser/fast_shutdown_interactive_uitest.cc (working copy)
@@ -2,8 +2,10 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/bind.h"
#include "base/file_path.h"
#include "base/stl_util.h"
+#include "base/synchronization/waitable_event.h"
#include "base/test/test_timeouts.h"
#include "base/test/thread_test_helper.h"
#include "chrome/app/chrome_command_ids.h"
@@ -42,6 +44,14 @@
#define HERE(x)
#endif
erikwright (departed) 2011/08/19 18:13:05 This test fails in a racy way due to a failure to
Randy Smith (Not in Mondays) 2011/08/19 21:40:05 Sounds good (I presume this is the test fix you me
erikwright (departed) 2011/09/06 17:34:45 As it turns out, the test could be simplified to n
+void LoadCookiesCallback(
+ base::WaitableEvent* event,
+ std::vector<net::CookieMonster::CanonicalCookie*>* cookies,
+ const std::vector<net::CookieMonster::CanonicalCookie*>& cookies_get) {
+ *cookies = cookies_get;
+ event->Signal();
+}
+
// Loads the cookie store from |user_data_dir|. If the given |cookie| exists,
// puts the cookie's value in |cookie_value| and sets |has_cookie| to true.
// Sets |has_cookie| to false if the |cookie| wasn't found.
@@ -57,7 +67,11 @@
.Append(chrome::kCookieFilename)));
HERE(1);
std::vector<net::CookieMonster::CanonicalCookie*> cookies;
- ASSERT_TRUE(cookie_store->Load(&cookies));
+ base::WaitableEvent event(false, false);
+ ASSERT_TRUE(cookie_store->Load(base::Bind(&LoadCookiesCallback,
+ base::Unretained(&event),
+ base::Unretained(&cookies))));
+ event.Wait();
HERE(2);
*has_cookie = false;
for (size_t i = 0; i < cookies.size(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698