| 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 4a1e28cae1b5a20a3daffe747c242b4852071410..f4c3a74d4715e5222cf665858b889b0a6ec6764b 100644
|
| --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
|
| +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc
|
| @@ -2,6 +2,7 @@
|
| // Use of this source code is governed by a BSD-style license that can be
|
| // found in the LICENSE file.
|
|
|
| +#include "base/bind.h"
|
| #include "base/callback.h"
|
| #include "base/compiler_specific.h"
|
| #include "base/memory/ref_counted.h"
|
| @@ -61,12 +62,13 @@ class FakeWebDataService : public WebDataService {
|
| }
|
|
|
| virtual void ShutdownOnUIThread() OVERRIDE {
|
| - ShutdownSyncableService();
|
| - }
|
| -
|
| - virtual AutocompleteSyncableService*
|
| - GetAutocompleteSyncableService() const OVERRIDE {
|
| - return autocomplete_syncable_service_;
|
| + // The storage for syncable services must be destructed on the DB
|
| + // thread.
|
| + base::RunLoop run_loop;
|
| + BrowserThread::PostTaskAndReply(BrowserThread::DB, FROM_HERE,
|
| + base::Bind(&FakeWebDataService::ShutdownOnDBThread,
|
| + base::Unretained(this)), run_loop.QuitClosure());
|
| + run_loop.Run();
|
| }
|
|
|
| void StartSyncableService() {
|
| @@ -80,18 +82,12 @@ class FakeWebDataService : public WebDataService {
|
| }
|
|
|
| void ShutdownSyncableService() {
|
| - // The |autofill_profile_syncable_service_| must be destructed on the DB
|
| - // thread.
|
| - base::RunLoop run_loop;
|
| - BrowserThread::PostTaskAndReply(BrowserThread::DB, FROM_HERE,
|
| - base::Bind(&FakeWebDataService::DestroySyncableService,
|
| - base::Unretained(this)), run_loop.QuitClosure());
|
| - run_loop.Run();
|
| }
|
|
|
| void GetAutofillCullingValue(bool* result) {
|
| ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
|
| - *result = autocomplete_syncable_service_->cull_expired_entries();
|
| + *result = AutocompleteSyncableService::FromWebDataService(
|
| + this)->cull_expired_entries();
|
| }
|
|
|
| bool CheckAutofillCullingValue() {
|
| @@ -106,25 +102,15 @@ class FakeWebDataService : public WebDataService {
|
|
|
| private:
|
| virtual ~FakeWebDataService() {
|
| - DCHECK(!autocomplete_syncable_service_);
|
| + DCHECK(!AutocompleteSyncableService::FromWebDataService(this));
|
| }
|
|
|
| void CreateSyncableService() {
|
| ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
|
| // These services are deleted in DestroySyncableService().
|
| - autocomplete_syncable_service_ = new AutocompleteSyncableService(this);
|
| + AutocompleteSyncableService::CreateForWebDataService(this);
|
| }
|
|
|
| - void DestroySyncableService() {
|
| - ASSERT_TRUE(BrowserThread::CurrentlyOn(BrowserThread::DB));
|
| - delete autocomplete_syncable_service_;
|
| - autocomplete_syncable_service_ = NULL;
|
| - }
|
| -
|
| - // We own the syncable services, but don't use a |scoped_ptr| because the
|
| - // lifetime must be managed on the DB thread.
|
| - AutocompleteSyncableService* autocomplete_syncable_service_;
|
| -
|
| bool is_database_loaded_;
|
|
|
| DISALLOW_COPY_AND_ASSIGN(FakeWebDataService);
|
|
|