OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 595 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
606 ASSERT_EQ(n1, model_.GetMostRecentlyAddedNodeForURL(url)); | 606 ASSERT_EQ(n1, model_.GetMostRecentlyAddedNodeForURL(url)); |
607 | 607 |
608 // swap 1 and 2, then check again. | 608 // swap 1 and 2, then check again. |
609 SwapDateAdded(n1, n2); | 609 SwapDateAdded(n1, n2); |
610 ASSERT_EQ(n2, model_.GetMostRecentlyAddedNodeForURL(url)); | 610 ASSERT_EQ(n2, model_.GetMostRecentlyAddedNodeForURL(url)); |
611 } | 611 } |
612 | 612 |
613 // Makes sure GetBookmarks removes duplicates. | 613 // Makes sure GetBookmarks removes duplicates. |
614 TEST_F(BookmarkModelTest, GetBookmarksWithDups) { | 614 TEST_F(BookmarkModelTest, GetBookmarksWithDups) { |
615 const GURL url("http://foo.com/0"); | 615 const GURL url("http://foo.com/0"); |
616 model_.AddURL(model_.bookmark_bar_node(), 0, ASCIIToUTF16("blah"), url); | 616 const string16 title(ASCIIToUTF16("blah")); |
617 model_.AddURL(model_.bookmark_bar_node(), 1, ASCIIToUTF16("blah"), url); | 617 model_.AddURL(model_.bookmark_bar_node(), 0, title, url); |
| 618 model_.AddURL(model_.bookmark_bar_node(), 1, title, url); |
618 | 619 |
619 std::vector<GURL> urls; | 620 std::vector<BookmarkService::Bookmark> bookmarks; |
620 model_.GetBookmarks(&urls); | 621 model_.GetBookmarks(&bookmarks); |
621 EXPECT_EQ(1U, urls.size()); | 622 ASSERT_EQ(1U, bookmarks.size()); |
622 ASSERT_TRUE(urls[0] == url); | 623 EXPECT_EQ(url, bookmarks[0].url); |
| 624 EXPECT_EQ(title, bookmarks[0].title); |
| 625 |
| 626 model_.AddURL(model_.bookmark_bar_node(), 2, ASCIIToUTF16("Title2"), url); |
| 627 // Only one returned, even titles are different. |
| 628 bookmarks.clear(); |
| 629 model_.GetBookmarks(&bookmarks); |
| 630 EXPECT_EQ(1U, bookmarks.size()); |
623 } | 631 } |
624 | 632 |
625 TEST_F(BookmarkModelTest, HasBookmarks) { | 633 TEST_F(BookmarkModelTest, HasBookmarks) { |
626 const GURL url("http://foo.com/"); | 634 const GURL url("http://foo.com/"); |
627 model_.AddURL(model_.bookmark_bar_node(), 0, ASCIIToUTF16("bar"), url); | 635 model_.AddURL(model_.bookmark_bar_node(), 0, ASCIIToUTF16("bar"), url); |
628 | 636 |
629 EXPECT_TRUE(model_.HasBookmarks()); | 637 EXPECT_TRUE(model_.HasBookmarks()); |
630 } | 638 } |
631 | 639 |
632 // content::NotificationObserver implementation used in verifying we've received | 640 // content::NotificationObserver implementation used in verifying we've received |
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1160 AssertExtensiveChangesObserverCount(1, 0); | 1168 AssertExtensiveChangesObserverCount(1, 0); |
1161 model_.EndExtensiveChanges(); | 1169 model_.EndExtensiveChanges(); |
1162 EXPECT_TRUE(model_.IsDoingExtensiveChanges()); | 1170 EXPECT_TRUE(model_.IsDoingExtensiveChanges()); |
1163 AssertExtensiveChangesObserverCount(1, 0); | 1171 AssertExtensiveChangesObserverCount(1, 0); |
1164 model_.EndExtensiveChanges(); | 1172 model_.EndExtensiveChanges(); |
1165 EXPECT_FALSE(model_.IsDoingExtensiveChanges()); | 1173 EXPECT_FALSE(model_.IsDoingExtensiveChanges()); |
1166 AssertExtensiveChangesObserverCount(1, 1); | 1174 AssertExtensiveChangesObserverCount(1, 1); |
1167 } | 1175 } |
1168 | 1176 |
1169 } // namespace | 1177 } // namespace |
OLD | NEW |