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

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

Issue 2510363003: Only activate radio buttons in ContentSettingsBubble for valid content settings. This prevents fail… (Closed)
Patch Set: rebase Created 4 years, 1 month 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/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 866ff283d1def73b31ac6fec197cb09e11315c46..678f30714c0db761c90876ad09e76e93c6061be1 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
@@ -82,6 +82,8 @@ class ContentSettingBubbleModelTest : public ChromeRenderViewHostTestHarness {
};
TEST_F(ContentSettingBubbleModelTest, ImageRadios) {
+ WebContentsTester::For(web_contents())->
+ NavigateAndCommit(GURL("https://www.example.com"));
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents());
content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES);
@@ -99,6 +101,8 @@ TEST_F(ContentSettingBubbleModelTest, ImageRadios) {
}
TEST_F(ContentSettingBubbleModelTest, Cookies) {
+ WebContentsTester::For(web_contents())->
+ NavigateAndCommit(GURL("https://www.example.com"));
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents());
content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES);
@@ -713,6 +717,8 @@ TEST_F(ContentSettingBubbleModelTest, AccumulateMediastreamMicAndCamera) {
}
TEST_F(ContentSettingBubbleModelTest, Plugins) {
+ WebContentsTester::For(web_contents())->
+ NavigateAndCommit(GURL("https://www.example.com"));
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents());
const base::string16 plugin_name = base::ASCIIToUTF16("plugin_name");
@@ -737,6 +743,8 @@ TEST_F(ContentSettingBubbleModelTest, Plugins) {
}
TEST_F(ContentSettingBubbleModelTest, PepperBroker) {
+ WebContentsTester::For(web_contents())->
+ NavigateAndCommit(GURL("https://www.example.com"));
TabSpecificContentSettings* content_settings =
TabSpecificContentSettings::FromWebContents(web_contents());
content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_PPAPI_BROKER);
@@ -953,3 +961,37 @@ TEST_F(ContentSettingBubbleModelTest, SubresourceFilter) {
l10n_util::GetStringUTF8(IDS_FILTERED_DECEPTIVE_CONTENT_PROMPT_RELOAD));
EXPECT_EQ(0U, bubble_content.media_menus.size());
}
+
+TEST_F(ContentSettingBubbleModelTest, ValidUrl) {
+ WebContentsTester::For(web_contents())->
+ NavigateAndCommit(GURL("https://www.example.com"));
+
+ TabSpecificContentSettings* content_settings =
+ TabSpecificContentSettings::FromWebContents(web_contents());
+ content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES);
+
+ std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
+ ContentSettingBubbleModel::CreateContentSettingBubbleModel(
+ NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES));
+ const ContentSettingBubbleModel::BubbleContent& bubble_content =
+ content_setting_bubble_model->bubble_content();
+
+ EXPECT_TRUE(bubble_content.radio_group_enabled);
+}
+
+TEST_F(ContentSettingBubbleModelTest, InvalidUrl) {
+ WebContentsTester::For(web_contents())->
+ NavigateAndCommit(GURL("about:blank"));
+
+ TabSpecificContentSettings* content_settings =
+ TabSpecificContentSettings::FromWebContents(web_contents());
+ content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES);
+
+ std::unique_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
+ ContentSettingBubbleModel::CreateContentSettingBubbleModel(
+ NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES));
+ const ContentSettingBubbleModel::BubbleContent& bubble_content =
+ content_setting_bubble_model->bubble_content();
+
+ EXPECT_FALSE(bubble_content.radio_group_enabled);
+}

Powered by Google App Engine
This is Rietveld 408576698