diff options
author | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-09 11:34:51 +0000 |
---|---|---|
committer | bulach@chromium.org <bulach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-03-09 11:34:51 +0000 |
commit | 5ec40cfbe054961db55591c94e46979c4c4d53d7 (patch) | |
tree | 9412e0b34a4da5569e5d2c5d06edb4885f9a9d3d /chrome/browser/content_setting_bubble_model_unittest.cc | |
parent | d6d0cf6a3dea6ec00a70781cca4902e133090647 (diff) | |
download | chromium_src-5ec40cfbe054961db55591c94e46979c4c4d53d7.zip chromium_src-5ec40cfbe054961db55591c94e46979c4c4d53d7.tar.gz chromium_src-5ec40cfbe054961db55591c94e46979c4c4d53d7.tar.bz2 |
Adds ContentSettingBubbleModel.
Review URL: http://codereview.chromium.org/668075
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@41021 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/content_setting_bubble_model_unittest.cc')
-rw-r--r-- | chrome/browser/content_setting_bubble_model_unittest.cc | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/chrome/browser/content_setting_bubble_model_unittest.cc b/chrome/browser/content_setting_bubble_model_unittest.cc new file mode 100644 index 0000000..d75ceff --- /dev/null +++ b/chrome/browser/content_setting_bubble_model_unittest.cc @@ -0,0 +1,45 @@ +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#include "chrome/browser/content_setting_bubble_model.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" + +typedef RenderViewHostTestHarness ContentSettingBubbleModelTest; + +TEST_F(ContentSettingBubbleModelTest, ImageRadios) { + TestTabContents tab_contents(profile_.get(), NULL); + RenderViewHostDelegate::Resource* render_view_host_delegate = &tab_contents; + render_view_host_delegate->OnContentBlocked(CONTENT_SETTINGS_TYPE_IMAGES); + + scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( + ContentSettingBubbleModel::CreateContentSettingBubbleModel( + &tab_contents, profile_.get(), CONTENT_SETTINGS_TYPE_IMAGES)); + const ContentSettingBubbleModel::BubbleContent& bubble_content = + content_setting_bubble_model->bubble_content(); + EXPECT_EQ(1U, bubble_content.radio_groups.size()); + EXPECT_EQ(2U, bubble_content.radio_groups[0].radio_items.size()); + EXPECT_EQ(0, bubble_content.radio_groups[0].default_item); + EXPECT_NE(std::string(), bubble_content.manage_link); + EXPECT_NE(std::string(), bubble_content.title); +} + +TEST_F(ContentSettingBubbleModelTest, Cookies) { + TestTabContents tab_contents(profile_.get(), NULL); + RenderViewHostDelegate::Resource* render_view_host_delegate = &tab_contents; + render_view_host_delegate->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES); + + scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( + ContentSettingBubbleModel::CreateContentSettingBubbleModel( + &tab_contents, profile_.get(), CONTENT_SETTINGS_TYPE_COOKIES)); + const ContentSettingBubbleModel::BubbleContent& bubble_content = + content_setting_bubble_model->bubble_content(); + EXPECT_EQ(0U, bubble_content.radio_groups.size()); + EXPECT_NE(std::string(), bubble_content.manage_link); + EXPECT_NE(std::string(), bubble_content.title); +} |