diff options
author | rlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 03:54:15 +0000 |
---|---|---|
committer | rlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-05-11 03:54:15 +0000 |
commit | ba30c18a957290ff02ab9872a1a9dd8c4ee2f14a (patch) | |
tree | b7e5213fb01b0f422bb2fd0eb7da523c08de717a /chrome/browser/intents | |
parent | 2a6f339074bff557adb5253d7165b493a5d758ee (diff) | |
download | chromium_src-ba30c18a957290ff02ab9872a1a9dd8c4ee2f14a.zip chromium_src-ba30c18a957290ff02ab9872a1a9dd8c4ee2f14a.tar.gz chromium_src-ba30c18a957290ff02ab9872a1a9dd8c4ee2f14a.tar.bz2 |
Taking over issue 10006037.
Moved WebDataService to ProfileKeyedService
James:
chrome\browser\ui\intents
Peter:
chrome\browser\ui\search_engines
chrome\browser\search_engines
Nicolas:
chrome\browser\sync
Rachel/Elliot:
chrome\browser\profiles and the whole cl
BUG=112234
TEST=unit-tests
TBR=jhawkins@chromium.org,pkasting@chromium.org,zea@chromium.org,erg@chromium.org,isherman@chromium.org
Review URL: https://chromiumcodereview.appspot.com/10185008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136499 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/intents')
3 files changed, 28 insertions, 8 deletions
diff --git a/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc b/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc index 559a09e..41986ca 100644 --- a/chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc +++ b/chrome/browser/intents/register_intent_handler_infobar_delegate_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/synchronization/waitable_event.h" #include "base/utf_string_conversions.h" #include "chrome/browser/intents/register_intent_handler_infobar_delegate.h" #include "chrome/browser/intents/web_intents_registry.h" @@ -38,12 +39,14 @@ class RegisterIntentHandlerInfoBarDelegateTest : public TabContentsWrapperTestHarness { protected: RegisterIntentHandlerInfoBarDelegateTest() - : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()) {} + : ui_thread_(BrowserThread::UI, MessageLoopForUI::current()), + db_thread_(BrowserThread::DB) {} virtual void SetUp() { + db_thread_.Start(); TabContentsWrapperTestHarness::SetUp(); - profile()->CreateWebDataService(false); + profile()->CreateWebDataService(); web_intents_registry_ = BuildForProfile(profile()); } @@ -51,12 +54,20 @@ class RegisterIntentHandlerInfoBarDelegateTest web_intents_registry_ = NULL; TabContentsWrapperTestHarness::TearDown(); + // Schedule another task on the DB thread to notify us that it's safe to + // carry on with the test. + base::WaitableEvent done(false, false); + BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, + base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); + done.Wait(); + db_thread_.Stop(); } MockWebIntentsRegistry* web_intents_registry_; private: content::TestBrowserThread ui_thread_; + content::TestBrowserThread db_thread_; DISALLOW_COPY_AND_ASSIGN(RegisterIntentHandlerInfoBarDelegateTest); }; diff --git a/chrome/browser/intents/web_intents_registry_factory.cc b/chrome/browser/intents/web_intents_registry_factory.cc index f6e75c9..7bbbdb4 100644 --- a/chrome/browser/intents/web_intents_registry_factory.cc +++ b/chrome/browser/intents/web_intents_registry_factory.cc @@ -9,6 +9,7 @@ #include "chrome/browser/intents/web_intents_registry.h" #include "chrome/browser/profiles/profile.h" #include "chrome/browser/profiles/profile_dependency_manager.h" +#include "chrome/browser/webdata/web_data_service_factory.h" // static WebIntentsRegistry* WebIntentsRegistryFactory::GetForProfile(Profile* profile) { @@ -19,8 +20,7 @@ WebIntentsRegistry* WebIntentsRegistryFactory::GetForProfile(Profile* profile) { WebIntentsRegistryFactory::WebIntentsRegistryFactory() : ProfileKeyedServiceFactory("WebIntentsRegistry", ProfileDependencyManager::GetInstance()) { - // TODO(erg): For Shutdown() order, we need to: - // DependsOn(WebDataServiceFactory::GetInstance()); + DependsOn(WebDataServiceFactory::GetInstance()); DependsOn(ExtensionSystemFactory::GetInstance()); } @@ -35,7 +35,8 @@ WebIntentsRegistryFactory* WebIntentsRegistryFactory::GetInstance() { ProfileKeyedService* WebIntentsRegistryFactory::BuildServiceInstanceFor( Profile* profile) const { WebIntentsRegistry* registry = new WebIntentsRegistry; - registry->Initialize(profile->GetWebDataService(Profile::EXPLICIT_ACCESS), + registry->Initialize(WebDataServiceFactory::GetForProfile( + profile, Profile::EXPLICIT_ACCESS), profile->GetExtensionService()); return registry; } diff --git a/chrome/browser/intents/web_intents_registry_unittest.cc b/chrome/browser/intents/web_intents_registry_unittest.cc index 0554029..fb4eaf5 100644 --- a/chrome/browser/intents/web_intents_registry_unittest.cc +++ b/chrome/browser/intents/web_intents_registry_unittest.cc @@ -8,6 +8,7 @@ #include "base/message_loop.h" #include "base/path_service.h" #include "base/scoped_temp_dir.h" +#include "base/synchronization/waitable_event.h" #include "base/utf_string_conversions.h" #include "chrome/browser/extensions/test_extension_service.h" #include "chrome/browser/intents/default_web_intent_service.h" @@ -102,9 +103,16 @@ class WebIntentsRegistryTest : public testing::Test { } virtual void TearDown() { - if (wds_.get()) - wds_->Shutdown(); - + // Clear all references to wds to force it destruction. + wds_->ShutdownOnUIThread(); + wds_ = NULL; + + // Schedule another task on the DB thread to notify us that it's safe to + // carry on with the test. + base::WaitableEvent done(false, false); + BrowserThread::PostTask(BrowserThread::DB, FROM_HERE, + base::Bind(&base::WaitableEvent::Signal, base::Unretained(&done))); + done.Wait(); db_thread_.Stop(); MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); MessageLoop::current()->Run(); |