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

Unified Diff: chrome/browser/history/redirect_browsertest.cc

Issue 349153006: Port HistoryService::QueryRedirects{From,To} to CancelableTaskTracker (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase Created 6 years, 6 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/history/redirect_browsertest.cc
diff --git a/chrome/browser/history/redirect_browsertest.cc b/chrome/browser/history/redirect_browsertest.cc
index 4089392d138044ec33e2b8522c3bb8762fc609be..02620c9655916fc5f299aaf4b79fc1f288a2221c 100644
--- a/chrome/browser/history/redirect_browsertest.cc
+++ b/chrome/browser/history/redirect_browsertest.cc
@@ -15,6 +15,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task/cancelable_task_tracker.h"
#include "base/test/test_timeouts.h"
#include "base/threading/platform_thread.h"
#include "chrome/browser/history/history_service.h"
@@ -46,28 +47,25 @@ class RedirectTest : public InProcessBrowserTest {
// that it's done: OnRedirectQueryComplete.
std::vector<GURL> rv;
history_service->QueryRedirectsFrom(
- url, &consumer_,
+ url,
base::Bind(&RedirectTest::OnRedirectQueryComplete,
- base::Unretained(this), &rv));
+ base::Unretained(this),
+ &rv),
+ &tracker_);
content::RunMessageLoop();
return rv;
}
protected:
- void OnRedirectQueryComplete(
- std::vector<GURL>* rv,
- HistoryService::Handle request_handle,
- GURL from_url,
- bool success,
- history::RedirectList* redirects) {
- for (size_t i = 0; i < redirects->size(); ++i)
- rv->push_back(redirects->at(i));
+ void OnRedirectQueryComplete(std::vector<GURL>* rv,
+ const history::RedirectList* redirects) {
+ rv->insert(rv->end(), redirects->begin(), redirects->end());
base::MessageLoop::current()->PostTask(FROM_HERE,
base::MessageLoop::QuitClosure());
}
- // Consumer for asynchronous history queries.
- CancelableRequestConsumer consumer_;
+ // Tracker for asynchronous history queries.
+ base::CancelableTaskTracker tracker_;
};
// Tests a single server redirect
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/safe_browsing/download_protection_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698