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

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

Issue 10825147: Made BookmarkService::GetBookmarks return both urls and title. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync again again Created 8 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/bookmarks/bookmark_service.h » ('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 (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 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
607 ASSERT_EQ(n1, model_.GetMostRecentlyAddedNodeForURL(url)); 607 ASSERT_EQ(n1, model_.GetMostRecentlyAddedNodeForURL(url));
608 608
609 // swap 1 and 2, then check again. 609 // swap 1 and 2, then check again.
610 SwapDateAdded(n1, n2); 610 SwapDateAdded(n1, n2);
611 ASSERT_EQ(n2, model_.GetMostRecentlyAddedNodeForURL(url)); 611 ASSERT_EQ(n2, model_.GetMostRecentlyAddedNodeForURL(url));
612 } 612 }
613 613
614 // Makes sure GetBookmarks removes duplicates. 614 // Makes sure GetBookmarks removes duplicates.
615 TEST_F(BookmarkModelTest, GetBookmarksWithDups) { 615 TEST_F(BookmarkModelTest, GetBookmarksWithDups) {
616 const GURL url("http://foo.com/0"); 616 const GURL url("http://foo.com/0");
617 model_.AddURL(model_.bookmark_bar_node(), 0, ASCIIToUTF16("blah"), url); 617 const string16 title(ASCIIToUTF16("blah"));
618 model_.AddURL(model_.bookmark_bar_node(), 1, ASCIIToUTF16("blah"), url); 618 model_.AddURL(model_.bookmark_bar_node(), 0, title, url);
619 model_.AddURL(model_.bookmark_bar_node(), 1, title, url);
619 620
620 std::vector<GURL> urls; 621 std::vector<BookmarkService::URLAndTitle> bookmarks;
621 model_.GetBookmarks(&urls); 622 model_.GetBookmarks(&bookmarks);
622 EXPECT_EQ(1U, urls.size()); 623 ASSERT_EQ(1U, bookmarks.size());
623 ASSERT_TRUE(urls[0] == url); 624 EXPECT_EQ(url, bookmarks[0].url);
625 EXPECT_EQ(title, bookmarks[0].title);
626
627 model_.AddURL(model_.bookmark_bar_node(), 2, ASCIIToUTF16("Title2"), url);
628 // Only one returned, even titles are different.
629 bookmarks.clear();
630 model_.GetBookmarks(&bookmarks);
631 EXPECT_EQ(1U, bookmarks.size());
624 } 632 }
625 633
626 TEST_F(BookmarkModelTest, HasBookmarks) { 634 TEST_F(BookmarkModelTest, HasBookmarks) {
627 const GURL url("http://foo.com/"); 635 const GURL url("http://foo.com/");
628 model_.AddURL(model_.bookmark_bar_node(), 0, ASCIIToUTF16("bar"), url); 636 model_.AddURL(model_.bookmark_bar_node(), 0, ASCIIToUTF16("bar"), url);
629 637
630 EXPECT_TRUE(model_.HasBookmarks()); 638 EXPECT_TRUE(model_.HasBookmarks());
631 } 639 }
632 640
633 // content::NotificationObserver implementation used in verifying we've received 641 // content::NotificationObserver implementation used in verifying we've received
(...skipping 527 matching lines...) Expand 10 before | Expand all | Expand 10 after
1161 AssertExtensiveChangesObserverCount(1, 0); 1169 AssertExtensiveChangesObserverCount(1, 0);
1162 model_.EndExtensiveChanges(); 1170 model_.EndExtensiveChanges();
1163 EXPECT_TRUE(model_.IsDoingExtensiveChanges()); 1171 EXPECT_TRUE(model_.IsDoingExtensiveChanges());
1164 AssertExtensiveChangesObserverCount(1, 0); 1172 AssertExtensiveChangesObserverCount(1, 0);
1165 model_.EndExtensiveChanges(); 1173 model_.EndExtensiveChanges();
1166 EXPECT_FALSE(model_.IsDoingExtensiveChanges()); 1174 EXPECT_FALSE(model_.IsDoingExtensiveChanges());
1167 AssertExtensiveChangesObserverCount(1, 1); 1175 AssertExtensiveChangesObserverCount(1, 1);
1168 } 1176 }
1169 1177
1170 } // namespace 1178 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/bookmarks/bookmark_model.cc ('k') | chrome/browser/bookmarks/bookmark_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698