Chromium Code Reviews| 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 e610488b632aaf95488edb2abca821a42e7ed20f..7e00449a8fc0891de54d2f5d6d28ae5ed929915e 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 |
| @@ -234,9 +234,49 @@ TEST_F(ContentSettingBubbleModelTest, BlockedMediastreamMicAndCamera) { |
| CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
| std::string())); |
| - InfoBarService* infobar_service = |
| - InfoBarService::FromWebContents(web_contents()); |
| - infobar_service->RemoveInfoBar(infobar_service->infobar_at(0)); |
| + { |
| + scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
|
Peter Kasting
2014/09/22 23:11:23
Nit: Would it make sense to make this added code i
robwu
2014/09/24 00:03:04
Done. I have added two tests. One of them is for t
|
| + ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| + NULL, web_contents(), profile(), |
| + CONTENT_SETTINGS_TYPE_MEDIASTREAM)); |
| + const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| + content_setting_bubble_model->bubble_content(); |
| + // Test that the reload hint is displayed. |
| + EXPECT_FALSE(bubble_content.custom_link_enabled); |
| + EXPECT_EQ(bubble_content.custom_link, l10n_util::GetStringUTF8( |
| + IDS_MEDIASTREAM_SETTING_CHANGED_INFOBAR_MESSAGE)); |
| + |
| + EXPECT_EQ(0, bubble_content.radio_group.default_item); |
| + // Restore the radio setting (to block). |
| + content_setting_bubble_model->OnRadioClicked(1); |
| + } |
| + // Test that the media settings were changed again. |
| + EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| + host_content_settings_map->GetContentSetting( |
| + url, |
| + url, |
| + CONTENT_SETTINGS_TYPE_MEDIASTREAM_MIC, |
| + std::string())); |
| + EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| + host_content_settings_map->GetContentSetting( |
| + url, |
| + url, |
| + CONTENT_SETTINGS_TYPE_MEDIASTREAM_CAMERA, |
| + std::string())); |
| + |
| + { |
| + scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
| + ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| + NULL, web_contents(), profile(), |
| + CONTENT_SETTINGS_TYPE_MEDIASTREAM)); |
| + const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| + content_setting_bubble_model->bubble_content(); |
| + // Test that the reload hint is not displayed any more. |
| + EXPECT_FALSE(bubble_content.custom_link_enabled); |
| + EXPECT_TRUE(bubble_content.custom_link.empty()); |
| + |
| + EXPECT_EQ(1, bubble_content.radio_group.default_item); |
| + } |
| } |
| TEST_F(ContentSettingBubbleModelTest, MediastreamMic) { |