| 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(), ®istry,
|
| + 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();
|
| }
|
|
|