| 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "chrome/browser/api/infobars/infobar_delegate.h" | 8 #include "chrome/browser/api/infobars/infobar_delegate.h" |
| 9 #include "chrome/browser/api/infobars/infobar_service.h" | 9 #include "chrome/browser/api/infobars/infobar_service.h" |
| 10 #include "chrome/browser/content_settings/host_content_settings_map.h" | 10 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 } | 96 } |
| 97 | 97 |
| 98 TEST_F(ContentSettingBubbleModelTest, Cookies) { | 98 TEST_F(ContentSettingBubbleModelTest, Cookies) { |
| 99 TabSpecificContentSettings* content_settings = | 99 TabSpecificContentSettings* content_settings = |
| 100 TabSpecificContentSettings::FromWebContents(web_contents()); | 100 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 101 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, | 101 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, |
| 102 std::string()); | 102 std::string()); |
| 103 | 103 |
| 104 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 104 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
| 105 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 105 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 106 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); | 106 NULL, web_contents(), profile(), |
| 107 CONTENT_SETTINGS_TYPE_COOKIES)); |
| 107 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 108 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| 108 content_setting_bubble_model->bubble_content(); | 109 content_setting_bubble_model->bubble_content(); |
| 109 std::string title = bubble_content.title; | 110 EXPECT_FALSE(bubble_content.title.empty()); |
| 110 EXPECT_FALSE(title.empty()); | 111 EXPECT_FALSE(bubble_content.radio_group.radio_items.empty()); |
| 111 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); | |
| 112 std::string radio1 = bubble_content.radio_group.radio_items[0]; | |
| 113 std::string radio2 = bubble_content.radio_group.radio_items[1]; | |
| 114 EXPECT_FALSE(bubble_content.custom_link.empty()); | 112 EXPECT_FALSE(bubble_content.custom_link.empty()); |
| 115 EXPECT_TRUE(bubble_content.custom_link_enabled); | 113 EXPECT_TRUE(bubble_content.custom_link_enabled); |
| 116 EXPECT_FALSE(bubble_content.manage_link.empty()); | 114 EXPECT_FALSE(bubble_content.manage_link.empty()); |
| 117 | |
| 118 content_settings->ClearCookieSpecificContentSettings(); | |
| 119 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | |
| 120 content_setting_bubble_model.reset( | |
| 121 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | |
| 122 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); | |
| 123 const ContentSettingBubbleModel::BubbleContent& bubble_content_2 = | |
| 124 content_setting_bubble_model->bubble_content(); | |
| 125 | |
| 126 EXPECT_FALSE(bubble_content_2.title.empty()); | |
| 127 EXPECT_NE(title, bubble_content_2.title); | |
| 128 ASSERT_EQ(2U, bubble_content_2.radio_group.radio_items.size()); | |
| 129 // TODO(bauerb): Update this once the strings have been updated. | |
| 130 EXPECT_EQ(radio1, bubble_content_2.radio_group.radio_items[0]); | |
| 131 EXPECT_EQ(radio2, bubble_content_2.radio_group.radio_items[1]); | |
| 132 EXPECT_FALSE(bubble_content_2.custom_link.empty()); | |
| 133 EXPECT_TRUE(bubble_content_2.custom_link_enabled); | |
| 134 EXPECT_FALSE(bubble_content_2.manage_link.empty()); | |
| 135 } | 115 } |
| 136 | 116 |
| 137 TEST_F(ContentSettingBubbleModelTest, Mediastream) { | 117 TEST_F(ContentSettingBubbleModelTest, Mediastream) { |
| 138 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 118 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
| 139 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 119 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 140 NULL, web_contents(), profile(), | 120 NULL, web_contents(), profile(), |
| 141 CONTENT_SETTINGS_TYPE_MEDIASTREAM)); | 121 CONTENT_SETTINGS_TYPE_MEDIASTREAM)); |
| 142 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 122 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| 143 content_setting_bubble_model->bubble_content(); | 123 content_setting_bubble_model->bubble_content(); |
| 144 EXPECT_FALSE(bubble_content.title.empty()); | 124 EXPECT_FALSE(bubble_content.title.empty()); |
| (...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 525 ProtocolHandler handler = registry.GetHandlerFor("mailto"); | 505 ProtocolHandler handler = registry.GetHandlerFor("mailto"); |
| 526 ASSERT_FALSE(handler.IsEmpty()); | 506 ASSERT_FALSE(handler.IsEmpty()); |
| 527 EXPECT_EQ(ASCIIToUTF16("Handler"), handler.title()); | 507 EXPECT_EQ(ASCIIToUTF16("Handler"), handler.title()); |
| 528 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 508 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 529 content_settings->pending_protocol_handler_setting()); | 509 content_settings->pending_protocol_handler_setting()); |
| 530 EXPECT_FALSE(registry.IsIgnored(test_handler)); | 510 EXPECT_FALSE(registry.IsIgnored(test_handler)); |
| 531 } | 511 } |
| 532 | 512 |
| 533 registry.Shutdown(); | 513 registry.Shutdown(); |
| 534 } | 514 } |
| OLD | NEW |