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

Unified Diff: chrome/browser/sync/profile_sync_service_typed_url_unittest.cc

Issue 10802060: Ignore file URLs from being synced (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/sync/glue/typed_url_model_associator.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
===================================================================
--- chrome/browser/sync/profile_sync_service_typed_url_unittest.cc (revision 149878)
+++ chrome/browser/sync/profile_sync_service_typed_url_unittest.cc (working copy)
@@ -947,3 +947,54 @@
// Can't check GetErrorPercentage(), because generating an unrecoverable
// error will free the model associator.
}
+TEST_F(ProfileSyncServiceTypedUrlTest, IgnoreLocalFileURL) {
+ history::VisitVector original_visits;
+ // Create http and file url.
+ history::URLRow url_entry(MakeTypedUrlEntry("http://yey.com",
+ "yey", 12, 15, false,
+ &original_visits));
+ history::URLRow file_entry(MakeTypedUrlEntry("file:///kitty.jpg",
+ "kitteh", 12, 15, false,
+ &original_visits));
+
+ history::URLRows original_entries;
+ original_entries.push_back(url_entry);
+ original_entries.push_back(file_entry);
+
+ EXPECT_CALL((*history_backend_.get()), GetAllTypedURLs(_)).
+ WillRepeatedly(DoAll(SetArgumentPointee<0>(original_entries),
+ Return(true)));
+ EXPECT_CALL((*history_backend_.get()), GetMostRecentVisitsForURL(_, _, _)).
+ WillRepeatedly(DoAll(SetArgumentPointee<2>(original_visits),
+ Return(true)));
+ CreateRootHelper create_root(this, syncer::TYPED_URLS);
+ StartSyncService(create_root.callback());
+
+ history::VisitVector updated_visits;
+ // Create updates for the previous urls + a new file one.
+ history::URLRow updated_url_entry(MakeTypedUrlEntry("http://yey.com",
+ "yey", 20, 15, false,
+ &updated_visits));
+ history::URLRow updated_file_entry(MakeTypedUrlEntry("file:///cat.jpg",
+ "cat", 20, 15, false,
+ &updated_visits));
+ history::URLRow new_file_entry(MakeTypedUrlEntry("file:///dog.jpg",
+ "dog", 20, 15, false,
+ &updated_visits));
+ history::URLsModifiedDetails details;
+ details.changed_urls.push_back(updated_url_entry);
+ details.changed_urls.push_back(updated_file_entry);
+ details.changed_urls.push_back(new_file_entry);
+ scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_));
+ notifier->Notify(chrome::NOTIFICATION_HISTORY_URLS_MODIFIED,
+ content::Source<Profile>(&profile_),
+ content::Details<history::URLsModifiedDetails>(&details));
+
+ history::URLRows new_sync_entries;
+ GetTypedUrlsFromSyncDB(&new_sync_entries);
+
+ // We should ignore the local file urls (existing and updated),
+ // and only be left with the updated http url.
+ ASSERT_EQ(1U, new_sync_entries.size());
+ EXPECT_TRUE(URLsEqual(updated_url_entry, new_sync_entries[0]));
+}
« no previous file with comments | « chrome/browser/sync/glue/typed_url_model_associator.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698