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 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()); |
200 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 202 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
201 GetContentSetting( | 203 GetContentSetting( |
202 &provider, youtube_url, youtube_url, | 204 &provider, youtube_url, youtube_url, |
203 CONTENT_SETTINGS_TYPE_COOKIES, "", false)); | 205 CONTENT_SETTINGS_TYPE_COOKIES, "", false)); |
204 | 206 |
205 provider.ShutdownOnUIThread(); | 207 provider.ShutdownOnUIThread(); |
206 } | 208 } |
207 | 209 |
208 TEST_F(PolicyProviderTest, ResourceIdentifier) { | 210 TEST_F(PolicyProviderTest, ResourceIdentifier) { |
209 TestingProfile profile; | 211 TestingProfile profile; |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
272 ASSERT_EQ(Value::TYPE_DICTIONARY, cert_filter->GetType()); | 274 ASSERT_EQ(Value::TYPE_DICTIONARY, cert_filter->GetType()); |
273 DictionaryValue* dict_value = | 275 DictionaryValue* dict_value = |
274 static_cast<DictionaryValue*>(cert_filter.get()); | 276 static_cast<DictionaryValue*>(cert_filter.get()); |
275 std::string actual_common_name; | 277 std::string actual_common_name; |
276 ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name)); | 278 ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name)); |
277 EXPECT_EQ("issuer name", actual_common_name); | 279 EXPECT_EQ("issuer name", actual_common_name); |
278 provider.ShutdownOnUIThread(); | 280 provider.ShutdownOnUIThread(); |
279 } | 281 } |
280 | 282 |
281 } // namespace content_settings | 283 } // namespace content_settings |
OLD | NEW |