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

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

Issue 866643002: Revert of Revert of Eliminate components_unittests' dependence on chrome resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 months 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
« no previous file with comments | « no previous file | components/components_tests.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_model.h" 5 #include "components/bookmarks/browser/bookmark_model.h"
6 6
7 #include <set> 7 #include <set>
8 #include <string> 8 #include <string>
9 9
10 #include "base/base_paths.h" 10 #include "base/base_paths.h"
(...skipping 968 matching lines...) Expand 10 before | Expand all | Expand 10 after
979 PopulateNodeFromString(data[i].mobile_contents, &mobile); 979 PopulateNodeFromString(data[i].mobile_contents, &mobile);
980 PopulateBookmarkNode(&mobile, model_.get(), model_->mobile_node()); 980 PopulateBookmarkNode(&mobile, model_.get(), model_->mobile_node());
981 981
982 VerifyModelMatchesNode(&bbn, model_->bookmark_bar_node()); 982 VerifyModelMatchesNode(&bbn, model_->bookmark_bar_node());
983 VerifyModelMatchesNode(&other, model_->other_node()); 983 VerifyModelMatchesNode(&other, model_->other_node());
984 VerifyModelMatchesNode(&mobile, model_->mobile_node()); 984 VerifyModelMatchesNode(&mobile, model_->mobile_node());
985 VerifyNoDuplicateIDs(model_.get()); 985 VerifyNoDuplicateIDs(model_.get());
986 } 986 }
987 } 987 }
988 988
989 #if !defined(OS_ANDROID) && !defined(OS_IOS) // http://crbug.com/450464
989 TEST_F(BookmarkModelTest, Sort) { 990 TEST_F(BookmarkModelTest, Sort) {
990 // Populate the bookmark bar node with nodes for 'B', 'a', 'd' and 'C'. 991 // Populate the bookmark bar node with nodes for 'B', 'a', 'd' and 'C'.
991 // 'C' and 'a' are folders. 992 // 'C' and 'a' are folders.
992 TestNode bbn; 993 TestNode bbn;
993 PopulateNodeFromString("B [ a ] d [ a ]", &bbn); 994 PopulateNodeFromString("B [ a ] d [ a ]", &bbn);
994 const BookmarkNode* parent = model_->bookmark_bar_node(); 995 const BookmarkNode* parent = model_->bookmark_bar_node();
995 PopulateBookmarkNode(&bbn, model_.get(), parent); 996 PopulateBookmarkNode(&bbn, model_.get(), parent);
996 997
997 BookmarkNode* child1 = AsMutable(parent->GetChild(1)); 998 BookmarkNode* child1 = AsMutable(parent->GetChild(1));
998 child1->SetTitle(ASCIIToUTF16("a")); 999 child1->SetTitle(ASCIIToUTF16("a"));
(...skipping 10 matching lines...) Expand all
1009 // Make sure we were notified. 1010 // Make sure we were notified.
1010 AssertObserverCount(0, 0, 0, 0, 1, 0, 0, 1, 0); 1011 AssertObserverCount(0, 0, 0, 0, 1, 0, 0, 1, 0);
1011 1012
1012 // Make sure the order matches (remember, 'a' and 'C' are folders and 1013 // Make sure the order matches (remember, 'a' and 'C' are folders and
1013 // come first). 1014 // come first).
1014 EXPECT_EQ(parent->GetChild(0)->GetTitle(), ASCIIToUTF16("a")); 1015 EXPECT_EQ(parent->GetChild(0)->GetTitle(), ASCIIToUTF16("a"));
1015 EXPECT_EQ(parent->GetChild(1)->GetTitle(), ASCIIToUTF16("C")); 1016 EXPECT_EQ(parent->GetChild(1)->GetTitle(), ASCIIToUTF16("C"));
1016 EXPECT_EQ(parent->GetChild(2)->GetTitle(), ASCIIToUTF16("B")); 1017 EXPECT_EQ(parent->GetChild(2)->GetTitle(), ASCIIToUTF16("B"));
1017 EXPECT_EQ(parent->GetChild(3)->GetTitle(), ASCIIToUTF16("d")); 1018 EXPECT_EQ(parent->GetChild(3)->GetTitle(), ASCIIToUTF16("d"));
1018 } 1019 }
1020 #endif
1019 1021
1020 TEST_F(BookmarkModelTest, Reorder) { 1022 TEST_F(BookmarkModelTest, Reorder) {
1021 // Populate the bookmark bar node with nodes 'A', 'B', 'C' and 'D'. 1023 // Populate the bookmark bar node with nodes 'A', 'B', 'C' and 'D'.
1022 TestNode bbn; 1024 TestNode bbn;
1023 PopulateNodeFromString("A B C D", &bbn); 1025 PopulateNodeFromString("A B C D", &bbn);
1024 BookmarkNode* parent = AsMutable(model_->bookmark_bar_node()); 1026 BookmarkNode* parent = AsMutable(model_->bookmark_bar_node());
1025 PopulateBookmarkNode(&bbn, model_.get(), parent); 1027 PopulateBookmarkNode(&bbn, model_.get(), parent);
1026 1028
1027 ClearCounts(); 1029 ClearCounts();
1028 1030
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 EXPECT_FALSE(node.DeleteMetaInfo("key3")); 1193 EXPECT_FALSE(node.DeleteMetaInfo("key3"));
1192 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value)); 1194 EXPECT_FALSE(node.GetMetaInfo("key1", &out_value));
1193 EXPECT_FALSE(node.GetMetaInfo("key2.subkey1", &out_value)); 1195 EXPECT_FALSE(node.GetMetaInfo("key2.subkey1", &out_value));
1194 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2", &out_value)); 1196 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2", &out_value));
1195 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2.leaf", &out_value)); 1197 EXPECT_FALSE(node.GetMetaInfo("key2.subkey2.leaf", &out_value));
1196 EXPECT_FALSE(node.GetMetaInfoMap()); 1198 EXPECT_FALSE(node.GetMetaInfoMap());
1197 } 1199 }
1198 1200
1199 } // namespace 1201 } // namespace
1200 } // namespace bookmarks 1202 } // namespace bookmarks
OLDNEW
« no previous file with comments | « no previous file | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698