Index: chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc |
diff --git a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc |
index e574eec2bbd0d88a45cce7685c250eb464da3d8f..a1c24f0a72609a1aec0a910c7dd05314ad0f0787 100644 |
--- a/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc |
+++ b/chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc |
@@ -229,6 +229,48 @@ IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_SetFaviconHiDPI) { |
ASSERT_TRUE(AllModelsMatchVerifier()); |
} |
+// When two bookmarks use the same icon URL, both bookmarks use the same row |
+// in the favicons table in the Favicons database. Test that when the favicon |
+// is updated for one bookmark it is also updated for the other bookmark. This |
+// ensures that sync has the most up to date data and prevents sync from |
+// reverting the newly updated bookmark favicon back to the old favicon. |
+// crbug.com/485657 |
+IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, |
+ SC_SetFaviconTwoBookmarksSameIconURL) { |
+ const GURL page_url1("http://www.google.com/a"); |
+ const GURL page_url2("http://www.google.com/b"); |
+ const GURL icon_url("http://www.google.com/favicon.ico"); |
+ |
+ ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
+ ASSERT_TRUE(AllModelsMatchVerifier()); |
+ |
+ const BookmarkNode* bookmark01 = AddURL(0, kGenericURLTitle, page_url1); |
+ ASSERT_TRUE(bookmark01 != nullptr); |
+ const BookmarkNode* bookmark02 = AddURL(0, kGenericURLTitle, page_url2); |
+ ASSERT_TRUE(bookmark02 != nullptr); |
+ |
+ SetFavicon(0, bookmark01, icon_url, CreateFavicon(SK_ColorWHITE), |
+ bookmarks_helper::FROM_UI); |
+ ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
+ ASSERT_TRUE(AllModelsMatchVerifier()); |
+ |
+ // Set |page_url2| to use a blue favicon and the same icon URL as |
+ // |page_url1|. The favicon for |page_url1| should also become blue. |
+ SetFavicon(0, bookmark02, icon_url, CreateFavicon(SK_ColorBLUE), |
+ bookmarks_helper::FROM_UI); |
+ ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); |
+ ASSERT_TRUE(AllModelsMatchVerifier()); |
+ |
+ // Set the title for |page_url1|. This should not revert either of the |
+ // bookmark favicons back to white. |
+ const char kNewTitle[] = "New Title"; |
+ ASSERT_STRNE(kGenericURLTitle, kNewTitle); |
+ const BookmarkNode* bookmark11 = GetUniqueNodeByURL(1, page_url1); |
+ SetTitle(1, bookmark11, std::string(kNewTitle)); |
+ ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); |
+ ASSERT_TRUE(AllModelsMatchVerifier()); |
+} |
+ |
// Test Scribe ID - 370560. |
IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddNonHTTPBMs) { |
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |