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

Unified Diff: components/autofill/browser/webdata/web_data_service_unittest.cc

Issue 14081043: Hook up Autofill Backend interface to SyncableServices (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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: components/autofill/browser/webdata/web_data_service_unittest.cc
diff --git a/components/autofill/browser/webdata/web_data_service_unittest.cc b/components/autofill/browser/webdata/web_data_service_unittest.cc
index 362f828c660dba1ab15059b2623c440ac3b2e014..a6d0cae701537f792bca7f0cc86b146433e92c87 100644
--- a/components/autofill/browser/webdata/web_data_service_unittest.cc
+++ b/components/autofill/browser/webdata/web_data_service_unittest.cc
@@ -20,6 +20,7 @@
#include "components/autofill/browser/autofill_country.h"
#include "components/autofill/browser/autofill_profile.h"
#include "components/autofill/browser/credit_card.h"
+#include "components/autofill/browser/webdata/autofill_backend_delegate.h"
#include "components/autofill/browser/webdata/autofill_change.h"
#include "components/autofill/browser/webdata/autofill_entry.h"
#include "components/autofill/browser/webdata/autofill_table.h"
@@ -128,24 +129,18 @@ class WebDataServiceAutofillTest : public WebDataServiceTest {
value1_ = ASCIIToUTF16("value1");
value2_ = ASCIIToUTF16("value2");
- void(AutofillWebDataService::*add_observer_func)(
- AutofillWebDataServiceObserverOnDBThread*) =
- &AutofillWebDataService::AddObserver;
- BrowserThread::PostTask(
- BrowserThread::DB,
- FROM_HERE,
- base::Bind(add_observer_func, wds_, &observer_));
+ wds_->GetDelegateOnDB(
+ base::Bind(&WebDataServiceAutofillTest::OnGetDelegate,
+ base::Unretained(this)));
WaitForDatabaseThread();
}
virtual void TearDown() {
- void(AutofillWebDataService::*remove_observer_func)(
- AutofillWebDataServiceObserverOnDBThread*) =
- &AutofillWebDataService::RemoveObserver;
BrowserThread::PostTask(
BrowserThread::DB,
FROM_HERE,
- base::Bind(remove_observer_func, wds_, &observer_));
+ base::Bind(&WebDataServiceAutofillTest::ClearDelegate,
+ base::Unretained(this)));
WaitForDatabaseThread();
WebDataServiceTest::TearDown();
@@ -160,6 +155,16 @@ class WebDataServiceAutofillTest : public WebDataServiceTest {
form_fields->push_back(field);
}
+ void OnGetDelegate(AutofillBackendDelegate* delegate) {
+ delegate_ = delegate;
+ delegate_->AddObserver(&observer_);
+ }
+
+ void ClearDelegate() {
+ delegate_->RemoveObserver(&observer_);
+ delegate_ = NULL;
+ }
+
base::string16 name1_;
base::string16 name2_;
base::string16 value1_;
@@ -167,6 +172,7 @@ class WebDataServiceAutofillTest : public WebDataServiceTest {
int unique_id1_, unique_id2_;
const TimeDelta test_timeout_;
testing::NiceMock<MockAutofillWebDataServiceObserver> observer_;
+ AutofillBackendDelegate* delegate_;
WaitableEvent done_event_;
};

Powered by Google App Engine
This is Rietveld 408576698