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

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

Issue 1198373002: Split HistoryClient in two objects (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@1192403002
Patch Set: Add comments in ChromeHistoryBackendClient Created 5 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/android/android_provider_backend_unittest.cc
diff --git a/chrome/browser/history/android/android_provider_backend_unittest.cc b/chrome/browser/history/android/android_provider_backend_unittest.cc
index 075b616d6c94d7ecfe545114571b9d692f05c40e..8795a260fd5dbce07bcc104843586a0df503cfce 100644
--- a/chrome/browser/history/android/android_provider_backend_unittest.cc
+++ b/chrome/browser/history/android/android_provider_backend_unittest.cc
@@ -23,6 +23,7 @@
#include "components/bookmarks/test/bookmark_test_helpers.h"
#include "components/history/core/browser/android/android_time.h"
#include "components/history/core/browser/history_backend.h"
+#include "components/history/core/browser/history_backend_client.h"
#include "components/history/core/browser/history_constants.h"
#include "components/history/core/browser/history_database_params.h"
#include "components/history/core/browser/keyword_search_term.h"
@@ -181,6 +182,7 @@ class AndroidProviderBackendTest : public testing::Test {
testing_profile->CreateBookmarkModel(true);
bookmark_model_ = BookmarkModelFactory::GetForProfile(testing_profile);
history_client_.reset(new ChromeHistoryClient(bookmark_model_));
+ history_backend_client_ = history_client_->CreateBackendClient();
bookmarks::test::WaitForBookmarkModelToLoad(bookmark_model_);
ASSERT_TRUE(bookmark_model_);
@@ -252,6 +254,7 @@ class AndroidProviderBackendTest : public testing::Test {
content::TestBrowserThread ui_thread_;
content::TestBrowserThread file_thread_;
scoped_ptr<history::HistoryClient> history_client_;
+ scoped_ptr<history::HistoryBackendClient> history_backend_client_;
DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackendTest);
};
@@ -286,9 +289,9 @@ TEST_F(AndroidProviderBackendTest, UpdateTables) {
// HistoryBackend will shutdown after that.
{
scoped_refptr<HistoryBackend> history_backend;
- history_backend =
- new HistoryBackend(new AndroidProviderBackendDelegate(),
- history_client_.get(), message_loop_.task_runner());
+ history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(),
+ history_client_->CreateBackendClient(),
+ message_loop_.task_runner());
history_backend->Init(std::string(), false,
TestHistoryDatabaseParamsForPath(temp_dir_.path()));
history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED);
@@ -319,7 +322,7 @@ TEST_F(AndroidProviderBackendTest, UpdateTables) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
ASSERT_TRUE(backend->EnsureInitializedAndUpdated());
@@ -425,9 +428,9 @@ TEST_F(AndroidProviderBackendTest, QueryHistoryAndBookmarks) {
// HistoryBackend will shutdown after that.
{
scoped_refptr<HistoryBackend> history_backend;
- history_backend =
- new HistoryBackend(new AndroidProviderBackendDelegate(),
- history_client_.get(), message_loop_.task_runner());
+ history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(),
+ history_client_->CreateBackendClient(),
+ message_loop_.task_runner());
history_backend->Init(std::string(), false,
TestHistoryDatabaseParamsForPath(temp_dir_.path()));
history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED);
@@ -460,7 +463,7 @@ TEST_F(AndroidProviderBackendTest, QueryHistoryAndBookmarks) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
std::vector<HistoryAndBookmarkRow::ColumnID> projections;
@@ -549,7 +552,7 @@ TEST_F(AndroidProviderBackendTest, InsertHistoryAndBookmark) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
ASSERT_TRUE(backend->InsertHistoryAndBookmark(row1));
@@ -661,7 +664,7 @@ TEST_F(AndroidProviderBackendTest, DeleteHistoryAndBookmarks) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
ASSERT_TRUE(backend->InsertHistoryAndBookmark(row1));
@@ -760,7 +763,7 @@ TEST_F(AndroidProviderBackendTest, IsValidHistoryAndBookmarkRow) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
// The created time and last visit time are too close to have required visit
@@ -853,7 +856,7 @@ TEST_F(AndroidProviderBackendTest, UpdateURL) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
AndroidURLID id1 = backend->InsertHistoryAndBookmark(row1);
@@ -1035,7 +1038,7 @@ TEST_F(AndroidProviderBackendTest, UpdateVisitCount) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
AndroidURLID id1 = backend->InsertHistoryAndBookmark(row1);
@@ -1118,7 +1121,7 @@ TEST_F(AndroidProviderBackendTest, UpdateLastVisitTime) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
AndroidURLID id1 = backend->InsertHistoryAndBookmark(row1);
@@ -1182,7 +1185,7 @@ TEST_F(AndroidProviderBackendTest, UpdateFavicon) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
AndroidURLID id1 = backend->InsertHistoryAndBookmark(row1);
@@ -1250,7 +1253,7 @@ TEST_F(AndroidProviderBackendTest, UpdateSearchTermTable) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
// Insert a keyword search item to verify if the update succeeds.
HistoryAndBookmarkRow row1;
@@ -1331,7 +1334,7 @@ TEST_F(AndroidProviderBackendTest, QuerySearchTerms) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
// Insert a keyword search item to verify if we can find it.
HistoryAndBookmarkRow row1;
@@ -1368,7 +1371,7 @@ TEST_F(AndroidProviderBackendTest, UpdateSearchTerms) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
// Insert a keyword.
HistoryAndBookmarkRow row1;
@@ -1475,7 +1478,7 @@ TEST_F(AndroidProviderBackendTest, DeleteSearchTerms) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
// Insert a keyword.
HistoryAndBookmarkRow row1;
@@ -1584,7 +1587,7 @@ TEST_F(AndroidProviderBackendTest, InsertSearchTerm) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
SearchRow search_row;
search_row.set_search_term(UTF8ToUTF16("google"));
@@ -1641,7 +1644,7 @@ TEST_F(AndroidProviderBackendTest, DeleteHistory) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
AndroidURLID id1 = backend->InsertHistoryAndBookmark(row1);
@@ -1697,7 +1700,7 @@ TEST_F(AndroidProviderBackendTest, TestMultipleNestingTransaction) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
// Create the nested transactions.
@@ -1750,7 +1753,7 @@ TEST_F(AndroidProviderBackendTest, TestAndroidCTSComplianceForZeroVisitCount) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
URLRow url_row(GURL("http://www.google.com"));
url_row.set_last_visit(Time::Now());
@@ -1790,7 +1793,7 @@ TEST_F(AndroidProviderBackendTest, AndroidCTSComplianceFolderColumnExists) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
&thumbnail_db_,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
HistoryAndBookmarkRow row1;
row1.set_raw_url("cnn.com");
@@ -1863,9 +1866,9 @@ TEST_F(AndroidProviderBackendTest, QueryWithoutThumbnailDB) {
// HistoryBackend will shutdown after that.
{
scoped_refptr<HistoryBackend> history_backend;
- history_backend =
- new HistoryBackend(new AndroidProviderBackendDelegate(),
- history_client_.get(), message_loop_.task_runner());
+ history_backend = new HistoryBackend(new AndroidProviderBackendDelegate(),
+ history_client_->CreateBackendClient(),
+ message_loop_.task_runner());
history_backend->Init(std::string(), false,
TestHistoryDatabaseParamsForPath(temp_dir_.path()));
history_backend->AddVisits(url1, visits1, history::SOURCE_SYNCED);
@@ -1900,7 +1903,7 @@ TEST_F(AndroidProviderBackendTest, QueryWithoutThumbnailDB) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
NULL,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
std::vector<HistoryAndBookmarkRow::ColumnID> projections;
@@ -1973,7 +1976,7 @@ TEST_F(AndroidProviderBackendTest, InsertWithoutThumbnailDB) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
NULL,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
ASSERT_TRUE(backend->InsertHistoryAndBookmark(row1));
@@ -2040,7 +2043,7 @@ TEST_F(AndroidProviderBackendTest, DeleteWithoutThumbnailDB) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db,
&thumbnail_db,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
ASSERT_TRUE(backend->InsertHistoryAndBookmark(row1));
@@ -2058,7 +2061,7 @@ TEST_F(AndroidProviderBackendTest, DeleteWithoutThumbnailDB) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
NULL,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
// Delete all rows.
@@ -2116,7 +2119,7 @@ TEST_F(AndroidProviderBackendTest, UpdateFaviconWithoutThumbnail) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db,
&thumbnail_db,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
AndroidURLID id1 = backend->InsertHistoryAndBookmark(row1);
@@ -2128,7 +2131,7 @@ TEST_F(AndroidProviderBackendTest, UpdateFaviconWithoutThumbnail) {
new AndroidProviderBackend(android_cache_db_name_,
&history_db_,
NULL,
- history_client_.get(),
+ history_backend_client_.get(),
&notifier_));
int update_count;
« no previous file with comments | « chrome/browser/history/android/android_provider_backend.cc ('k') | chrome/browser/history/chrome_history_backend_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698