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

Side by Side Diff: chrome/browser/ui/gtk/bookmarks/bookmark_editor_gtk_unittest.cc

Issue 8772064: Adds back BookmarkNode::IsVisible. Turns out we want to conditionally (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Tweaks Created 9 years 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include <gtk/gtk.h> 5 #include <gtk/gtk.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 BookmarkEditor::SHOW_TREE); 111 BookmarkEditor::SHOW_TREE);
112 112
113 // The root should have two or three children, one for the bookmark bar node, 113 // The root should have two or three children, one for the bookmark bar node,
114 // another for the 'other bookmarks' folder, and depending on the visib 114 // another for the 'other bookmarks' folder, and depending on the visib
115 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_); 115 GtkTreeModel* store = GTK_TREE_MODEL(editor.tree_store_);
116 GtkTreeIter toplevel; 116 GtkTreeIter toplevel;
117 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, &toplevel)); 117 ASSERT_TRUE(gtk_tree_model_get_iter_first(store, &toplevel));
118 GtkTreeIter bookmark_bar_node = toplevel; 118 GtkTreeIter bookmark_bar_node = toplevel;
119 ASSERT_TRUE(gtk_tree_model_iter_next(store, &toplevel)); 119 ASSERT_TRUE(gtk_tree_model_iter_next(store, &toplevel));
120 GtkTreeIter other_node = toplevel; 120 GtkTreeIter other_node = toplevel;
121 ASSERT_TRUE(gtk_tree_model_iter_next(store, &toplevel)); 121 if (model_->mobile_node()->IsVisible()) {
122 ASSERT_FALSE(gtk_tree_model_iter_next(store, &toplevel)); 122 // If we have a mobile node, then the iterator should find one element after
123 // "other bookmarks"
124 ASSERT_TRUE(gtk_tree_model_iter_next(store, &toplevel));
125 ASSERT_FALSE(gtk_tree_model_iter_next(store, &toplevel));
126 } else {
127 ASSERT_FALSE(gtk_tree_model_iter_next(store, &toplevel));
128 }
123 129
124 // The bookmark bar should have 2 nodes: folder F1 and F2. 130 // The bookmark bar should have 2 nodes: folder F1 and F2.
125 GtkTreeIter f1_iter; 131 GtkTreeIter f1_iter;
126 GtkTreeIter child; 132 GtkTreeIter child;
127 ASSERT_EQ(2, gtk_tree_model_iter_n_children(store, &bookmark_bar_node)); 133 ASSERT_EQ(2, gtk_tree_model_iter_n_children(store, &bookmark_bar_node));
128 ASSERT_TRUE(gtk_tree_model_iter_children(store, &child, &bookmark_bar_node)); 134 ASSERT_TRUE(gtk_tree_model_iter_children(store, &child, &bookmark_bar_node));
129 f1_iter = child; 135 f1_iter = child;
130 ASSERT_EQ("F1", UTF16ToUTF8(GetTitleFromTreeIter(store, &child))); 136 ASSERT_EQ("F1", UTF16ToUTF8(GetTitleFromTreeIter(store, &child)));
131 ASSERT_TRUE(gtk_tree_model_iter_next(store, &child)); 137 ASSERT_TRUE(gtk_tree_model_iter_next(store, &child));
132 ASSERT_EQ("F2", UTF16ToUTF8(GetTitleFromTreeIter(store, &child))); 138 ASSERT_EQ("F2", UTF16ToUTF8(GetTitleFromTreeIter(store, &child)));
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
328 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a"); 334 gtk_entry_set_text(GTK_ENTRY(editor.name_entry_), "new_a");
329 335
330 editor.ApplyEdits(); 336 editor.ApplyEdits();
331 337
332 const BookmarkNode* other_node = model_->other_node(); 338 const BookmarkNode* other_node = model_->other_node();
333 ASSERT_EQ(2, other_node->child_count()); 339 ASSERT_EQ(2, other_node->child_count());
334 340
335 const BookmarkNode* new_node = other_node->GetChild(0); 341 const BookmarkNode* new_node = other_node->GetChild(0);
336 EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle()); 342 EXPECT_EQ(ASCIIToUTF16("new_a"), new_node->GetTitle());
337 } 343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698