| 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/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 91 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); | 91 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); |
| 92 | 92 |
| 93 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( | 93 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( |
| 94 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 94 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 95 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); | 95 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); |
| 96 const ContentSettingBubbleModel::BubbleContent& bubble_content = | 96 const ContentSettingBubbleModel::BubbleContent& bubble_content = |
| 97 content_setting_bubble_model->bubble_content(); | 97 content_setting_bubble_model->bubble_content(); |
| 98 std::string title = bubble_content.title; | 98 std::string title = bubble_content.title; |
| 99 EXPECT_FALSE(title.empty()); | 99 EXPECT_FALSE(title.empty()); |
| 100 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); | 100 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size()); |
| 101 std::string radio1 = bubble_content.radio_group.radio_items[0]; | |
| 102 std::string radio2 = bubble_content.radio_group.radio_items[1]; | |
| 103 EXPECT_FALSE(bubble_content.custom_link.empty()); | 101 EXPECT_FALSE(bubble_content.custom_link.empty()); |
| 104 EXPECT_TRUE(bubble_content.custom_link_enabled); | 102 EXPECT_TRUE(bubble_content.custom_link_enabled); |
| 105 EXPECT_FALSE(bubble_content.manage_link.empty()); | 103 EXPECT_FALSE(bubble_content.manage_link.empty()); |
| 106 | 104 |
| 107 content_settings->ClearCookieSpecificContentSettings(); | 105 content_settings->ClearCookieSpecificContentSettings(); |
| 108 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); | 106 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES); |
| 109 content_setting_bubble_model.reset( | 107 content_setting_bubble_model.reset( |
| 110 ContentSettingBubbleModel::CreateContentSettingBubbleModel( | 108 ContentSettingBubbleModel::CreateContentSettingBubbleModel( |
| 111 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); | 109 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES)); |
| 112 const ContentSettingBubbleModel::BubbleContent& bubble_content_2 = | 110 const ContentSettingBubbleModel::BubbleContent& bubble_content_2 = |
| 113 content_setting_bubble_model->bubble_content(); | 111 content_setting_bubble_model->bubble_content(); |
| 114 | 112 |
| 115 EXPECT_FALSE(bubble_content_2.title.empty()); | 113 EXPECT_FALSE(bubble_content_2.title.empty()); |
| 116 EXPECT_NE(title, bubble_content_2.title); | 114 EXPECT_NE(title, bubble_content_2.title); |
| 117 ASSERT_EQ(2U, bubble_content_2.radio_group.radio_items.size()); | 115 ASSERT_EQ(2U, bubble_content_2.radio_group.radio_items.size()); |
| 118 // TODO(bauerb): Update this once the strings have been updated. | 116 EXPECT_EQ(bubble_content_2.radio_group.radio_items[0], |
| 119 EXPECT_EQ(radio1, bubble_content_2.radio_group.radio_items[0]); | 117 l10n_util::GetStringUTF8(IDS_ALLOWED_COOKIES_NO_ACTION)); |
| 120 EXPECT_EQ(radio2, bubble_content_2.radio_group.radio_items[1]); | 118 EXPECT_EQ(bubble_content_2.radio_group.radio_items[1], |
| 119 l10n_util::GetStringFUTF8( |
| 120 IDS_ALLOWED_COOKIES_BLOCK, |
| 121 FormatUrlForSecurityDisplay(web_contents()->GetURL(), |
| 122 profile()->GetPrefs()->GetString( |
| 123 prefs::kAcceptLanguages)))); |
| 121 EXPECT_FALSE(bubble_content_2.custom_link.empty()); | 124 EXPECT_FALSE(bubble_content_2.custom_link.empty()); |
| 122 EXPECT_TRUE(bubble_content_2.custom_link_enabled); | 125 EXPECT_TRUE(bubble_content_2.custom_link_enabled); |
| 123 EXPECT_FALSE(bubble_content_2.manage_link.empty()); | 126 EXPECT_FALSE(bubble_content_2.manage_link.empty()); |
| 124 } | 127 } |
| 125 | 128 |
| 126 TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) { | 129 TEST_F(ContentSettingBubbleModelTest, MediastreamMicAndCamera) { |
| 127 // Required to break dependency on BrowserMainLoop. | 130 // Required to break dependency on BrowserMainLoop. |
| 128 MediaCaptureDevicesDispatcher::GetInstance()-> | 131 MediaCaptureDevicesDispatcher::GetInstance()-> |
| 129 DisableDeviceEnumerationForTesting(); | 132 DisableDeviceEnumerationForTesting(); |
| 130 | 133 |
| (...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 962 { | 965 { |
| 963 ProtocolHandler handler = registry.GetHandlerFor("mailto"); | 966 ProtocolHandler handler = registry.GetHandlerFor("mailto"); |
| 964 ASSERT_FALSE(handler.IsEmpty()); | 967 ASSERT_FALSE(handler.IsEmpty()); |
| 965 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 968 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 966 content_settings->pending_protocol_handler_setting()); | 969 content_settings->pending_protocol_handler_setting()); |
| 967 EXPECT_FALSE(registry.IsIgnored(test_handler)); | 970 EXPECT_FALSE(registry.IsIgnored(test_handler)); |
| 968 } | 971 } |
| 969 | 972 |
| 970 registry.Shutdown(); | 973 registry.Shutdown(); |
| 971 } | 974 } |
| OLD | NEW |