Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1503)

Side by Side Diff: chrome/browser/ui/content_settings/content_setting_bubble_model_unittest.cc

Issue 12479005: Show strings in content settings bubble when access to cookies is allowed. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/ui/content_settings/content_setting_bubble_model.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/auto_reset.h" 5 #include "base/auto_reset.h"
6 #include "base/command_line.h" 6 #include "base/command_line.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/api/infobars/infobar_delegate.h" 8 #include "chrome/browser/api/infobars/infobar_delegate.h"
9 #include "chrome/browser/api/infobars/infobar_service.h" 9 #include "chrome/browser/api/infobars/infobar_service.h"
10 #include "chrome/browser/content_settings/host_content_settings_map.h" 10 #include "chrome/browser/content_settings/host_content_settings_map.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 } 96 }
97 97
98 TEST_F(ContentSettingBubbleModelTest, Cookies) { 98 TEST_F(ContentSettingBubbleModelTest, Cookies) {
99 TabSpecificContentSettings* content_settings = 99 TabSpecificContentSettings* content_settings =
100 TabSpecificContentSettings::FromWebContents(web_contents()); 100 TabSpecificContentSettings::FromWebContents(web_contents());
101 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES, 101 content_settings->OnContentBlocked(CONTENT_SETTINGS_TYPE_COOKIES,
102 std::string()); 102 std::string());
103 103
104 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( 104 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
105 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 105 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
106 NULL, web_contents(), profile(), 106 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES));
107 CONTENT_SETTINGS_TYPE_COOKIES));
108 const ContentSettingBubbleModel::BubbleContent& bubble_content = 107 const ContentSettingBubbleModel::BubbleContent& bubble_content =
109 content_setting_bubble_model->bubble_content(); 108 content_setting_bubble_model->bubble_content();
110 EXPECT_FALSE(bubble_content.title.empty()); 109 std::string title = bubble_content.title;
111 EXPECT_FALSE(bubble_content.radio_group.radio_items.empty()); 110 EXPECT_FALSE(title.empty());
111 ASSERT_EQ(2U, bubble_content.radio_group.radio_items.size());
112 std::string radio1 = bubble_content.radio_group.radio_items[0];
113 std::string radio2 = bubble_content.radio_group.radio_items[1];
112 EXPECT_FALSE(bubble_content.custom_link.empty()); 114 EXPECT_FALSE(bubble_content.custom_link.empty());
113 EXPECT_TRUE(bubble_content.custom_link_enabled); 115 EXPECT_TRUE(bubble_content.custom_link_enabled);
114 EXPECT_FALSE(bubble_content.manage_link.empty()); 116 EXPECT_FALSE(bubble_content.manage_link.empty());
117
118 content_settings->ClearCookieSpecificContentSettings();
119 content_settings->OnContentAllowed(CONTENT_SETTINGS_TYPE_COOKIES);
120 content_setting_bubble_model.reset(
121 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
122 NULL, web_contents(), profile(), CONTENT_SETTINGS_TYPE_COOKIES));
123 const ContentSettingBubbleModel::BubbleContent& bubble_content_2 =
124 content_setting_bubble_model->bubble_content();
125
126 EXPECT_FALSE(bubble_content_2.title.empty());
127 EXPECT_NE(title, bubble_content_2.title);
128 ASSERT_EQ(2U, bubble_content_2.radio_group.radio_items.size());
129 // TODO(bauerb): Update this once the strings have been updated.
130 EXPECT_EQ(radio1, bubble_content_2.radio_group.radio_items[0]);
131 EXPECT_EQ(radio2, bubble_content_2.radio_group.radio_items[1]);
132 EXPECT_FALSE(bubble_content_2.custom_link.empty());
133 EXPECT_TRUE(bubble_content_2.custom_link_enabled);
134 EXPECT_FALSE(bubble_content_2.manage_link.empty());
115 } 135 }
116 136
117 TEST_F(ContentSettingBubbleModelTest, Mediastream) { 137 TEST_F(ContentSettingBubbleModelTest, Mediastream) {
118 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model( 138 scoped_ptr<ContentSettingBubbleModel> content_setting_bubble_model(
119 ContentSettingBubbleModel::CreateContentSettingBubbleModel( 139 ContentSettingBubbleModel::CreateContentSettingBubbleModel(
120 NULL, web_contents(), profile(), 140 NULL, web_contents(), profile(),
121 CONTENT_SETTINGS_TYPE_MEDIASTREAM)); 141 CONTENT_SETTINGS_TYPE_MEDIASTREAM));
122 const ContentSettingBubbleModel::BubbleContent& bubble_content = 142 const ContentSettingBubbleModel::BubbleContent& bubble_content =
123 content_setting_bubble_model->bubble_content(); 143 content_setting_bubble_model->bubble_content();
124 EXPECT_FALSE(bubble_content.title.empty()); 144 EXPECT_FALSE(bubble_content.title.empty());
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after
506 ProtocolHandler handler = registry.GetHandlerFor("mailto"); 526 ProtocolHandler handler = registry.GetHandlerFor("mailto");
507 ASSERT_FALSE(handler.IsEmpty()); 527 ASSERT_FALSE(handler.IsEmpty());
508 EXPECT_EQ(ASCIIToUTF16("Handler"), handler.title()); 528 EXPECT_EQ(ASCIIToUTF16("Handler"), handler.title());
509 EXPECT_EQ(CONTENT_SETTING_ALLOW, 529 EXPECT_EQ(CONTENT_SETTING_ALLOW,
510 content_settings->pending_protocol_handler_setting()); 530 content_settings->pending_protocol_handler_setting());
511 EXPECT_FALSE(registry.IsIgnored(test_handler)); 531 EXPECT_FALSE(registry.IsIgnored(test_handler));
512 } 532 }
513 533
514 registry.Shutdown(); 534 registry.Shutdown();
515 } 535 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/content_settings/content_setting_bubble_model.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698