summaryrefslogtreecommitdiffstats
path: root/chrome
diff options
context:
space:
mode:
authornick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 07:56:19 +0000
committernick@chromium.org <nick@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-02-18 07:56:19 +0000
commit3517fd50b20611670f08aedfff25451f6fe9e313 (patch)
treec0c3a661dd654f1b5487ddf28fcca861206bf71e /chrome
parent32ddce4181646521385f9587fc035b854c97b2f5 (diff)
downloadchromium_src-3517fd50b20611670f08aedfff25451f6fe9e313.zip
chromium_src-3517fd50b20611670f08aedfff25451f6fe9e313.tar.gz
chromium_src-3517fd50b20611670f08aedfff25451f6fe9e313.tar.bz2
Add a unit test verifying the merge behavior when there are two
duplicate URLs. I promised this test a long time ago for an old bug. TEST=ran this unittest; passes at trunk, fails if you change "multiset" to "set" in the BookmarkNodeFinder. BUG=24995 Review URL: http://codereview.chromium.org/640002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@39340 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r--chrome/browser/sync/profile_sync_service_unittest.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/sync/profile_sync_service_unittest.cc b/chrome/browser/sync/profile_sync_service_unittest.cc
index f7b97e5..ef71f1e 100644
--- a/chrome/browser/sync/profile_sync_service_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_unittest.cc
@@ -867,6 +867,26 @@ TEST_F(ProfileSyncServiceTest, UnrecoverableErrorSuspendsService) {
// directly here once that's formalized and exposed.
}
+// See what happens if we run model association when there are two exact URL
+// duplicate bookmarks. The BookmarkModelAssociator should not fall over when
+// this happens.
+TEST_F(ProfileSyncServiceTest, MergeDuplicates) {
+ LoadBookmarkModel(DELETE_EXISTING_STORAGE, SAVE_TO_STORAGE);
+ StartSyncService();
+
+ model_->AddURL(model_->other_node(), 0, L"Dup", GURL("http://dup.com/"));
+ model_->AddURL(model_->other_node(), 0, L"Dup", GURL("http://dup.com/"));
+
+ EXPECT_EQ(2, model_->other_node()->GetChildCount());
+
+ // Restart the sync service to trigger model association.
+ StopSyncService(SAVE_TO_STORAGE);
+ StartSyncService();
+
+ EXPECT_EQ(2, model_->other_node()->GetChildCount());
+ ExpectModelMatch();
+}
+
struct TestData {
const wchar_t* title;
const char* url;