Commit 51a9d86f authored by tfarina's avatar tfarina Committed by Commit bot

Move TestBookmarkClient into bookmarks namespace.

BUG=370433
TEST=None
R=sky@chromium.org
TBR=joaodasilva@chromium.org

Review URL: https://codereview.chromium.org/562693002

Cr-Commit-Position: refs/heads/master@{#294329}
parent a558100b
......@@ -72,7 +72,7 @@ class BookmarkProviderTest : public testing::Test {
protected:
virtual void SetUp() OVERRIDE;
test::TestBookmarkClient client_;
bookmarks::TestBookmarkClient client_;
scoped_ptr<TestingProfile> profile_;
scoped_ptr<BookmarkModel> model_;
scoped_refptr<BookmarkProvider> provider_;
......
......@@ -24,9 +24,6 @@
#include "chrome/browser/history/top_sites.h"
#include "chrome/test/base/testing_profile.h"
#include "chrome/tools/profiles/thumbnail-inl.h"
#include "components/bookmarks/browser/bookmark_model.h"
#include "components/bookmarks/browser/bookmark_utils.h"
#include "components/bookmarks/test/test_bookmark_client.h"
#include "components/history/core/common/thumbnail_score.h"
#include "components/history/core/test/history_client_fake_bookmarks.h"
#include "content/public/test/test_browser_thread.h"
......
......@@ -13,7 +13,7 @@ using base::ASCIIToUTF16;
namespace {
TEST(BookmarkEditorTest, ApplyEditsWithNoFolderChange) {
test::TestBookmarkClient client;
bookmarks::TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
const BookmarkNode* bookmarkbar = model->bookmark_bar_node();
model->AddURL(bookmarkbar, 0, ASCIIToUTF16("url0"), GURL("chrome://newtab"));
......
......@@ -17,7 +17,7 @@ using base::ASCIIToUTF16;
namespace {
TEST(BookmarkUIUtilsTest, HasBookmarkURLs) {
test::TestBookmarkClient client;
bookmarks::TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
std::vector<const BookmarkNode*> nodes;
......@@ -59,7 +59,7 @@ TEST(BookmarkUIUtilsTest, HasBookmarkURLs) {
}
TEST(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) {
test::TestBookmarkClient client;
bookmarks::TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
TestingProfile profile;
......
......@@ -224,7 +224,7 @@ class BookmarkCodecTest : public testing::Test {
CheckIDs(model->mobile_node(), &assigned_ids);
}
test::TestBookmarkClient client_;
TestBookmarkClient client_;
};
TEST_F(BookmarkCodecTest, ChecksumEncodeDecodeTest) {
......
......@@ -44,7 +44,7 @@ class BookmarkExpandedStateTrackerTest : public testing::Test {
virtual void TearDown() OVERRIDE;
base::MessageLoop message_loop_;
test::TestBookmarkClient client_;
TestBookmarkClient client_;
scoped_ptr<PrefService> prefs_;
scoped_ptr<BookmarkModel> model_;
......
......@@ -26,7 +26,7 @@ namespace {
const char kAboutBlankURL[] = "about:blank";
class BookmarkClientMock : public test::TestBookmarkClient {
class BookmarkClientMock : public TestBookmarkClient {
public:
BookmarkClientMock(const std::map<GURL, int>& typed_count_map)
: typed_count_map_(typed_count_map) {}
......@@ -132,7 +132,7 @@ class BookmarkIndexTest : public testing::Test {
}
protected:
test::TestBookmarkClient client_;
TestBookmarkClient client_;
scoped_ptr<BookmarkModel> model_;
private:
......
......@@ -38,6 +38,7 @@ class BookmarkIndex;
class BookmarkLoadDetails;
class BookmarkStorage;
class ScopedGroupBookmarkActions;
class TestBookmarkClient;
struct BookmarkMatch;
}
......@@ -45,10 +46,6 @@ namespace favicon_base {
struct FaviconImageResult;
}
namespace test {
class TestBookmarkClient;
}
// BookmarkModel --------------------------------------------------------------
// BookmarkModel provides a directed acyclic graph of URLs and folders.
......@@ -289,7 +286,7 @@ class BookmarkModel : public KeyedService {
friend class bookmarks::BookmarkCodecTest;
friend class bookmarks::BookmarkStorage;
friend class bookmarks::ScopedGroupBookmarkActions;
friend class test::TestBookmarkClient;
friend class bookmarks::TestBookmarkClient;
// Used to order BookmarkNodes by URL.
class NodeURLComparator {
......
......@@ -32,6 +32,7 @@ using base::ASCIIToUTF16;
using base::Time;
using base::TimeDelta;
namespace bookmarks {
namespace {
// Test cases used to test the removal of extra whitespace when adding
......@@ -293,7 +294,7 @@ class BookmarkModelTest : public testing::Test,
}
protected:
test::TestBookmarkClient client_;
TestBookmarkClient client_;
scoped_ptr<BookmarkModel> model_;
ObserverDetails observer_details_;
......@@ -953,7 +954,7 @@ class BookmarkModelTestWithProfile : public testing::Test {
ASSERT_TRUE(ids.insert(it.Next()->id()).second);
}
test::TestBookmarkClient client_;
TestBookmarkClient client_;
scoped_ptr<BookmarkModel> model_;
};
......@@ -1210,3 +1211,4 @@ TEST(BookmarkNodeTest, NodeMetaInfo) {
}
} // namespace
} // namespace bookmarks
......@@ -45,7 +45,7 @@ class BookmarkNodeDataTest : public testing::Test {
private:
base::ScopedTempDir profile_dir_;
test::TestBookmarkClient client_;
TestBookmarkClient client_;
scoped_ptr<BookmarkModel> model_;
scoped_ptr<ui::PlatformEventSource> event_source_;
......
......@@ -74,7 +74,7 @@ class BookmarkUtilsTest : public testing::Test,
};
TEST_F(BookmarkUtilsTest, GetBookmarksMatchingPropertiesWordPhraseQuery) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
const BookmarkNode* node1 = model->AddURL(model->other_node(),
0,
......@@ -132,7 +132,7 @@ TEST_F(BookmarkUtilsTest, GetBookmarksMatchingPropertiesWordPhraseQuery) {
// Check exact matching against a URL query.
TEST_F(BookmarkUtilsTest, GetBookmarksMatchingPropertiesUrl) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
const BookmarkNode* node1 = model->AddURL(model->other_node(),
0,
......@@ -168,7 +168,7 @@ TEST_F(BookmarkUtilsTest, GetBookmarksMatchingPropertiesUrl) {
// Check exact matching against a title query.
TEST_F(BookmarkUtilsTest, GetBookmarksMatchingPropertiesTitle) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
const BookmarkNode* node1 = model->AddURL(model->other_node(),
0,
......@@ -206,7 +206,7 @@ TEST_F(BookmarkUtilsTest, GetBookmarksMatchingPropertiesTitle) {
// Check matching against a query with multiple predicates.
TEST_F(BookmarkUtilsTest, GetBookmarksMatchingPropertiesConjunction) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
const BookmarkNode* node1 = model->AddURL(model->other_node(),
0,
......@@ -258,7 +258,7 @@ TEST_F(BookmarkUtilsTest, GetBookmarksMatchingPropertiesConjunction) {
// Copy and paste is not yet supported on iOS. http://crbug.com/228147
#if !defined(OS_IOS)
TEST_F(BookmarkUtilsTest, CopyPaste) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
const BookmarkNode* node = model->AddURL(model->other_node(),
0,
......@@ -286,7 +286,7 @@ TEST_F(BookmarkUtilsTest, CopyPaste) {
}
TEST_F(BookmarkUtilsTest, CopyPasteMetaInfo) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
const BookmarkNode* node = model->AddURL(model->other_node(),
0,
......@@ -329,7 +329,7 @@ TEST_F(BookmarkUtilsTest, CopyPasteMetaInfo) {
#define MAYBE_CutToClipboard CutToClipboard
#endif
TEST_F(BookmarkUtilsTest, MAYBE_CutToClipboard) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
model->AddObserver(this);
......@@ -355,7 +355,7 @@ TEST_F(BookmarkUtilsTest, MAYBE_CutToClipboard) {
}
TEST_F(BookmarkUtilsTest, PasteNonEditableNodes) {
test::TestBookmarkClient client;
TestBookmarkClient client;
// Load a model with an extra node that is not editable.
BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100);
BookmarkPermanentNodeList extra_nodes;
......@@ -384,7 +384,7 @@ TEST_F(BookmarkUtilsTest, PasteNonEditableNodes) {
#endif // !defined(OS_IOS)
TEST_F(BookmarkUtilsTest, GetParentForNewNodes) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
// This tests the case where selection contains one item and that item is a
// folder.
......@@ -426,7 +426,7 @@ TEST_F(BookmarkUtilsTest, GetParentForNewNodes) {
// Verifies that meta info is copied when nodes are cloned.
TEST_F(BookmarkUtilsTest, CloneMetaInfo) {
test::TestBookmarkClient client;
TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
// Add a node containing meta info.
const BookmarkNode* node = model->AddURL(model->other_node(),
......@@ -458,7 +458,7 @@ TEST_F(BookmarkUtilsTest, CloneMetaInfo) {
}
TEST_F(BookmarkUtilsTest, RemoveAllBookmarks) {
test::TestBookmarkClient client;
TestBookmarkClient client;
// Load a model with an extra node that is not editable.
BookmarkPermanentNode* extra_node = new BookmarkPermanentNode(100);
BookmarkPermanentNodeList extra_nodes;
......
......@@ -11,7 +11,7 @@
#include "components/bookmarks/browser/bookmark_node.h"
#include "components/bookmarks/browser/bookmark_storage.h"
namespace test {
namespace bookmarks {
TestBookmarkClient::TestBookmarkClient() {}
......@@ -88,4 +88,4 @@ bookmarks::BookmarkPermanentNodeList TestBookmarkClient::LoadExtraNodes(
return extra_nodes.Pass();
}
} // namespace test
} // namespace bookmarks
......@@ -10,9 +10,9 @@
class BookmarkModel;
namespace test {
namespace bookmarks {
class TestBookmarkClient : public bookmarks::BookmarkClient {
class TestBookmarkClient : public BookmarkClient {
public:
TestBookmarkClient();
virtual ~TestBookmarkClient();
......@@ -23,7 +23,7 @@ class TestBookmarkClient : public bookmarks::BookmarkClient {
// Sets the list of extra nodes to be returned by the next call to
// CreateModel() or GetLoadExtraNodesCallback().
void SetExtraNodesToLoad(bookmarks::BookmarkPermanentNodeList extra_nodes);
void SetExtraNodesToLoad(BookmarkPermanentNodeList extra_nodes);
// Returns the current extra_nodes, set via SetExtraNodesToLoad().
const std::vector<BookmarkPermanentNode*>& extra_nodes() {
......@@ -37,27 +37,27 @@ class TestBookmarkClient : public bookmarks::BookmarkClient {
bool IsAnExtraNode(const BookmarkNode* node);
private:
// bookmarks::BookmarkClient:
// BookmarkClient:
virtual bool IsPermanentNodeVisible(
const BookmarkPermanentNode* node) OVERRIDE;
virtual void RecordAction(const base::UserMetricsAction& action) OVERRIDE;
virtual bookmarks::LoadExtraCallback GetLoadExtraNodesCallback() OVERRIDE;
virtual LoadExtraCallback GetLoadExtraNodesCallback() OVERRIDE;
virtual bool CanSetPermanentNodeTitle(
const BookmarkNode* permanent_node) OVERRIDE;
virtual bool CanSyncNode(const BookmarkNode* node) OVERRIDE;
virtual bool CanBeEditedByUser(const BookmarkNode* node) OVERRIDE;
// Helpers for GetLoadExtraNodesCallback().
static bookmarks::BookmarkPermanentNodeList LoadExtraNodes(
bookmarks::BookmarkPermanentNodeList extra_nodes,
static BookmarkPermanentNodeList LoadExtraNodes(
BookmarkPermanentNodeList extra_nodes,
int64* next_id);
bookmarks::BookmarkPermanentNodeList extra_nodes_to_load_;
BookmarkPermanentNodeList extra_nodes_to_load_;
std::vector<BookmarkPermanentNode*> extra_nodes_;
DISALLOW_COPY_AND_ASSIGN(TestBookmarkClient);
};
} // namespace test
} // namespace bookmarks
#endif // COMPONENTS_BOOKMARKS_TEST_TEST_BOOKMARK_CLIENT_H_
......@@ -26,7 +26,7 @@ class EnhancedBookmarkModelTest : public testing::Test {
virtual ~EnhancedBookmarkModelTest() {}
virtual void SetUp() OVERRIDE {
test::TestBookmarkClient bookmark_client;
bookmarks::TestBookmarkClient bookmark_client;
bookmark_model_.reset(bookmark_client.CreateModel().release());
model_.reset(new enhanced_bookmarks::EnhancedBookmarkModel(
bookmark_model_.get(), "v1.0"));
......
......@@ -9,6 +9,8 @@
#include "components/enhanced_bookmarks/enhanced_bookmark_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
using bookmarks::TestBookmarkClient;
namespace {
const GURL bookmark_url("http://example.com/index.html");
......@@ -33,7 +35,7 @@ class EnhancedBookmarkUtilsTest : public testing::Test {
};
TEST_F(EnhancedBookmarkUtilsTest, TestBookmarkSearch) {
test::TestBookmarkClient bookmark_client;
TestBookmarkClient bookmark_client;
scoped_ptr<BookmarkModel> bookmark_model(bookmark_client.CreateModel());
const BookmarkNode* node1 = AddBookmark(bookmark_model.get(), "john hopkins");
const BookmarkNode* node2 = AddBookmark(bookmark_model.get(), "JohN hopkins");
......
......@@ -162,7 +162,7 @@ class ManagedBookmarksTrackerTest : public testing::Test {
base::MessageLoop loop_;
TestingPrefServiceSimple prefs_;
test::TestBookmarkClient client_;
bookmarks::TestBookmarkClient client_;
scoped_ptr<BookmarkModel> model_;
bookmarks::MockBookmarkModelObserver observer_;
BookmarkPermanentNode* managed_node_;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment