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/content_settings_policy_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_policy_provider.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
183 GetContentSettingValue( | 183 GetContentSettingValue( |
184 &provider, google_url, google_url, | 184 &provider, google_url, google_url, |
185 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 185 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
186 | 186 |
187 int int_value = -1; | 187 int int_value = -1; |
188 value_ptr->GetAsInteger(&int_value); | 188 value_ptr->GetAsInteger(&int_value); |
189 EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(int_value)); | 189 EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(int_value)); |
190 | 190 |
191 // The PolicyProvider does not allow setting content settings as they are | 191 // The PolicyProvider does not allow setting content settings as they are |
192 // enforced via policies and not set by the user or extension. So a call to | 192 // enforced via policies and not set by the user or extension. So a call to |
193 // SetContentSetting does nothing. | 193 // SetWebsiteSetting does nothing. |
194 provider.SetContentSetting( | 194 scoped_ptr<base::Value> value_block( |
| 195 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 196 bool owned = provider.SetWebsiteSetting( |
195 yt_url_pattern, | 197 yt_url_pattern, |
196 yt_url_pattern, | 198 yt_url_pattern, |
197 CONTENT_SETTINGS_TYPE_COOKIES, | 199 CONTENT_SETTINGS_TYPE_COOKIES, |
198 "", | 200 "", |
199 CONTENT_SETTING_BLOCK); | 201 value_block.get()); |
| 202 EXPECT_FALSE(owned); |
200 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 203 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
201 GetContentSetting( | 204 GetContentSetting( |
202 &provider, youtube_url, youtube_url, | 205 &provider, youtube_url, youtube_url, |
203 CONTENT_SETTINGS_TYPE_COOKIES, "", false)); | 206 CONTENT_SETTINGS_TYPE_COOKIES, "", false)); |
204 | 207 |
205 provider.ShutdownOnUIThread(); | 208 provider.ShutdownOnUIThread(); |
206 } | 209 } |
207 | 210 |
208 TEST_F(PolicyProviderTest, ResourceIdentifier) { | 211 TEST_F(PolicyProviderTest, ResourceIdentifier) { |
209 TestingProfile profile; | 212 TestingProfile profile; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 ASSERT_EQ(Value::TYPE_DICTIONARY, cert_filter->GetType()); | 275 ASSERT_EQ(Value::TYPE_DICTIONARY, cert_filter->GetType()); |
273 DictionaryValue* dict_value = | 276 DictionaryValue* dict_value = |
274 static_cast<DictionaryValue*>(cert_filter.get()); | 277 static_cast<DictionaryValue*>(cert_filter.get()); |
275 std::string actual_common_name; | 278 std::string actual_common_name; |
276 ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name)); | 279 ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name)); |
277 EXPECT_EQ("issuer name", actual_common_name); | 280 EXPECT_EQ("issuer name", actual_common_name); |
278 provider.ShutdownOnUIThread(); | 281 provider.ShutdownOnUIThread(); |
279 } | 282 } |
280 | 283 |
281 } // namespace content_settings | 284 } // namespace content_settings |
OLD | NEW |