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

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

Issue 773103004: Remove NOTIFICATION_HISTORY_URLS_DELETED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase to tip Created 5 years, 11 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
Index: chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
index c6cb335fa123a634d92f06f31d07f905ffa3109f..899b2206a0231c843aee5b58bd1fc562d084d32e 100644
--- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
+++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc
@@ -17,9 +17,7 @@
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread.h"
#include "base/time/time.h"
-#include "chrome/browser/chrome_notification_types.h"
#include "chrome/browser/history/history_backend.h"
-#include "chrome/browser/history/history_notifications.h"
#include "chrome/browser/history/history_service.h"
#include "chrome/browser/history/history_service_factory.h"
#include "chrome/browser/invalidation/fake_invalidation_service.h"
@@ -357,6 +355,16 @@ class ProfileSyncServiceTypedUrlTest : public AbstractProfileSyncServiceTest {
rows));
}
+ void SendNotificationURLsDeleted(bool all_history,
+ bool expired,
+ const history::URLRows& deleted_rows,
+ const std::set<GURL>& favicon_urls) {
+ SendNotification(base::Bind(&HistoryBackendNotifier::NotifyURLsDeleted,
+ base::Unretained(history_backend_.get()),
+ all_history, expired, deleted_rows,
+ favicon_urls));
+ }
+
static bool URLsEqual(history::URLRow& lhs, history::URLRow& rhs) {
// Only verify the fields we explicitly sync (i.e. don't verify typed_count
// or visit_count because we rely on the history DB to manage those values
@@ -841,15 +849,11 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeRemove) {
CreateRootHelper create_root(this, syncer::TYPED_URLS);
StartSyncService(create_root.callback());
- history::URLsDeletedDetails changes;
- changes.all_history = false;
- changes.rows.push_back(history::URLRow(GURL("http://mine.com")));
+ history::URLRows rows;
+ rows.push_back(history::URLRow(GURL("http://mine.com")));
scoped_refptr<ThreadNotifier> notifier(
new ThreadNotifier(history_thread_.get()));
- notifier->Notify(chrome::NOTIFICATION_HISTORY_URLS_DELETED,
- content::Source<Profile>(profile_),
- content::Details<history::URLsDeletedDetails>(&changes));
-
+ SendNotificationURLsDeleted(false, false, rows, std::set<GURL>());
history::URLRows new_sync_entries;
GetTypedUrlsFromSyncDB(&new_sync_entries);
ASSERT_EQ(1U, new_sync_entries.size());
@@ -878,17 +882,12 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeRemoveExpired) {
CreateRootHelper create_root(this, syncer::TYPED_URLS);
StartSyncService(create_root.callback());
- history::URLsDeletedDetails changes;
- changes.all_history = false;
// Setting expired=true should cause the sync code to ignore this deletion.
- changes.expired = true;
- changes.rows.push_back(history::URLRow(GURL("http://mine.com")));
+ history::URLRows rows;
+ rows.push_back(history::URLRow(GURL("http://mine.com")));
scoped_refptr<ThreadNotifier> notifier(
new ThreadNotifier(history_thread_.get()));
- notifier->Notify(chrome::NOTIFICATION_HISTORY_URLS_DELETED,
- content::Source<Profile>(profile_),
- content::Details<history::URLsDeletedDetails>(&changes));
-
+ SendNotificationURLsDeleted(false, true, rows, std::set<GURL>());
history::URLRows new_sync_entries;
GetTypedUrlsFromSyncDB(&new_sync_entries);
// Both URLs should still be there.
@@ -921,13 +920,10 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeRemoveAll) {
GetTypedUrlsFromSyncDB(&new_sync_entries);
ASSERT_EQ(2U, new_sync_entries.size());
- history::URLsDeletedDetails changes;
- changes.all_history = true;
scoped_refptr<ThreadNotifier> notifier(
new ThreadNotifier(history_thread_.get()));
- notifier->Notify(chrome::NOTIFICATION_HISTORY_URLS_DELETED,
- content::Source<Profile>(profile_),
- content::Details<history::URLsDeletedDetails>(&changes));
+ SendNotificationURLsDeleted(true, false, history::URLRows(),
+ std::set<GURL>());
GetTypedUrlsFromSyncDB(&new_sync_entries);
ASSERT_EQ(0U, new_sync_entries.size());
« no previous file with comments | « chrome/browser/sync/glue/typed_url_change_processor.cc ('k') | chrome/browser/ui/cocoa/history_menu_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698