diff options
author | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 23:38:06 +0000 |
---|---|---|
committer | sky@google.com <sky@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-10-29 23:38:06 +0000 |
commit | 7f856bee73ffdccdbbbbbab4cb79185290d38359 (patch) | |
tree | a837328e08a113abdc70b2fc0ae2f2a4a3f804eb /chrome/browser/views/bookmark_editor_view_unittest.cc | |
parent | 281fe14063dd8fb81cea102f5abb7b82f407c3d1 (diff) | |
download | chromium_src-7f856bee73ffdccdbbbbbab4cb79185290d38359.zip chromium_src-7f856bee73ffdccdbbbbbab4cb79185290d38359.tar.gz chromium_src-7f856bee73ffdccdbbbbbab4cb79185290d38359.tar.bz2 |
First cut at the bookmark manager. There are still a fair number of
rough edges, but I'm at a good point where I want to land what I
have. Here's what is left:
. Flicker on show, likely the result of restoring window placement.
. tree flickers when dragging splitter.
. table/tree need to autoscroll when drop cursor held at bottom of view.
. prompts for deleting.
. When you move an item the table snaps to the top, this is because
I'm sending out model changed. need a better notification.
. Operations in menu to add need to change selection.
. Remember split location.
I would have preferred to split this up into a couple of reviews, but
everything is intertwined now. Sorry.
BUG=674
TEST=don't test the bookmark manager yet, but make sure bookmark bar
still works.
Review URL: http://codereview.chromium.org/8197
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@4191 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/views/bookmark_editor_view_unittest.cc')
-rw-r--r-- | chrome/browser/views/bookmark_editor_view_unittest.cc | 59 |
1 files changed, 52 insertions, 7 deletions
diff --git a/chrome/browser/views/bookmark_editor_view_unittest.cc b/chrome/browser/views/bookmark_editor_view_unittest.cc index 0a5ed68..24fb05e 100644 --- a/chrome/browser/views/bookmark_editor_view_unittest.cc +++ b/chrome/browser/views/bookmark_editor_view_unittest.cc @@ -79,7 +79,8 @@ class BookmarkEditorViewTest : public testing::Test { // Makes sure the tree model matches that of the bookmark bar model. TEST_F(BookmarkEditorViewTest, ModelsMatch) { - BookmarkEditorView editor(profile_.get(), NULL, NULL); + BookmarkEditorView editor(profile_.get(), NULL, NULL, + BookmarkEditorView::SHOW_TREE); BookmarkEditorView::EditorNode* editor_root = editor.tree_model_->GetRoot(); // The root should have two children, one for the bookmark bar node, // the other for the 'other bookmarks' folder. @@ -103,7 +104,8 @@ TEST_F(BookmarkEditorViewTest, ModelsMatch) { // Changes the title and makes sure parent/visual order doesn't change. TEST_F(BookmarkEditorViewTest, EditTitleKeepsPosition) { - BookmarkEditorView editor(profile_.get(), NULL, GetNode("a")); + BookmarkEditorView editor(profile_.get(), NULL, GetNode("a"), + BookmarkEditorView::SHOW_TREE); editor.title_tf_.SetText(L"new_a"); editor.ApplyEdits(editor.tree_model_->GetRoot()->GetChild(0)); @@ -118,7 +120,8 @@ TEST_F(BookmarkEditorViewTest, EditTitleKeepsPosition) { TEST_F(BookmarkEditorViewTest, EditURLKeepsPosition) { Time node_time = Time::Now() + TimeDelta::FromDays(2); GetNode("a")->date_added_ = node_time; - BookmarkEditorView editor(profile_.get(), NULL, GetNode("a")); + BookmarkEditorView editor(profile_.get(), NULL, GetNode("a"), + BookmarkEditorView::SHOW_TREE); editor.url_tf_.SetText(UTF8ToWide(GURL(base_path() + "new_a").spec())); @@ -133,7 +136,8 @@ TEST_F(BookmarkEditorViewTest, EditURLKeepsPosition) { // Moves 'a' to be a child of the other node. TEST_F(BookmarkEditorViewTest, ChangeParent) { - BookmarkEditorView editor(profile_.get(), NULL, GetNode("a")); + BookmarkEditorView editor(profile_.get(), NULL, GetNode("a"), + BookmarkEditorView::SHOW_TREE); editor.ApplyEdits(editor.tree_model_->GetRoot()->GetChild(1)); @@ -146,7 +150,8 @@ TEST_F(BookmarkEditorViewTest, ChangeParent) { TEST_F(BookmarkEditorViewTest, ChangeParentAndURL) { Time node_time = Time::Now() + TimeDelta::FromDays(2); GetNode("a")->date_added_ = node_time; - BookmarkEditorView editor(profile_.get(), NULL, GetNode("a")); + BookmarkEditorView editor(profile_.get(), NULL, GetNode("a"), + BookmarkEditorView::SHOW_TREE); editor.url_tf_.SetText(UTF8ToWide(GURL(base_path() + "new_a").spec())); @@ -160,7 +165,8 @@ TEST_F(BookmarkEditorViewTest, ChangeParentAndURL) { // Creates a new folder and moves a node to it. TEST_F(BookmarkEditorViewTest, MoveToNewParent) { - BookmarkEditorView editor(profile_.get(), NULL, GetNode("a")); + BookmarkEditorView editor(profile_.get(), NULL, GetNode("a"), + BookmarkEditorView::SHOW_TREE); // Create two nodes: "F21" as a child of "F2" and "F211" as a child of "F21". BookmarkEditorView::EditorNode* f2 = @@ -191,7 +197,8 @@ TEST_F(BookmarkEditorViewTest, MoveToNewParent) { // Brings up the editor, creating a new URL on the bookmark bar. TEST_F(BookmarkEditorViewTest, NewURL) { - BookmarkEditorView editor(profile_.get(), NULL, NULL); + BookmarkEditorView editor(profile_.get(), NULL, NULL, + BookmarkEditorView::SHOW_TREE); editor.url_tf_.SetText(UTF8ToWide(GURL(base_path() + "a").spec())); editor.title_tf_.SetText(L"new_a"); @@ -206,3 +213,41 @@ TEST_F(BookmarkEditorViewTest, NewURL) { EXPECT_EQ(L"new_a", new_node->GetTitle()); EXPECT_TRUE(GURL(base_path() + "a") == new_node->GetURL()); } + +// Brings up the editor with no tree and modifies the url. +TEST_F(BookmarkEditorViewTest, ChangeURLNoTree) { + BookmarkEditorView editor(profile_.get(), NULL, + model_->other_node()->GetChild(0), + BookmarkEditorView::NO_TREE); + + editor.url_tf_.SetText(UTF8ToWide(GURL(base_path() + "a").spec())); + editor.title_tf_.SetText(L"new_a"); + + editor.ApplyEdits(NULL); + + BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); + ASSERT_EQ(2, other_node->GetChildCount()); + + BookmarkNode* new_node = other_node->GetChild(0); + + EXPECT_EQ(L"new_a", new_node->GetTitle()); + EXPECT_TRUE(GURL(base_path() + "a") == new_node->GetURL()); +} + +// Brings up the editor with no tree and modifies only the title. +TEST_F(BookmarkEditorViewTest, ChangeTitleNoTree) { + BookmarkEditorView editor(profile_.get(), NULL, + model_->other_node()->GetChild(0), + BookmarkEditorView::NO_TREE); + + editor.title_tf_.SetText(L"new_a"); + + editor.ApplyEdits(NULL); + + BookmarkNode* other_node = profile_->GetBookmarkModel()->other_node(); + ASSERT_EQ(2, other_node->GetChildCount()); + + BookmarkNode* new_node = other_node->GetChild(0); + + EXPECT_EQ(L"new_a", new_node->GetTitle()); +} |