OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map.h" |
9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 9 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
10 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" | 10 #include "chrome/browser/custom_handlers/protocol_handler_registry.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 CONTENT_SETTINGS_TYPE_IMAGES)); | 64 CONTENT_SETTINGS_TYPE_IMAGES)); |
65 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 65 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
66 content_setting_bubble_model->bubble_content(); | 66 content_setting_bubble_model->bubble_content(); |
67 EXPECT_FALSE(bubble_content.title.empty()); | 67 EXPECT_FALSE(bubble_content.title.empty()); |
68 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 68 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
69 EXPECT_EQ(0, bubble_content.radio_group.default_item); | 69 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
70 EXPECT_TRUE(bubble_content.custom_link.empty()); | 70 EXPECT_TRUE(bubble_content.custom_link.empty()); |
71 EXPECT_FALSE(bubble_content.manage_link.empty()); | 71 EXPECT_FALSE(bubble_content.manage_link.empty()); |
72 } | 72 } |
73 | 73 |
| 74 TEST_F(ContentSettingBubbleModelTest, MediaRadios) { |
| 75 TabSpecificContentSettings* content_settings = |
| 76 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 77 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_MEDIA); |
| 78 |
| 79 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
| 80 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 81 NULL, web_contents(), profile(), |
| 82 CONTENT_SETTINGS_TYPE_MEDIA)); |
| 83 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| 84 content_setting_bubble_model->bubble_content(); |
| 85 EXPECT_FALSE(bubble_content.title.empty()); |
| 86 EXPECT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
| 87 EXPECT_EQ(0, bubble_content.radio_group.default_item); |
| 88 EXPECT_TRUE(bubble_content.custom_link.empty()); |
| 89 EXPECT_FALSE(bubble_content.manage_link.empty()); |
| 90 } |
| 91 |
74 TEST_F(ContentSettingBubbleModelTest, Cookies) { | 92 TEST_F(ContentSettingBubbleModelTest, Cookies) { |
75 TabSpecificContentSettings* content_settings = | 93 TabSpecificContentSettings* content_settings = |
76 TabSpecificContentSettings::FromWebContents(web_contents()); | 94 TabSpecificContentSettings::FromWebContents(web_contents()); |
77 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); | 95 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
78 | 96 |
79 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 97 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
80 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 98 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
81 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); | 99 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); |
82 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 100 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
83 content_setting_bubble_model->bubble_content(); | 101 content_setting_bubble_model->bubble_content(); |
(...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
661 { | 679 { |
662 ProtocolHandler handler = registry.GetHandlerFor("mailto"); | 680 ProtocolHandler handler = registry.GetHandlerFor("mailto"); |
663 ASSERT_FALSE(handler.IsEmpty()); | 681 ASSERT_FALSE(handler.IsEmpty()); |
664 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 682 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
665 content_settings->pending_protocol_handler_setting()); | 683 content_settings->pending_protocol_handler_setting()); |
666 EXPECT_FALSE(registry.IsIgnored(test_handler)); | 684 EXPECT_FALSE(registry.IsIgnored(test_handler)); |
667 } | 685 } |
668 | 686 |
669 registry.Shutdown(); | 687 registry.Shutdown(); |
670 } | 688 } |
OLD | NEW |