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

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

Issue 14103021: Use Observer to notify of WebDB load instead of callbacks (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge and fix WIN Created 7 years, 8 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 9700e10de3c06a22986710227fd8d5137449976b..d1689ecf680fa77fb25d3466ec530ca591d66638 100644
--- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
+++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
@@ -21,6 +21,7 @@
#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"
@@ -46,13 +47,15 @@ class FakeWebDataService : public AutofillWebDataService {
FakeWebDataService()
: AutofillWebDataService(
NULL, WebDataServiceBase::ProfileErrorCallback()),
- is_database_loaded_(false) {}
+ is_database_loaded_(false),
+ observer_(NULL) {}
// Mark the database as loaded and send out the appropriate notification.
void LoadDatabase() {
StartSyncableService();
is_database_loaded_ = true;
- NotifyDatabaseLoadedOnUIThread();
+ if (observer_)
+ observer_->WebDatabaseLoaded();
}
virtual bool IsDatabaseLoaded() OVERRIDE {
@@ -69,6 +72,16 @@ class FakeWebDataService : public AutofillWebDataService {
run_loop.Run();
}
+ virtual void AddDBObserver(WebDatabaseObserver* observer) OVERRIDE {
Jói 2013/04/17 10:52:04 Might be worth a comment saying this implementatio
Cait (Slow) 2013/04/18 15:07:48 Done.
+ observer_ = observer;
+ }
+
+ virtual void RemoveDBObserver(WebDatabaseObserver* observer) OVERRIDE {
+ if (observer_ == observer) {
+ observer_ = NULL;
+ }
+ }
+
void StartSyncableService() {
// The |autofill_profile_syncable_service_| must be constructed on the DB
// thread.
@@ -107,6 +120,8 @@ class FakeWebDataService : public AutofillWebDataService {
bool is_database_loaded_;
+ WebDatabaseObserver* observer_;
+
DISALLOW_COPY_AND_ASSIGN(FakeWebDataService);
};

Powered by Google App Engine
This is Rietveld 408576698