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

Side by Side Diff: chrome/browser/bookmarks/bookmark_model_unittest.cc

Issue 8828006: Makes all permanent nodes share the same node class so that visibility (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More 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 <set> 5 #include <set>
6 #include <string> 6 #include <string>
7 7
8 #include "base/base_paths.h" 8 #include "base/base_paths.h"
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1080 EXPECT_EQ(parent->GetChild(2)->GetTitle(), ASCIIToUTF16("B")); 1080 EXPECT_EQ(parent->GetChild(2)->GetTitle(), ASCIIToUTF16("B"));
1081 EXPECT_EQ(parent->GetChild(3)->GetTitle(), ASCIIToUTF16("d")); 1081 EXPECT_EQ(parent->GetChild(3)->GetTitle(), ASCIIToUTF16("d"));
1082 } 1082 }
1083 1083
1084 TEST_F(BookmarkModelTest, NodeVisibility) { 1084 TEST_F(BookmarkModelTest, NodeVisibility) {
1085 EXPECT_TRUE(model_.bookmark_bar_node()->IsVisible()); 1085 EXPECT_TRUE(model_.bookmark_bar_node()->IsVisible());
1086 EXPECT_TRUE(model_.other_node()->IsVisible()); 1086 EXPECT_TRUE(model_.other_node()->IsVisible());
1087 // Mobile node invisible by default 1087 // Mobile node invisible by default
1088 EXPECT_FALSE(model_.mobile_node()->IsVisible()); 1088 EXPECT_FALSE(model_.mobile_node()->IsVisible());
1089 1089
1090 // Change visibility of permanent nodes.
1091 model_.SetPermanentNodeVisible(BookmarkNode::BOOKMARK_BAR, false);
1092 EXPECT_FALSE(model_.bookmark_bar_node()->IsVisible());
1093 model_.SetPermanentNodeVisible(BookmarkNode::OTHER_NODE, false);
1094 EXPECT_FALSE(model_.other_node()->IsVisible());
1095 model_.SetPermanentNodeVisible(BookmarkNode::MOBILE, true);
1096 EXPECT_TRUE(model_.mobile_node()->IsVisible());
1097
1090 // Arbitrary node should be visible 1098 // Arbitrary node should be visible
1091 TestNode bbn; 1099 TestNode bbn;
1092 PopulateNodeFromString("B", &bbn); 1100 PopulateNodeFromString("B", &bbn);
1093 const BookmarkNode* parent = model_.bookmark_bar_node(); 1101 const BookmarkNode* parent = model_.bookmark_bar_node();
1094 PopulateBookmarkNode(&bbn, &model_, parent); 1102 PopulateBookmarkNode(&bbn, &model_, parent);
1095 EXPECT_TRUE(parent->GetChild(0)->IsVisible()); 1103 EXPECT_TRUE(parent->GetChild(0)->IsVisible());
1104
1105 // Bookmark bar should be visible now that it has a child.
1106 EXPECT_TRUE(model_.bookmark_bar_node()->IsVisible());
1096 } 1107 }
1097 1108
1098 TEST_F(BookmarkModelTest, MobileNodeVisibileWithChildren) { 1109 TEST_F(BookmarkModelTest, MobileNodeVisibileWithChildren) {
1099 const BookmarkNode* root = model_.mobile_node(); 1110 const BookmarkNode* root = model_.mobile_node();
1100 const string16 title(ASCIIToUTF16("foo")); 1111 const string16 title(ASCIIToUTF16("foo"));
1101 const GURL url("http://foo.com"); 1112 const GURL url("http://foo.com");
1102 1113
1103 model_.AddURL(root, 0, title, url); 1114 model_.AddURL(root, 0, title, url);
1104 EXPECT_TRUE(model_.mobile_node()->IsVisible()); 1115 EXPECT_TRUE(model_.mobile_node()->IsVisible());
1105 } 1116 }
1106 1117
1107 } // namespace 1118 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698