| 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/strings/utf_string_conversions.h" | 5 #include "base/strings/utf_string_conversions.h" |
| 6 #include "chrome/browser/chrome_notification_types.h" | 6 #include "chrome/browser/chrome_notification_types.h" |
| 7 #include "chrome/browser/content_settings/host_content_settings_map.h" | 7 #include "chrome/browser/content_settings/host_content_settings_map.h" |
| 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 8 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
| 9 #include "chrome/browser/prerender/prerender_manager.h" | 9 #include "chrome/browser/prerender/prerender_manager.h" |
| 10 #include "chrome/browser/profiles/profile.h" | 10 #include "chrome/browser/profiles/profile.h" |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 TabSpecificContentSettings::CreateForWebContents(web_contents()); | 59 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
| 60 TabSpecificContentSettings* content_settings = | 60 TabSpecificContentSettings* content_settings = |
| 61 TabSpecificContentSettings::FromWebContents(web_contents()); | 61 TabSpecificContentSettings::FromWebContents(web_contents()); |
| 62 scoped_ptr<ContentSettingImageModel> content_setting_image_model( | 62 scoped_ptr<ContentSettingImageModel> content_setting_image_model( |
| 63 ContentSettingImageModel::CreateContentSettingImageModel( | 63 ContentSettingImageModel::CreateContentSettingImageModel( |
| 64 CONTENT_SETTINGS_TYPE_IMAGES)); | 64 CONTENT_SETTINGS_TYPE_IMAGES)); |
| 65 EXPECT_FALSE(content_setting_image_model->is_visible()); | 65 EXPECT_FALSE(content_setting_image_model->is_visible()); |
| 66 EXPECT_EQ(0, content_setting_image_model->get_icon()); | 66 EXPECT_EQ(0, content_setting_image_model->get_icon()); |
| 67 EXPECT_TRUE(content_setting_image_model->get_tooltip().empty()); | 67 EXPECT_TRUE(content_setting_image_model->get_tooltip().empty()); |
| 68 | 68 |
| 69 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES, | 69 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES); |
| 70 std::string()); | |
| 71 content_setting_image_model->UpdateFromWebContents(web_contents()); | 70 content_setting_image_model->UpdateFromWebContents(web_contents()); |
| 72 | 71 |
| 73 EXPECT_TRUE(content_setting_image_model->is_visible()); | 72 EXPECT_TRUE(content_setting_image_model->is_visible()); |
| 74 EXPECT_NE(0, content_setting_image_model->get_icon()); | 73 EXPECT_NE(0, content_setting_image_model->get_icon()); |
| 75 EXPECT_FALSE(content_setting_image_model->get_tooltip().empty()); | 74 EXPECT_FALSE(content_setting_image_model->get_tooltip().empty()); |
| 76 } | 75 } |
| 77 | 76 |
| 78 TEST_F(ContentSettingImageModelTest, RPHUpdateFromWebContents) { | 77 TEST_F(ContentSettingImageModelTest, RPHUpdateFromWebContents) { |
| 79 TabSpecificContentSettings::CreateForWebContents(web_contents()); | 78 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
| 80 scoped_ptr<ContentSettingImageModel> content_setting_image_model( | 79 scoped_ptr<ContentSettingImageModel> content_setting_image_model( |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 scoped_ptr<ContentSettingImageModel> content_setting_image_model( | 121 scoped_ptr<ContentSettingImageModel> content_setting_image_model( |
| 123 ContentSettingImageModel::CreateContentSettingImageModel( | 122 ContentSettingImageModel::CreateContentSettingImageModel( |
| 124 CONTENT_SETTINGS_TYPE_IMAGES)); | 123 CONTENT_SETTINGS_TYPE_IMAGES)); |
| 125 NotificationForwarder forwarder(content_setting_image_model.get()); | 124 NotificationForwarder forwarder(content_setting_image_model.get()); |
| 126 // Should not crash. | 125 // Should not crash. |
| 127 TabSpecificContentSettings::CreateForWebContents(web_contents()); | 126 TabSpecificContentSettings::CreateForWebContents(web_contents()); |
| 128 forwarder.clear(); | 127 forwarder.clear(); |
| 129 } | 128 } |
| 130 | 129 |
| 131 } // namespace | 130 } // namespace |
| OLD | NEW |