summaryrefslogtreecommitdiffstats
path: root/chrome/browser/ui
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/ui')
-rw-r--r--chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm2
-rw-r--r--chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc15
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc3
-rw-r--r--chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc6
4 files changed, 22 insertions, 4 deletions
diff --git a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
index d7d203e..9d7f7a8 100644
--- a/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
+++ b/chrome/browser/ui/cocoa/bookmarks/bookmark_bar_controller.mm
@@ -539,6 +539,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
// Don't allow edit/delete of the bar node, or of "Other Bookmarks"
if ((node == nil) ||
(node == bookmarkModel_->other_node()) ||
+ (node == bookmarkModel_->synced_node()) ||
(node == bookmarkModel_->GetBookmarkBarNode()))
return NO;
return YES;
@@ -800,6 +801,7 @@ void RecordAppLaunch(Profile* profile, GURL url) {
BookmarkNode::Type type = senderNode->type();
if (type == BookmarkNode::BOOKMARK_BAR ||
type == BookmarkNode::OTHER_NODE ||
+ type == BookmarkNode::SYNCED ||
type == BookmarkNode::FOLDER) {
parent = senderNode;
newIndex = parent->child_count();
diff --git a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc
index 318f246..65c03b7 100644
--- a/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc
+++ b/chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc
@@ -6,11 +6,13 @@
#include <string>
+#include "base/command_line.h"
#include "base/string_util.h"
#include "base/utf_string_conversions.h"
#include "chrome/browser/bookmarks/bookmark_model.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk.h"
#include "chrome/browser/ui/gtk/bookmarks/bookmark_tree_model.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/test/testing_profile.h"
#include "content/browser/browser_thread.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -33,6 +35,8 @@ class BookmarkEditorGtkTest : public testing::Test {
}
virtual void SetUp() {
+ CommandLine::ForCurrentProcess()->AppendSwitch(
+ switches::kEnableSyncedBookmarksFolder);
profile_.reset(new TestingProfile());
profile_->CreateBookmarkModel(true);
profile_->BlockUntilBookmarkModelLoaded();
@@ -71,6 +75,8 @@ class BookmarkEditorGtkTest : public testing::Test {
// oa
// OF1
// of1a
+ // synced node
+ // sa
void AddTestData() {
std::string test_base = base_path();
@@ -89,6 +95,10 @@ class BookmarkEditorGtkTest : public testing::Test {
const BookmarkNode* of1 =
model_->AddFolder(model_->other_node(), 1, ASCIIToUTF16("OF1"));
model_->AddURL(of1, 0, ASCIIToUTF16("of1a"), GURL(test_base + "of1a"));
+
+ // Children of the synced node.
+ model_->AddURL(model_->synced_node(), 0, ASCIIToUTF16("sa"),
+ GURL(test_base + "sa"));
}
};
@@ -106,6 +116,8 @@ TEST_F(BookmarkEditorGtkTest, ModelsMatch) {
GtkTreeIter bookmark_bar_node = toplevel;
ASSERT_TRUE(gtk_tree_model_iter_next(store, &toplevel));
GtkTreeIter other_node = toplevel;
+ ASSERT_TRUE(gtk_tree_model_iter_next(store, &toplevel));
+ GtkTreeIter synced_node = toplevel;
ASSERT_FALSE(gtk_tree_model_iter_next(store, &toplevel));
// The bookmark bar should have 2 nodes: folder F1 and F2.
@@ -130,6 +142,9 @@ TEST_F(BookmarkEditorGtkTest, ModelsMatch) {
ASSERT_TRUE(gtk_tree_model_iter_children(store, &child, &other_node));
ASSERT_EQ("OF1", UTF16ToUTF8(GetTitleFromTreeIter(store, &child)));
ASSERT_FALSE(gtk_tree_model_iter_next(store, &child));
+
+ // Synced node should have one child (sa).
+ ASSERT_EQ(0, gtk_tree_model_iter_n_children(store, &synced_node));
}
// Changes the title and makes sure parent/visual order doesn't change.
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
index b8e25ef..6b18180 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view.cc
@@ -485,9 +485,10 @@ BookmarkEditorView::EditorNode* BookmarkEditorView::CreateRootNode() {
EditorNode* root_node = new EditorNode(std::wstring(), 0);
const BookmarkNode* bb_root_node = bb_model_->root_node();
CreateNodes(bb_root_node, root_node);
- DCHECK(root_node->child_count() == 2);
+ DCHECK(root_node->child_count() == 3);
DCHECK(bb_root_node->GetChild(0)->type() == BookmarkNode::BOOKMARK_BAR);
DCHECK(bb_root_node->GetChild(1)->type() == BookmarkNode::OTHER_NODE);
+ DCHECK(bb_root_node->GetChild(2)->type() == BookmarkNode::SYNCED);
return root_node;
}
diff --git a/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc b/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
index 042dc12..8a63a2d 100644
--- a/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
+++ b/chrome/browser/ui/views/bookmarks/bookmark_editor_view_unittest.cc
@@ -132,9 +132,9 @@ TEST_F(BookmarkEditorViewTest, ModelsMatch) {
CreateEditor(profile_.get(), NULL, BookmarkEditor::EditDetails(),
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.
- ASSERT_EQ(2, editor_root->child_count());
+ // The root should have three children: bookmark bar, other bookmarks and
+ // synced bookmarks.
+ ASSERT_EQ(3, editor_root->child_count());
BookmarkEditorView::EditorNode* bb_node = editor_root->GetChild(0);
// The root should have 2 nodes: folder F1 and F2.