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

Unified Diff: chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc

Issue 15927029: Replace WebDatabaseObserver with callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 7 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/glue/autofill_data_type_controller_unittest.cc
diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
index 1f7238658096503465812d353304beca3781a9ea..ce020f96c5438e8d0c995135f8ec2803a821d5db 100644
--- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
@@ -21,7 +21,6 @@
#include "chrome/test/base/profile_mock.h"
#include "components/autofill/browser/webdata/autofill_webdata_service.h"
#include "components/webdata/common/web_data_service_test_util.h"
-#include "components/webdata/common/web_database_observer.h"
#include "content/public/browser/notification_service.h"
#include "content/public/browser/notification_source.h"
#include "content/public/browser/notification_types.h"
@@ -61,34 +60,24 @@ class FakeWebDataService : public AutofillWebDataService {
FakeWebDataService()
: AutofillWebDataService(),
is_database_loaded_(false),
- observer_(NULL) {}
+ db_loaded_callback_(base::Callback<void(void)>()){}
// Mark the database as loaded and send out the appropriate notification.
void LoadDatabase() {
StartSyncableService();
is_database_loaded_ = true;
- if (observer_)
- observer_->WebDatabaseLoaded();
+
+ if (!db_loaded_callback_.is_null())
+ db_loaded_callback_.Run();
}
virtual bool IsDatabaseLoaded() OVERRIDE {
return is_database_loaded_;
}
- // Note: this implementation violates the contract for AddDBObserver (which
- // should support having multiple observers at the same time), however, it
- // is the simplest thing that works for the purpose of the unit test, which
- // only registers one observer.
- virtual void AddDBObserver(WebDatabaseObserver* observer) OVERRIDE {
- DCHECK(!observer_);
- observer_ = observer;
- }
-
- virtual void RemoveDBObserver(WebDatabaseObserver* observer) OVERRIDE {
- if (!observer_)
- return;
- DCHECK_EQ(observer_, observer);
- observer_ = NULL;
+ virtual void RegisterDBLoadedCallback(
+ const base::Callback<void(void)>& callback) OVERRIDE {
+ db_loaded_callback_ = callback;
}
void StartSyncableService() {
@@ -131,7 +120,7 @@ class FakeWebDataService : public AutofillWebDataService {
bool is_database_loaded_;
NoOpAutofillBackend autofill_backend_;
- WebDatabaseObserver* observer_;
+ base::Callback<void(void)> db_loaded_callback_;
DISALLOW_COPY_AND_ASSIGN(FakeWebDataService);
};

Powered by Google App Engine
This is Rietveld 408576698