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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "chrome/browser/chrome_notification_types.h" | 7 #include "chrome/browser/chrome_notification_types.h" |
8 #include "chrome/browser/content_settings/host_content_settings_map_factory.h" | 8 #include "chrome/browser/content_settings/host_content_settings_map_factory.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/prerender/prerender_manager.h" | 10 #include "chrome/browser/prerender/prerender_manager.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
126 TEST_F(ContentSettingImageModelTest, NULLTabSpecificContentSettings) { | 126 TEST_F(ContentSettingImageModelTest, NULLTabSpecificContentSettings) { |
127 std::unique_ptr<ContentSettingImageModel> content_setting_image_model = | 127 std::unique_ptr<ContentSettingImageModel> content_setting_image_model = |
128 ContentSettingSimpleImageModel::CreateForContentTypeForTesting( | 128 ContentSettingSimpleImageModel::CreateForContentTypeForTesting( |
129 CONTENT_SETTINGS_TYPE_IMAGES); | 129 CONTENT_SETTINGS_TYPE_IMAGES); |
130 NotificationForwarder forwarder(content_setting_image_model.get()); | 130 NotificationForwarder forwarder(content_setting_image_model.get()); |
131 // Should not crash. | 131 // Should not crash. |
132 TabSpecificContentSettings::CreateForWebContents(web_contents()); | 132 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
133 forwarder.clear(); | 133 forwarder.clear(); |
134 } | 134 } |
135 | 135 |
| 136 TEST_F(ContentSettingImageModelTest, SubresourceFilter) { |
| 137 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
| 138 TabSpecificContentSettings* content_settings = |
| 139 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 140 std::unique_ptr<ContentSettingImageModel> content_setting_image_model( |
| 141 new ContentSettingSubresourceFilterImageModel()); |
| 142 EXPECT_FALSE(content_setting_image_model->is_visible()); |
| 143 EXPECT_TRUE(content_setting_image_model->get_tooltip().empty()); |
| 144 |
| 145 content_settings->SetSubresourceBlocked(true); |
| 146 content_setting_image_model->UpdateFromWebContents(web_contents()); |
| 147 |
| 148 EXPECT_TRUE(content_setting_image_model->is_visible()); |
| 149 EXPECT_TRUE(HasIcon(*content_setting_image_model)); |
| 150 // The anchor doesn't have tooltip text for now. |
| 151 EXPECT_TRUE(content_setting_image_model->get_tooltip().empty()); |
| 152 } |
| 153 |
136 } // namespace | 154 } // namespace |
OLD | NEW |