summaryrefslogtreecommitdiffstats
path: root/chrome/browser/intents
diff options
context:
space:
mode:
authorrlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-14 23:49:46 +0000
committerrlp@chromium.org <rlp@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-14 23:49:46 +0000
commitd07edd42ce09a444f435c0dcffd4a123dc6f31b9 (patch)
tree171e5756c9b49514e7fe6ab43cb1ecd60e0acd4f /chrome/browser/intents
parentb6da6b187ffec9d19a990c0c058864571bd01a8e (diff)
downloadchromium_src-d07edd42ce09a444f435c0dcffd4a123dc6f31b9.zip
chromium_src-d07edd42ce09a444f435c0dcffd4a123dc6f31b9.tar.gz
chromium_src-d07edd42ce09a444f435c0dcffd4a123dc6f31b9.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 Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=136499 Review URL: https://chromiumcodereview.appspot.com/10185008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@137014 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/intents')
-rw-r--r--chrome/browser/intents/register_intent_handler_infobar_delegate_unittest.cc15
-rw-r--r--chrome/browser/intents/web_intents_registry_factory.cc7
-rw-r--r--chrome/browser/intents/web_intents_registry_unittest.cc14
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();