From 64ec3d13abf89f523f5d834a3dddb76e115bdf88 Mon Sep 17 00:00:00 2001 From: "jochen@chromium.org" Date: Tue, 10 Aug 2010 08:27:52 +0000 Subject: Revert 55536 - Reland r55382. When blocking cookies, also show an icon in the location bar when cookies are accessed. If the user choses to block cookies per default, this will grant access to the collected cookies dialog as soon as the page accesses cookies. Right now, the icon is only shown if cookies were actually blocked. BUG=45230 TEST=Canned*.*:ContentSettingImage*.*:TabSpecific*.* Review URL: http://codereview.chromium.org/3014056 Review URL: http://codereview.chromium.org/3146003 TBR=jochen@chromium.org Review URL: http://codereview.chromium.org/3127002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55540 0039d316-1c4b-4281-b951-d872f2087c98 --- .../content_setting_image_model_unittest.cc | 38 ++-------------------- 1 file changed, 3 insertions(+), 35 deletions(-) (limited to 'chrome/browser/content_setting_image_model_unittest.cc') diff --git a/chrome/browser/content_setting_image_model_unittest.cc b/chrome/browser/content_setting_image_model_unittest.cc index 32aed3e..02a5af3 100644 --- a/chrome/browser/content_setting_image_model_unittest.cc +++ b/chrome/browser/content_setting_image_model_unittest.cc @@ -4,25 +4,13 @@ #include "chrome/browser/content_setting_image_model.h" -#include "chrome/browser/chrome_thread.h" -#include "chrome/browser/host_content_settings_map.h" #include "chrome/browser/profile.h" #include "chrome/browser/renderer_host/test/test_render_view_host.h" #include "chrome/browser/tab_contents/test_tab_contents.h" #include "chrome/test/testing_profile.h" #include "testing/gtest/include/gtest/gtest.h" -class ContentSettingImageModelTest : public RenderViewHostTestHarness { - public: - ContentSettingImageModelTest() - : RenderViewHostTestHarness(), - ui_thread_(ChromeThread::UI, &message_loop_) {} - - private: - ChromeThread ui_thread_; - - DISALLOW_COPY_AND_ASSIGN(ContentSettingImageModelTest); -}; +typedef RenderViewHostTestHarness ContentSettingImageModelTest; TEST_F(ContentSettingImageModelTest, UpdateFromTabContents) { TestTabContents tab_contents(profile_.get(), NULL); @@ -33,32 +21,12 @@ TEST_F(ContentSettingImageModelTest, UpdateFromTabContents) { CONTENT_SETTINGS_TYPE_IMAGES)); EXPECT_FALSE(content_setting_image_model->is_visible()); EXPECT_EQ(0, content_setting_image_model->get_icon()); - EXPECT_EQ(std::string(), content_setting_image_model->get_tooltip()); + EXPECT_EQ("", content_setting_image_model->get_tooltip()); content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES); content_setting_image_model->UpdateFromTabContents(&tab_contents); EXPECT_TRUE(content_setting_image_model->is_visible()); EXPECT_NE(0, content_setting_image_model->get_icon()); - EXPECT_NE(std::string(), content_setting_image_model->get_tooltip()); -} - -TEST_F(ContentSettingImageModelTest, CookieAccessed) { - TestTabContents tab_contents(profile_.get(), NULL); - TabSpecificContentSettings* content_settings = - tab_contents.GetTabSpecificContentSettings(); - profile_->GetHostContentSettingsMap()->SetDefaultContentSetting( - CONTENT_SETTINGS_TYPE_COOKIES, CONTENT_SETTING_BLOCK); - scoped_ptr content_setting_image_model( - ContentSettingImageModel::CreateContentSettingImageModel( - CONTENT_SETTINGS_TYPE_COOKIES)); - EXPECT_FALSE(content_setting_image_model->is_visible()); - EXPECT_EQ(0, content_setting_image_model->get_icon()); - EXPECT_EQ(std::string(), content_setting_image_model->get_tooltip()); - - content_settings->OnCookieAccessed(GURL("http://google.com"), "A=B", false); - content_setting_image_model->UpdateFromTabContents(&tab_contents); - EXPECT_TRUE(content_setting_image_model->is_visible()); - EXPECT_NE(0, content_setting_image_model->get_icon()); - EXPECT_NE(std::string(), content_setting_image_model->get_tooltip()); + EXPECT_NE("", content_setting_image_model->get_tooltip()); } -- cgit v1.1