Skip to content

Commit

Permalink
Move TestBookmarkClient into bookmarks namespace.
Browse files Browse the repository at this point in the history
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}
  • Loading branch information
tfarina authored and Commit bot committed Sep 11, 2014
1 parent a558100 commit 51a9d86
Show file tree
Hide file tree
Showing 16 changed files with 42 additions and 44 deletions.
2 changes: 1 addition & 1 deletion chrome/browser/autocomplete/bookmark_provider_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down
3 changes: 0 additions & 3 deletions chrome/browser/history/expire_history_backend_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/ui/bookmarks/bookmark_editor_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
4 changes: 2 additions & 2 deletions chrome/browser/ui/bookmarks/bookmark_ui_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -59,7 +59,7 @@ TEST(BookmarkUIUtilsTest, HasBookmarkURLs) {
}

TEST(BookmarkUIUtilsTest, HasBookmarkURLsAllowedInIncognitoMode) {
test::TestBookmarkClient client;
bookmarks::TestBookmarkClient client;
scoped_ptr<BookmarkModel> model(client.CreateModel());
TestingProfile profile;

Expand Down
2 changes: 1 addition & 1 deletion components/bookmarks/browser/bookmark_codec_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ class BookmarkCodecTest : public testing::Test {
CheckIDs(model->mobile_node(), &assigned_ids);
}

test::TestBookmarkClient client_;
TestBookmarkClient client_;
};

TEST_F(BookmarkCodecTest, ChecksumEncodeDecodeTest) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_;

Expand Down
4 changes: 2 additions & 2 deletions components/bookmarks/browser/bookmark_index_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {}
Expand Down Expand Up @@ -132,7 +132,7 @@ class BookmarkIndexTest : public testing::Test {
}

protected:
test::TestBookmarkClient client_;
TestBookmarkClient client_;
scoped_ptr<BookmarkModel> model_;

private:
Expand Down
7 changes: 2 additions & 5 deletions components/bookmarks/browser/bookmark_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,14 @@ class BookmarkIndex;
class BookmarkLoadDetails;
class BookmarkStorage;
class ScopedGroupBookmarkActions;
class TestBookmarkClient;
struct BookmarkMatch;
}

namespace favicon_base {
struct FaviconImageResult;
}

namespace test {
class TestBookmarkClient;
}

// BookmarkModel --------------------------------------------------------------

// BookmarkModel provides a directed acyclic graph of URLs and folders.
Expand Down Expand Up @@ -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 {
Expand Down
6 changes: 4 additions & 2 deletions components/bookmarks/browser/bookmark_model_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -293,7 +294,7 @@ class BookmarkModelTest : public testing::Test,
}

protected:
test::TestBookmarkClient client_;
TestBookmarkClient client_;
scoped_ptr<BookmarkModel> model_;
ObserverDetails observer_details_;

Expand Down Expand Up @@ -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_;
};

Expand Down Expand Up @@ -1210,3 +1211,4 @@ TEST(BookmarkNodeTest, NodeMetaInfo) {
}

} // namespace
} // namespace bookmarks
Original file line number Diff line number Diff line change
Expand Up @@ -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_;

Expand Down
22 changes: 11 additions & 11 deletions components/bookmarks/browser/bookmark_utils_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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);

Expand All @@ -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;
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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(),
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions components/bookmarks/test/test_bookmark_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#include "components/bookmarks/browser/bookmark_node.h"
#include "components/bookmarks/browser/bookmark_storage.h"

namespace test {
namespace bookmarks {

TestBookmarkClient::TestBookmarkClient() {}

Expand Down Expand Up @@ -88,4 +88,4 @@ bookmarks::BookmarkPermanentNodeList TestBookmarkClient::LoadExtraNodes(
return extra_nodes.Pass();
}

} // namespace test
} // namespace bookmarks
18 changes: 9 additions & 9 deletions components/bookmarks/test/test_bookmark_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

class BookmarkModel;

namespace test {
namespace bookmarks {

class TestBookmarkClient : public bookmarks::BookmarkClient {
class TestBookmarkClient : public BookmarkClient {
public:
TestBookmarkClient();
virtual ~TestBookmarkClient();
Expand All @@ -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() {
Expand All @@ -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_
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand All @@ -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");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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_;
Expand Down

0 comments on commit 51a9d86

Please sign in to comment.