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

Side by Side Diff: chrome/browser/sync/test/integration/two_client_bookmarks_sync_test.cc

Issue 11428004: Sync the bookmark's icon URL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 8 years 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
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 "base/rand_util.h" 5 #include "base/rand_util.h"
6 #include "chrome/browser/profiles/profile.h" 6 #include "chrome/browser/profiles/profile.h"
7 #include "chrome/browser/sync/profile_sync_service_harness.h" 7 #include "chrome/browser/sync/profile_sync_service_harness.h"
8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 8 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
9 #include "chrome/browser/sync/test/integration/passwords_helper.h" 9 #include "chrome/browser/sync/test/integration/passwords_helper.h"
10 #include "chrome/browser/sync/test/integration/sync_test.h" 10 #include "chrome/browser/sync/test/integration/sync_test.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 46
47 class TwoClientBookmarksSyncTest : public SyncTest { 47 class TwoClientBookmarksSyncTest : public SyncTest {
48 public: 48 public:
49 TwoClientBookmarksSyncTest() : SyncTest(TWO_CLIENT) {} 49 TwoClientBookmarksSyncTest() : SyncTest(TWO_CLIENT) {}
50 virtual ~TwoClientBookmarksSyncTest() {} 50 virtual ~TwoClientBookmarksSyncTest() {}
51 51
52 private: 52 private:
53 DISALLOW_COPY_AND_ASSIGN(TwoClientBookmarksSyncTest); 53 DISALLOW_COPY_AND_ASSIGN(TwoClientBookmarksSyncTest);
54 }; 54 };
55 55
56 const std::vector<unsigned char> GenericFavicon() {
57 return CreateFavicon(254);
58 }
59
60 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, Sanity) { 56 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, Sanity) {
61 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 57 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
62 ASSERT_TRUE(AllModelsMatchVerifier()); 58 ASSERT_TRUE(AllModelsMatchVerifier());
63 59
64 GURL google_url("http://www.google.com"); 60 GURL google_url("http://www.google.com");
65 ASSERT_TRUE(AddURL(0, L"Google", google_url) != NULL); 61 ASSERT_TRUE(AddURL(0, L"Google", google_url) != NULL);
66 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 62 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
67 ASSERT_TRUE(AddURL(1, L"Yahoo", GURL("http://www.yahoo.com")) != NULL); 63 ASSERT_TRUE(AddURL(1, L"Yahoo", GURL("http://www.yahoo.com")) != NULL);
68 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); 64 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
69 ASSERT_TRUE(AllModelsMatchVerifier()); 65 ASSERT_TRUE(AllModelsMatchVerifier());
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 ASSERT_TRUE(AddURL(0, kGenericURLTitle, GURL(kGenericURL)) != NULL); 131 ASSERT_TRUE(AddURL(0, kGenericURLTitle, GURL(kGenericURL)) != NULL);
136 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 132 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
137 ASSERT_TRUE(AllModelsMatchVerifier()); 133 ASSERT_TRUE(AllModelsMatchVerifier());
138 } 134 }
139 135
140 // Test Scribe ID - 370489. 136 // Test Scribe ID - 370489.
141 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddFirstBMWithFavicon) { 137 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddFirstBMWithFavicon) {
142 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 138 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
143 ASSERT_TRUE(AllModelsMatchVerifier()); 139 ASSERT_TRUE(AllModelsMatchVerifier());
144 140
145 const BookmarkNode* bookmark = AddURL(0, kGenericURLTitle, GURL(kGenericURL)); 141 const GURL page_url(kGenericURL);
142 const GURL icon_url("http://www.google.com/favicon.ico");
143
144 const BookmarkNode* bookmark = AddURL(0, kGenericURLTitle, page_url);
145
146 ASSERT_TRUE(bookmark != NULL); 146 ASSERT_TRUE(bookmark != NULL);
147 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 147 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
148 SetFavicon(0, bookmark, GenericFavicon()); 148 SetFavicon(0, bookmark, icon_url, CreateFavicon(SK_ColorWHITE));
149 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 149 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
150 ASSERT_TRUE(AllModelsMatchVerifier()); 150 ASSERT_TRUE(AllModelsMatchVerifier());
151 } 151 }
152
153 // Test that the history service logic for not losing the hidpi versions of
154 // favicons as a result of sync does not result in dropping sync updates.
155 // In particular, the synced 16x16 favicon bitmap should overwrite 16x16
156 // favicon bitmaps on all clients. (Though non-16x16 favicon bitmaps
157 // are unchanged).
158 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_SetFaviconHiDPI) {
159 // Set the supported scale factors to include 2x such that CreateFavicon()
160 // creates a favicon with hidpi representations and that methods in the
161 // FaviconService request hidpi favicons.
162 std::vector<ui::ScaleFactor> supported_scale_factors;
163 supported_scale_factors.push_back(ui::SCALE_FACTOR_100P);
164 supported_scale_factors.push_back(ui::SCALE_FACTOR_200P);
165 ui::test::SetSupportedScaleFactors(supported_scale_factors);
166
167 const GURL page_url(kGenericURL);
168 const GURL icon_url1("http://www.google.com/favicon1.ico");
169 const GURL icon_url2("http://www.google.com/favicon2.ico");
170
171 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
172 ASSERT_TRUE(AllModelsMatchVerifier());
173
174 const BookmarkNode* bookmark0 = AddURL(0, kGenericURLTitle, page_url);
175 ASSERT_TRUE(bookmark0 != NULL);
176 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
177 SetFavicon(0, bookmark0, icon_url1, CreateFavicon(SK_ColorWHITE));
178 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
179 ASSERT_TRUE(AllModelsMatchVerifier());
180
181 const BookmarkNode* bookmark1 = GetUniqueNodeByURL(1, page_url);
182 SetFavicon(1, bookmark1, icon_url1, CreateFavicon(SK_ColorBLUE));
183 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
184 ASSERT_TRUE(AllModelsMatchVerifier());
185
186 SetFavicon(0, bookmark0, icon_url2, CreateFavicon(SK_ColorGREEN));
187 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
188 ASSERT_TRUE(AllModelsMatchVerifier());
189 }
152 190
153 // Test Scribe ID - 370560. 191 // Test Scribe ID - 370560.
154 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddNonHTTPBMs) { 192 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddNonHTTPBMs) {
155 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 193 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
156 ASSERT_TRUE(AllModelsMatchVerifier()); 194 ASSERT_TRUE(AllModelsMatchVerifier());
157 195
158 ASSERT_TRUE(AddURL( 196 ASSERT_TRUE(AddURL(
159 0, L"FTP URL", GURL("ftp://user:password@host:1234/path")) != NULL); 197 0, L"FTP URL", GURL("ftp://user:password@host:1234/path")) != NULL);
160 ASSERT_TRUE(AddURL(0, L"File URL", GURL("file://host/path")) != NULL); 198 ASSERT_TRUE(AddURL(0, L"File URL", GURL("file://host/path")) != NULL);
161 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 199 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
(...skipping 1770 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 1970
1933 // Now add a bookmark within the Synced Bookmarks folder and ensure it syncs 1971 // Now add a bookmark within the Synced Bookmarks folder and ensure it syncs
1934 // over. 1972 // over.
1935 const BookmarkNode* synced_bookmarks = GetSyncedBookmarksNode(0); 1973 const BookmarkNode* synced_bookmarks = GetSyncedBookmarksNode(0);
1936 ASSERT_TRUE(synced_bookmarks); 1974 ASSERT_TRUE(synced_bookmarks);
1937 ASSERT_TRUE(AddURL(0, synced_bookmarks, 0, L"Google2", 1975 ASSERT_TRUE(AddURL(0, synced_bookmarks, 0, L"Google2",
1938 GURL("http://www.google2.com"))); 1976 GURL("http://www.google2.com")));
1939 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 1977 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
1940 ASSERT_TRUE(AllModelsMatch()); 1978 ASSERT_TRUE(AllModelsMatch());
1941 } 1979 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698