| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 6 |
| 7 #include "app/tree_node_iterator.h" | 7 #include "app/tree_node_iterator.h" |
| 8 #include "app/tree_node_model.h" | 8 #include "app/tree_node_model.h" |
| 9 #include "base/base_paths.h" | 9 #include "base/base_paths.h" |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 946 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 957 | 957 |
| 958 TEST_F(BookmarkModelTest, Sort) { | 958 TEST_F(BookmarkModelTest, Sort) { |
| 959 // Populate the bookmark bar node with nodes for 'B', 'a', 'd' and 'C'. | 959 // Populate the bookmark bar node with nodes for 'B', 'a', 'd' and 'C'. |
| 960 // 'C' and 'a' are folders. | 960 // 'C' and 'a' are folders. |
| 961 TestNode bbn; | 961 TestNode bbn; |
| 962 PopulateNodeFromString(L"B [ a ] d [ a ]", &bbn); | 962 PopulateNodeFromString(L"B [ a ] d [ a ]", &bbn); |
| 963 const BookmarkNode* parent = model.GetBookmarkBarNode(); | 963 const BookmarkNode* parent = model.GetBookmarkBarNode(); |
| 964 PopulateBookmarkNode(&bbn, &model, parent); | 964 PopulateBookmarkNode(&bbn, &model, parent); |
| 965 | 965 |
| 966 BookmarkNode* child1 = AsMutable(parent->GetChild(1)); | 966 BookmarkNode* child1 = AsMutable(parent->GetChild(1)); |
| 967 child1->SetTitle(L"a"); | 967 child1->SetTitle(ASCIIToUTF16("a")); |
| 968 delete child1->Remove(0); | 968 delete child1->Remove(0); |
| 969 BookmarkNode* child3 = AsMutable(parent->GetChild(3)); | 969 BookmarkNode* child3 = AsMutable(parent->GetChild(3)); |
| 970 child3->SetTitle(L"C"); | 970 child3->SetTitle(ASCIIToUTF16("C")); |
| 971 delete child3->Remove(0); | 971 delete child3->Remove(0); |
| 972 | 972 |
| 973 ClearCounts(); | 973 ClearCounts(); |
| 974 | 974 |
| 975 // Sort the children of the bookmark bar node. | 975 // Sort the children of the bookmark bar node. |
| 976 model.SortChildren(parent); | 976 model.SortChildren(parent); |
| 977 | 977 |
| 978 // Make sure we were notified. | 978 // Make sure we were notified. |
| 979 AssertObserverCount(0, 0, 0, 0, 1); | 979 AssertObserverCount(0, 0, 0, 0, 1); |
| 980 | 980 |
| 981 // Make sure the order matches (remember, 'a' and 'C' are folders and | 981 // Make sure the order matches (remember, 'a' and 'C' are folders and |
| 982 // come first). | 982 // come first). |
| 983 EXPECT_EQ(parent->GetChild(0)->GetTitleAsString16(), ASCIIToUTF16("a")); | 983 EXPECT_EQ(parent->GetChild(0)->GetTitleAsString16(), ASCIIToUTF16("a")); |
| 984 EXPECT_EQ(parent->GetChild(1)->GetTitleAsString16(), ASCIIToUTF16("C")); | 984 EXPECT_EQ(parent->GetChild(1)->GetTitleAsString16(), ASCIIToUTF16("C")); |
| 985 EXPECT_EQ(parent->GetChild(2)->GetTitleAsString16(), ASCIIToUTF16("B")); | 985 EXPECT_EQ(parent->GetChild(2)->GetTitleAsString16(), ASCIIToUTF16("B")); |
| 986 EXPECT_EQ(parent->GetChild(3)->GetTitleAsString16(), ASCIIToUTF16("d")); | 986 EXPECT_EQ(parent->GetChild(3)->GetTitleAsString16(), ASCIIToUTF16("d")); |
| 987 } | 987 } |
| OLD | NEW |