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

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

Issue 1133463005: Update all bookmarks which use an icon URL when a favicon's bitmap is updated (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@startup_do_not_unexpire
Patch Set: Created 5 years, 6 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
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 "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "chrome/browser/policy/profile_policy_connector_factory.h" 8 #include "chrome/browser/policy/profile_policy_connector_factory.h"
9 #include "chrome/browser/profiles/profile.h" 9 #include "chrome/browser/profiles/profile.h"
10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 10 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
(...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after
272 ASSERT_NE(kNewTitle, kGenericURLTitle); 272 ASSERT_NE(kNewTitle, kGenericURLTitle);
273 const BookmarkNode* bookmark1 = GetUniqueNodeByURL(1, page_url); 273 const BookmarkNode* bookmark1 = GetUniqueNodeByURL(1, page_url);
274 SetTitle(1, bookmark1, kNewTitle); 274 SetTitle(1, bookmark1, kNewTitle);
275 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0))); 275 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
276 ASSERT_TRUE(AllModelsMatchVerifier()); 276 ASSERT_TRUE(AllModelsMatchVerifier());
277 277
278 // The favicon for profile 0 should still be expired. 278 // The favicon for profile 0 should still be expired.
279 CheckFaviconExpired(0, icon_url); 279 CheckFaviconExpired(0, icon_url);
280 } 280 }
281 281
282 // When two bookmarks use the same icon URL, both bookmarks use the same row
283 // in the favicons table in the Favicons database. Test that when the favicon
284 // is updated for one bookmark it is also updated for the other bookmark. This
285 // ensures that sync has the most up to date data and prevents sync from
286 // reverting the newly updated bookmark favicon back to the old favicon.
287 // crbug.com/485657
288 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest,
289 SC_SetFaviconTwoBookmarksSameIconURL) {
290 const GURL page_url1("http://www.google.com/a");
291 const GURL page_url2("http://www.google.com/b");
292
293 const BookmarkNode* bookmark01 = AddURL(0, kGenericURLTitle, page_url1);
294 ASSERT_TRUE(bookmark01 != nullptr);
295 const BookmarkNode* bookmark02 = AddURL(0, kGenericURLTitle, page_url2);
296 ASSERT_TRUE(bookmark02 != nullptr);
297
298 SetFavicon(0, bookmark01, icon_url, CreateFavicon(SK_ColorWHITE),
299 bookmarks_helper::FROM_UI);
300 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
301 ASSERT_TRUE(AllModelsMatchVerifier());
302
303 // Set |page_url2| to use a blue favicon and the same icon URL as
304 // |page_url1|. The favicon for |page_url1| should also become blue.
305 SetFavicon(0, bookmark02, icon_url, CreateFavicon(SK_ColorBLUE),
306 bookmarks_helper::FROM_UI);
307 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
308 ASSERT_TRUE(AllModelsMatchVerifier());
309
310 // Set the title for |page_url1|. This should not revert either of the
311 // bookmark favicons back to white.
312 const char kNewTitle[] = "New Title";
313 ASSERT_STRNE(kGenericURLTitle, kNewTitle);
314 const BookmarkNode* bookmark11 = GetUniqueNodeByURL(1, page_url1);
315 SetTitle(1, bookmark11, std::string(kNewTitle));
316 ASSERT_TRUE(GetClient(1)->AwaitMutualSyncCycleCompletion(GetClient(0)));
317 ASSERT_TRUE(AllModelsMatchVerifier());
318 }
319
282 // Test Scribe ID - 370560. 320 // Test Scribe ID - 370560.
283 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddNonHTTPBMs) { 321 IN_PROC_BROWSER_TEST_F(TwoClientBookmarksSyncTest, SC_AddNonHTTPBMs) {
284 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 322 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
285 ASSERT_TRUE(AllModelsMatchVerifier()); 323 ASSERT_TRUE(AllModelsMatchVerifier());
286 324
287 ASSERT_TRUE(AddURL( 325 ASSERT_TRUE(AddURL(
288 0, "FTP UR", GURL("ftp://user:password@host:1234/path")) != NULL); 326 0, "FTP UR", GURL("ftp://user:password@host:1234/path")) != NULL);
289 ASSERT_TRUE(AddURL(0, "File UR", GURL("file://host/path")) != NULL); 327 ASSERT_TRUE(AddURL(0, "File UR", GURL("file://host/path")) != NULL);
290 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 328 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
291 ASSERT_TRUE(AllModelsMatchVerifier()); 329 ASSERT_TRUE(AllModelsMatchVerifier());
(...skipping 1883 matching lines...) Expand 10 before | Expand all | Expand 10 after
2175 2213
2176 // Verify that the managed bookmark exists in the local model of the first 2214 // Verify that the managed bookmark exists in the local model of the first
2177 // Profile, and has a child node. 2215 // Profile, and has a child node.
2178 ASSERT_EQ(1, managed_node0->child_count()); 2216 ASSERT_EQ(1, managed_node0->child_count());
2179 ASSERT_TRUE(managed_node0->IsVisible()); 2217 ASSERT_TRUE(managed_node0->IsVisible());
2180 EXPECT_EQ(GURL("http://youtube.com/"), managed_node0->GetChild(0)->url()); 2218 EXPECT_EQ(GURL("http://youtube.com/"), managed_node0->GetChild(0)->url());
2181 2219
2182 // Verify that the second Profile didn't get this node. 2220 // Verify that the second Profile didn't get this node.
2183 ASSERT_EQ(0, managed_node1->child_count()); 2221 ASSERT_EQ(0, managed_node1->child_count());
2184 } 2222 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698