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

Unified Diff: chrome/browser/search_engines/template_url_service_unittest.cc

Issue 314293005: Change HistoryService::QueryURL to use CancelableTaskTracker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and add comment for scoped_ptr usage 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/search_engines/template_url_service_unittest.cc
diff --git a/chrome/browser/search_engines/template_url_service_unittest.cc b/chrome/browser/search_engines/template_url_service_unittest.cc
index c912fe757274e2c7eebeee78eb0a51eddb64e7da..a330d6c6661f9dc4e8a2928d20e58e91f817771b 100644
--- a/chrome/browser/search_engines/template_url_service_unittest.cc
+++ b/chrome/browser/search_engines/template_url_service_unittest.cc
@@ -11,6 +11,7 @@
#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task/cancelable_task_tracker.h"
#include "base/test/mock_time_provider.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
@@ -68,15 +69,14 @@ std::string TestSearchTermsData::GoogleBaseURLValue() const {
struct QueryHistoryCallbackImpl {
QueryHistoryCallbackImpl() : success(false) {}
- void Callback(HistoryService::Handle handle,
- bool success,
- const history::URLRow* row,
- history::VisitVector* visits) {
+ void Callback(bool success,
+ const history::URLRow& row,
+ const history::VisitVector& visits) {
this->success = success;
- if (row)
- this->row = *row;
- if (visits)
- this->visits = *visits;
+ if (success) {
+ this->row = row;
+ this->visits = visits;
+ }
}
bool success;
@@ -1071,11 +1071,13 @@ TEST_F(TemplateURLServiceTest, GenerateVisitOnKeyword) {
test_util_.profile()->BlockUntilHistoryProcessesPendingRequests();
// Query history for the generated url.
- CancelableRequestConsumer consumer;
+ base::CancelableTaskTracker tracker;
QueryHistoryCallbackImpl callback;
- history->QueryURL(GURL("http://keyword"), true, &consumer,
- base::Bind(&QueryHistoryCallbackImpl::Callback,
- base::Unretained(&callback)));
+ history->QueryURL(GURL("http://keyword"),
+ true,
+ base::Bind(&QueryHistoryCallbackImpl::Callback,
+ base::Unretained(&callback)),
+ &tracker);
// Wait for the request to be processed.
test_util_.profile()->BlockUntilHistoryProcessesPendingRequests();

Powered by Google App Engine
This is Rietveld 408576698