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

Unified Diff: chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc

Issue 10546083: Convert ProtocolHandlerRegistry to be a ProfileKeyedService. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Respond to review comments. Fit and finish. Created 8 years, 6 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/custom_handlers/protocol_handler_registry_unittest.cc
diff --git a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
index 570b21dc9bc60b0b61f5e18dd9e87192d163b8e3..f1abc49bb867564fabb571de86e9f4818d3ee7c6 100644
--- a/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
+++ b/chrome/browser/custom_handlers/protocol_handler_registry_unittest.cc
@@ -202,7 +202,7 @@ class ProtocolHandlerRegistryTest : public testing::Test {
FakeDelegate* delegate() const { return delegate_; }
TestingProfile* profile() const { return profile_.get(); }
PrefService* pref_service() const { return profile_->GetPrefs(); }
- ProtocolHandlerRegistry* registry() const { return registry_.get(); }
+ ProtocolHandlerRegistry* registry() const { return registry_; }
const ProtocolHandler& test_protocol_handler() const {
return test_protocol_handler_;
}
@@ -222,20 +222,20 @@ class ProtocolHandlerRegistryTest : public testing::Test {
void ReloadProtocolHandlerRegistry() {
delegate_ = new FakeDelegate();
- registry_->Finalize();
+ registry_->Shutdown();
registry_ = NULL;
registry_ = new ProtocolHandlerRegistry(profile(), delegate());
- registry_->Load();
+ registry_->InitProtocolSettings();
}
void ReloadProtocolHandlerRegistryAndInstallDefaultHandler() {
delegate_ = new FakeDelegate();
- registry_->Finalize();
+ registry_->Shutdown();
registry_ = NULL;
registry_ = new ProtocolHandlerRegistry(profile(), delegate());
registry_->AddPredefinedHandler(CreateProtocolHandler(
"test", GURL("http://test.com/%s"), "Test"));
- registry_->Load();
+ registry_->InitProtocolSettings();
}
virtual void SetUp() {
@@ -252,7 +252,7 @@ class ProtocolHandlerRegistryTest : public testing::Test {
profile_->SetPrefService(new TestingPrefService());
delegate_ = new FakeDelegate();
registry_ = new ProtocolHandlerRegistry(profile(), delegate());
- registry_->Load();
+ registry_->InitProtocolSettings();
test_protocol_handler_ =
CreateProtocolHandler("test", GURL("http://test.com/%s"), "Test");
@@ -260,7 +260,7 @@ class ProtocolHandlerRegistryTest : public testing::Test {
}
virtual void TearDown() {
- registry_->Finalize();
+ registry_->Shutdown();
registry_ = NULL;
io_thread_->Stop();
io_thread_.reset(NULL);
@@ -281,7 +281,7 @@ class ProtocolHandlerRegistryTest : public testing::Test {
FakeDelegate* delegate_;
scoped_ptr<TestingProfile> profile_;
- scoped_refptr<ProtocolHandlerRegistry> registry_;
+ ProtocolHandlerRegistry* registry_;
ProtocolHandler test_protocol_handler_;
};
@@ -659,9 +659,10 @@ TEST_F(ProtocolHandlerRegistryTest, TestMaybeCreateTaskWorksFromIOThread) {
ProtocolHandler ph1 = CreateProtocolHandler("mailto", "test1");
registry()->OnAcceptRegisterProtocolHandler(ph1);
GURL url("mailto:someone@something.com");
- scoped_refptr<ProtocolHandlerRegistry> r(registry());
BrowserThread::PostTask(BrowserThread::IO, FROM_HERE,
- base::Bind(MakeRequest, url, r));
+ base::Bind(MakeRequest,
+ url,
+ base::Unretained(registry_)));
MessageLoop::current()->Run();
}
@@ -676,11 +677,10 @@ TEST_F(ProtocolHandlerRegistryTest, TestIsHandledProtocolWorksOnIOThread) {
std::string scheme("mailto");
ProtocolHandler ph1 = CreateProtocolHandler(scheme, "test1");
registry()->OnAcceptRegisterProtocolHandler(ph1);
- scoped_refptr<ProtocolHandlerRegistry> r(registry());
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(CheckIsHandled, scheme, true, r));
+ base::Bind(CheckIsHandled, scheme, true, base::Unretained(registry_)));
}
TEST_F(ProtocolHandlerRegistryTest, TestRemovingDefaultFallsBackToOldDefault) {
@@ -724,12 +724,11 @@ TEST_F(ProtocolHandlerRegistryTest, TestClearDefaultGetsPropagatedToIO) {
ProtocolHandler ph1 = CreateProtocolHandler(scheme, "test1");
registry()->OnAcceptRegisterProtocolHandler(ph1);
registry()->ClearDefault(scheme);
- scoped_refptr<ProtocolHandlerRegistry> r(registry());
BrowserThread::PostTask(
BrowserThread::IO,
FROM_HERE,
- base::Bind(CheckIsHandled, scheme, false, r));
+ base::Bind(CheckIsHandled, scheme, false, base::Unretained(registry_)));
}
static void QuitUILoop() {

Powered by Google App Engine
This is Rietveld 408576698