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

Unified Diff: chrome/browser/bookmarks/bookmark_index_unittest.cc

Issue 242693003: Introduce BookmarkClient interface to abstract embedder (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase Created 6 years, 8 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/bookmarks/bookmark_index_unittest.cc
diff --git a/chrome/browser/bookmarks/bookmark_index_unittest.cc b/chrome/browser/bookmarks/bookmark_index_unittest.cc
index 057e60894cbf20338588339ab5ae7c97698d90be..b76915ffc6bdc291e346a617c8396f7f23fa433e 100644
--- a/chrome/browser/bookmarks/bookmark_index_unittest.cc
+++ b/chrome/browser/bookmarks/bookmark_index_unittest.cc
@@ -19,6 +19,7 @@
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/history/url_database.h"
#include "chrome/test/base/testing_profile.h"
+#include "components/bookmarks/core/browser/bookmark_client.h"
#include "components/bookmarks/core/browser/bookmark_title_match.h"
#include "content/public/test/test_browser_thread_bundle.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -27,7 +28,7 @@ using base::ASCIIToUTF16;
class BookmarkIndexTest : public testing::Test {
public:
- BookmarkIndexTest() : model_(new BookmarkModel(NULL)) {}
+ BookmarkIndexTest() { ResetBookmarkMarkModel(); }
void AddBookmarksWithTitles(const char** titles, size_t count) {
std::vector<std::string> title_vector;
@@ -102,8 +103,11 @@ class BookmarkIndexTest : public testing::Test {
}
protected:
+ test::TestBookmarkClient client_;
scoped_ptr<BookmarkModel> model_;
+ void ResetBookmarkMarkModel() { model_.reset(client_.CreateModel()); }
+
private:
DISALLOW_COPY_AND_ASSIGN(BookmarkIndexTest);
};
@@ -152,8 +156,7 @@ TEST_F(BookmarkIndexTest, Tests) {
base::SplitString(data[i].expected, ';', &expected);
ExpectMatches(data[i].query, expected);
-
- model_.reset(new BookmarkModel(NULL));
+ ResetBookmarkMarkModel();
}
}
@@ -183,7 +186,7 @@ TEST_F(BookmarkIndexTest, TestNormalization) {
model_->GetBookmarksWithTitlesMatching(
base::UTF8ToUTF16(data[i].query), 10, &matches);
EXPECT_EQ(1u, matches.size());
- model_.reset(new BookmarkModel(NULL));
+ ResetBookmarkMarkModel();
}
}
@@ -213,7 +216,7 @@ TEST_F(BookmarkIndexTest, MatchPositions) {
ExtractMatchPositions(data[i].expected, &expected_matches);
ExpectMatchPositions(data[i].query, expected_matches);
- model_.reset(new BookmarkModel(NULL));
+ ResetBookmarkMarkModel();
}
}

Powered by Google App Engine
This is Rietveld 408576698