OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/content_settings/host_content_settings_map.h" | 5 #include "chrome/browser/content_settings/host_content_settings_map.h" |
6 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 6 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
7 #include "chrome/browser/prerender/prerender_manager.h" | 7 #include "chrome/browser/prerender/prerender_manager.h" |
8 #include "chrome/browser/profiles/profile.h" | 8 #include "chrome/browser/profiles/profile.h" |
9 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" | 9 #include "chrome/browser/ui/content_settings/content_setting_image_model.h" |
10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" | 10 #include "chrome/browser/ui/tab_contents/tab_contents_wrapper.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 content_setting_image_model->UpdateFromTabContents(contents()); | 42 content_setting_image_model->UpdateFromTabContents(contents()); |
43 | 43 |
44 EXPECT_TRUE(content_setting_image_model->is_visible()); | 44 EXPECT_TRUE(content_setting_image_model->is_visible()); |
45 EXPECT_NE(0, content_setting_image_model->get_icon()); | 45 EXPECT_NE(0, content_setting_image_model->get_icon()); |
46 EXPECT_FALSE(content_setting_image_model->get_tooltip().empty()); | 46 EXPECT_FALSE(content_setting_image_model->get_tooltip().empty()); |
47 } | 47 } |
48 | 48 |
49 TEST_F(ContentSettingImageModelTest, CookieAccessed) { | 49 TEST_F(ContentSettingImageModelTest, CookieAccessed) { |
50 TabSpecificContentSettings* content_settings = | 50 TabSpecificContentSettings* content_settings = |
51 contents_wrapper()->content_settings(); | 51 contents_wrapper()->content_settings(); |
52 profile_->GetHostContentSettingsMap()->SetDefaultContentSetting( | 52 profile()->GetHostContentSettingsMap()->SetDefaultContentSetting( |
53 CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK); | 53 CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK); |
54 scoped_ptr<ContentSettingImageModel> content_setting_image_model( | 54 scoped_ptr<ContentSettingImageModel> content_setting_image_model( |
55 ContentSettingImageModel::CreateContentSettingImageModel( | 55 ContentSettingImageModel::CreateContentSettingImageModel( |
56 CONTENT_SETTINGS_TYPE_COOKIES)); | 56 CONTENT_SETTINGS_TYPE_COOKIES)); |
57 EXPECT_FALSE(content_setting_image_model->is_visible()); | 57 EXPECT_FALSE(content_setting_image_model->is_visible()); |
58 EXPECT_EQ(0, content_setting_image_model->get_icon()); | 58 EXPECT_EQ(0, content_setting_image_model->get_icon()); |
59 EXPECT_TRUE(content_setting_image_model->get_tooltip().empty()); | 59 EXPECT_TRUE(content_setting_image_model->get_tooltip().empty()); |
60 | 60 |
61 net::CookieOptions options; | 61 net::CookieOptions options; |
62 content_settings->OnCookieChanged( | 62 content_settings->OnCookieChanged( |
63 GURL("http://google.com"), "A=B", options, false); | 63 GURL("http://google.com"), "A=B", options, false); |
64 content_setting_image_model->UpdateFromTabContents(contents()); | 64 content_setting_image_model->UpdateFromTabContents(contents()); |
65 EXPECT_TRUE(content_setting_image_model->is_visible()); | 65 EXPECT_TRUE(content_setting_image_model->is_visible()); |
66 EXPECT_NE(0, content_setting_image_model->get_icon()); | 66 EXPECT_NE(0, content_setting_image_model->get_icon()); |
67 EXPECT_FALSE(content_setting_image_model->get_tooltip().empty()); | 67 EXPECT_FALSE(content_setting_image_model->get_tooltip().empty()); |
68 } | 68 } |
OLD | NEW |