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

Unified Diff: chrome/browser/history/android/android_history_provider_service_unittest.cc

Issue 369673009: Change AndroidHistoryProviderService to use CancelableTaskTracker (2/6) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@cancelable_task_tracker.2
Patch Set: Fix unit tests Created 6 years, 5 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/android/android_history_provider_service_unittest.cc
diff --git a/chrome/browser/history/android/android_history_provider_service_unittest.cc b/chrome/browser/history/android/android_history_provider_service_unittest.cc
index 5e434939415be1b208fdc5213124ca2b23c04f3b..64db31c9906a9cbdbb0253aa2e41cbbb8d2926f8 100644
--- a/chrome/browser/history/android/android_history_provider_service_unittest.cc
+++ b/chrome/browser/history/android/android_history_provider_service_unittest.cc
@@ -5,6 +5,7 @@
#include "chrome/browser/history/android/android_history_provider_service.h"
#include "base/strings/utf_string_conversions.h"
+#include "base/task/cancelable_task_tracker.h"
#include "base/time/time.h"
#include "chrome/browser/bookmarks/bookmark_model_factory.h"
#include "chrome/browser/history/android/android_history_types.h"
@@ -71,6 +72,7 @@ class AndroidHistoryProviderServiceTest : public testing::Test {
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
scoped_ptr<AndroidHistoryProviderService> service_;
+ base::CancelableTaskTracker cancelable_tracker_;
CancelableRequestConsumer cancelable_consumer_;
TestingProfile* testing_profile_;
@@ -110,10 +112,8 @@ class CallbackHelper : public base::RefCountedThreadSafe<CallbackHelper> {
base::MessageLoop::current()->Quit();
}
- void OnQueryResult(AndroidHistoryProviderService::Handle handle,
- bool success,
- AndroidStatement* statement) {
- success_ = success;
+ void OnQueryResult(AndroidStatement* statement) {
+ success_ = statement != NULL;
statement_ = statement;
base::MessageLoop::current()->Quit();
}
@@ -171,9 +171,13 @@ TEST_F(AndroidHistoryProviderServiceTest, TestHistoryAndBookmark) {
projections.push_back(HistoryAndBookmarkRow::ID);
// Query the inserted row.
- service_->QueryHistoryAndBookmarks(projections, std::string(),
- std::vector<base::string16>(), std::string(), &cancelable_consumer_,
- Bind(&CallbackHelper::OnQueryResult, callback.get()));
+ service_->QueryHistoryAndBookmarks(
+ projections,
+ std::string(),
+ std::vector<base::string16>(),
+ std::string(),
+ Bind(&CallbackHelper::OnQueryResult, callback.get()),
+ &cancelable_tracker_);
base::MessageLoop::current()->Run();
ASSERT_TRUE(callback->success());
@@ -227,9 +231,13 @@ TEST_F(AndroidHistoryProviderServiceTest, TestSearchTerm) {
projections.push_back(SearchRow::ID);
// Query the inserted row.
- service_->QuerySearchTerms(projections, std::string(),
- std::vector<base::string16>(), std::string(), &cancelable_consumer_,
- Bind(&CallbackHelper::OnQueryResult, callback.get()));
+ service_->QuerySearchTerms(
+ projections,
+ std::string(),
+ std::vector<base::string16>(),
+ std::string(),
+ Bind(&CallbackHelper::OnQueryResult, callback.get()),
+ &cancelable_tracker_);
base::MessageLoop::current()->Run();
ASSERT_TRUE(callback->success());

Powered by Google App Engine
This is Rietveld 408576698