#include "base/android/jni_array.h"
#include "base/android/jni_string.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/favicon/chrome_favicon_client.h"
+#include "chrome/browser/favicon/chrome_favicon_client_factory.h"
#include "chrome/browser/favicon/favicon_service.h"
#include "chrome/browser/history/android/android_history_provider_service.h"
#include "chrome/browser/history/android/android_history_types.h"
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
scoped_ptr<AndroidHistoryProviderService> service_;
- CancelableRequestConsumer cancelable_consumer_;
+ base::CancelableTaskTracker cancelable_tracker_;
TestingProfile* testing_profile_;
HistoryService* hs_;
return statement_;
}
- void OnInserted(AndroidHistoryProviderService::Handle handle,
- bool success,
- int64 id) {
- success_ = success;
+ void OnInserted(int64 id) {
+ success_ = id != 0;
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();
}
scoped_refptr<CallbackHelper> callback(new CallbackHelper());
// Insert a row and verify it succeeded.
- service_->InsertHistoryAndBookmark(row, &cancelable_consumer_,
- Bind(&CallbackHelper::OnInserted, callback.get()));
+ service_->InsertHistoryAndBookmark(
+ row,
+ Bind(&CallbackHelper::OnInserted, callback.get()),
+ &cancelable_tracker_);
base::MessageLoop::current()->Run();
EXPECT_TRUE(callback->success());
projections.push_back(HistoryAndBookmarkRow::FAVICON);
// 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());
column_names.push_back(HistoryAndBookmarkRow::GetAndroidName(
HistoryAndBookmarkRow::FAVICON));
- FaviconService* favicon_service = new FaviconService(testing_profile_);
+ FaviconClient* favicon_client =
+ ChromeFaviconClientFactory::GetForProfile(testing_profile_);
+ FaviconService* favicon_service =
+ new FaviconService(testing_profile_, favicon_client);
SQLiteCursor* cursor = new SQLiteCursor(column_names, statement,
service_.get(), favicon_service);