| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_setting_image_model.h" | 5 #include "chrome/browser/content_setting_image_model.h" |
| 6 | 6 |
| 7 #include "chrome/browser/profile.h" | 7 #include "chrome/browser/profile.h" |
| 8 #include "chrome/browser/renderer_host/test/test_render_view_host.h" | 8 #include "chrome/browser/renderer_host/test/test_render_view_host.h" |
| 9 #include "chrome/browser/tab_contents/test_tab_contents.h" | 9 #include "chrome/browser/tab_contents/test_tab_contents.h" |
| 10 #include "chrome/test/testing_profile.h" | 10 #include "chrome/test/testing_profile.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 typedef RenderViewHostTestHarness ContentSettingImageModelTest; | 13 typedef RenderViewHostTestHarness ContentSettingImageModelTest; |
| 14 | 14 |
| 15 TEST_F(ContentSettingImageModelTest, UpdateFromTabContents) { | 15 TEST_F(ContentSettingImageModelTest, UpdateFromTabContents) { |
| 16 TestTabContents tab_contents(profile_.get(), NULL); | 16 TestTabContents tab_contents(profile_.get(), NULL); |
| 17 RenderViewHostDelegate::ContentSettings* render_view_host_delegate = | 17 TabSpecificContentSettings* content_settings = |
| 18 &tab_contents; | 18 tab_contents.GetTabSpecificContentSettings(); |
| 19 scoped_ptr<ContentSettingImageModel> content_setting_image_model( | 19 scoped_ptr<ContentSettingImageModel> content_setting_image_model( |
| 20 ContentSettingImageModel::CreateContentSettingImageModel( | 20 ContentSettingImageModel::CreateContentSettingImageModel( |
| 21 CONTENT_SETTINGS_TYPE_IMAGES)); | 21 CONTENT_SETTINGS_TYPE_IMAGES)); |
| 22 EXPECT_FALSE(content_setting_image_model->is_visible()); | 22 EXPECT_FALSE(content_setting_image_model->is_visible()); |
| 23 EXPECT_EQ(0, content_setting_image_model->get_icon()); | 23 EXPECT_EQ(0, content_setting_image_model->get_icon()); |
| 24 EXPECT_EQ("", content_setting_image_model->get_tooltip()); | 24 EXPECT_EQ("", content_setting_image_model->get_tooltip()); |
| 25 | 25 |
| 26 render_view_host_delegate->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES); | 26 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES); |
| 27 content_setting_image_model->UpdateFromTabContents(&tab_contents); | 27 content_setting_image_model->UpdateFromTabContents(&tab_contents); |
| 28 | 28 |
| 29 EXPECT_TRUE(content_setting_image_model->is_visible()); | 29 EXPECT_TRUE(content_setting_image_model->is_visible()); |
| 30 EXPECT_NE(0, content_setting_image_model->get_icon()); | 30 EXPECT_NE(0, content_setting_image_model->get_icon()); |
| 31 EXPECT_NE("", content_setting_image_model->get_tooltip()); | 31 EXPECT_NE("", content_setting_image_model->get_tooltip()); |
| 32 } | 32 } |
| OLD | NEW |