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

Unified Diff: chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc

Issue 10546083: Convert ProtocolHandlerRegistry to be a ProfileKeyedService. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Minor docu-changes. Created 8 years, 5 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
« no previous file with comments | « chrome/browser/ui/content_settings/content_setting_bubble_model.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
diff --git a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
index 2f3563e20703f309fc42591b66627490ab105d58..334baf6195e74c941581bcb463053794aa247487 100644
--- a/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
+++ b/chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc
@@ -251,12 +251,12 @@ TEST_F(ContentSettingBubbleModelTest, RegisterProtocolHandler) {
ProtocolHandler::CreateProtocolHandler("mailto",
GURL("http://www.toplevel.example/"), ASCIIToUTF16("Handler")));
- scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
- ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- NULL, tab_contents(), profile(),
- CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS));
+ ContentSettingRPHBubbleModel content_setting_bubble_model(
+ NULL, tab_contents(), profile(), NULL,
+ CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS);
+
const ContentSettingBubbleModel::BubbleContent& bubble_content =
- content_setting_bubble_model->bubble_content();
+ content_setting_bubble_model.bubble_content();
EXPECT_FALSE(bubble_content.title.empty());
EXPECT_FALSE(bubble_content.radio_group.radio_items.empty());
EXPECT_TRUE(bubble_content.popup_items.empty());
@@ -295,7 +295,9 @@ class FakeDelegate : public ProtocolHandlerRegistry::Delegate {
TEST_F(ContentSettingBubbleModelTest, RPHAllow) {
StartIOThread();
- profile()->CreateProtocolHandlerRegistry(new FakeDelegate);
+
+ ProtocolHandlerRegistry registry(profile(), new FakeDelegate());
+ registry.InitProtocolSettings();
const GURL page_url("http://toplevel.example/");
NavigateAndCommit(page_url);
@@ -306,24 +308,21 @@ TEST_F(ContentSettingBubbleModelTest, RPHAllow) {
ASCIIToUTF16("Handler"));
content_settings->set_pending_protocol_handler(test_handler);
- scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
- ContentSettingBubbleModel::CreateContentSettingBubbleModel(
- NULL, tab_contents(), profile(),
- CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS));
+ ContentSettingRPHBubbleModel content_setting_bubble_model(
+ NULL, tab_contents(), profile(), &registry,
+ CONTENT_SETTINGS_TYPE_PROTOCOL_HANDLERS);
{
- ProtocolHandler handler =
- profile()->GetProtocolHandlerRegistry()->GetHandlerFor("mailto");
+ ProtocolHandler handler = registry.GetHandlerFor("mailto");
EXPECT_TRUE(handler.IsEmpty());
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
content_settings->pending_protocol_handler_setting());
}
// "0" is the "Allow" radio button.
- content_setting_bubble_model->OnRadioClicked(0);
+ content_setting_bubble_model.OnRadioClicked(0);
{
- ProtocolHandler handler =
- profile()->GetProtocolHandlerRegistry()->GetHandlerFor("mailto");
+ ProtocolHandler handler = registry.GetHandlerFor("mailto");
ASSERT_FALSE(handler.IsEmpty());
EXPECT_EQ(ASCIIToUTF16("Handler"), handler.title());
EXPECT_EQ(CONTENT_SETTING_ALLOW,
@@ -331,40 +330,34 @@ TEST_F(ContentSettingBubbleModelTest, RPHAllow) {
}
// "1" is the "Deny" radio button.
- content_setting_bubble_model->OnRadioClicked(1);
+ content_setting_bubble_model.OnRadioClicked(1);
{
- ProtocolHandler handler =
- profile()->GetProtocolHandlerRegistry()->GetHandlerFor("mailto");
+ ProtocolHandler handler = registry.GetHandlerFor("mailto");
EXPECT_TRUE(handler.IsEmpty());
EXPECT_EQ(CONTENT_SETTING_BLOCK,
content_settings->pending_protocol_handler_setting());
}
// "2" is the "Ignore button.
- content_setting_bubble_model->OnRadioClicked(2);
+ content_setting_bubble_model.OnRadioClicked(2);
{
- ProtocolHandler handler =
- profile()->GetProtocolHandlerRegistry()->GetHandlerFor("mailto");
+ ProtocolHandler handler = registry.GetHandlerFor("mailto");
EXPECT_TRUE(handler.IsEmpty());
EXPECT_EQ(CONTENT_SETTING_DEFAULT,
content_settings->pending_protocol_handler_setting());
- EXPECT_TRUE(profile()->GetProtocolHandlerRegistry()->IsIgnored(
- test_handler));
+ EXPECT_TRUE(registry.IsIgnored(test_handler));
}
// "0" is the "Allow" radio button.
- content_setting_bubble_model->OnRadioClicked(0);
+ content_setting_bubble_model.OnRadioClicked(0);
{
- ProtocolHandler handler =
- profile()->GetProtocolHandlerRegistry()->GetHandlerFor("mailto");
+ ProtocolHandler handler = registry.GetHandlerFor("mailto");
ASSERT_FALSE(handler.IsEmpty());
EXPECT_EQ(ASCIIToUTF16("Handler"), handler.title());
EXPECT_EQ(CONTENT_SETTING_ALLOW,
content_settings->pending_protocol_handler_setting());
- EXPECT_FALSE(profile()->GetProtocolHandlerRegistry()->IsIgnored(
- test_handler));
+ EXPECT_FALSE(registry.IsIgnored(test_handler));
}
- // This must be done on the UI thread.
- profile()->GetProtocolHandlerRegistry()->Finalize();
+ registry.Shutdown();
}
« no previous file with comments | « chrome/browser/ui/content_settings/content_setting_bubble_model.cc ('k') | chrome/chrome_browser.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698