| 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_pref_provider.h" | 5 #include "chrome/browser/content_settings/content_settings_pref_provider.h" |
| 6 | 6 |
| 7 #include "base/auto_reset.h" | 7 #include "base/auto_reset.h" |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/threading/platform_thread.h" | 10 #include "base/threading/platform_thread.h" |
| 11 #include "base/values.h" |
| 11 #include "chrome/browser/content_settings/content_settings_mock_observer.h" | 12 #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
| 12 #include "chrome/browser/content_settings/content_settings_utils.h" | 13 #include "chrome/browser/content_settings/content_settings_utils.h" |
| 13 #include "chrome/browser/prefs/browser_prefs.h" | 14 #include "chrome/browser/prefs/browser_prefs.h" |
| 14 #include "chrome/browser/prefs/default_pref_store.h" | 15 #include "chrome/browser/prefs/default_pref_store.h" |
| 15 #include "chrome/browser/prefs/incognito_user_pref_store.h" | 16 #include "chrome/browser/prefs/incognito_user_pref_store.h" |
| 16 #include "chrome/browser/prefs/pref_change_registrar.h" | 17 #include "chrome/browser/prefs/pref_change_registrar.h" |
| 17 #include "chrome/browser/prefs/pref_service.h" | 18 #include "chrome/browser/prefs/pref_service.h" |
| 18 #include "chrome/browser/prefs/pref_service_mock_builder.h" | 19 #include "chrome/browser/prefs/pref_service_mock_builder.h" |
| 19 #include "chrome/browser/prefs/scoped_user_pref_update.h" | 20 #include "chrome/browser/prefs/scoped_user_pref_update.h" |
| 20 #include "chrome/browser/prefs/testing_pref_store.h" | 21 #include "chrome/browser/prefs/testing_pref_store.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 ContentSettingsPattern::FromString("[*.]example.com"); | 127 ContentSettingsPattern::FromString("[*.]example.com"); |
| 127 content_settings::MockObserver mock_observer; | 128 content_settings::MockObserver mock_observer; |
| 128 EXPECT_CALL(mock_observer, | 129 EXPECT_CALL(mock_observer, |
| 129 OnContentSettingChanged(pattern, | 130 OnContentSettingChanged(pattern, |
| 130 ContentSettingsPattern::Wildcard(), | 131 ContentSettingsPattern::Wildcard(), |
| 131 CONTENT_SETTINGS_TYPE_IMAGES, | 132 CONTENT_SETTINGS_TYPE_IMAGES, |
| 132 "")); | 133 "")); |
| 133 | 134 |
| 134 pref_content_settings_provider.AddObserver(&mock_observer); | 135 pref_content_settings_provider.AddObserver(&mock_observer); |
| 135 | 136 |
| 136 pref_content_settings_provider.SetContentSetting( | 137 pref_content_settings_provider.SetWebsiteSetting( |
| 137 pattern, | 138 pattern, |
| 138 ContentSettingsPattern::Wildcard(), | 139 ContentSettingsPattern::Wildcard(), |
| 139 CONTENT_SETTINGS_TYPE_IMAGES, | 140 CONTENT_SETTINGS_TYPE_IMAGES, |
| 140 "", | 141 "", |
| 141 CONTENT_SETTING_ALLOW); | 142 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); |
| 142 | 143 |
| 143 pref_content_settings_provider.ShutdownOnUIThread(); | 144 pref_content_settings_provider.ShutdownOnUIThread(); |
| 144 } | 145 } |
| 145 | 146 |
| 146 // Test for regression in which the PrefProvider modified the user pref store | 147 // Test for regression in which the PrefProvider modified the user pref store |
| 147 // of the OTR unintentionally: http://crbug.com/74466. | 148 // of the OTR unintentionally: http://crbug.com/74466. |
| 148 TEST_F(PrefProviderTest, Incognito) { | 149 TEST_F(PrefProviderTest, Incognito) { |
| 149 PersistentPrefStore* user_prefs = new TestingPrefStore(); | 150 PersistentPrefStore* user_prefs = new TestingPrefStore(); |
| 150 IncognitoUserPrefStore* otr_user_prefs = | 151 IncognitoUserPrefStore* otr_user_prefs = |
| 151 new IncognitoUserPrefStore(user_prefs); | 152 new IncognitoUserPrefStore(user_prefs); |
| (...skipping 13 matching lines...) Expand all Loading... |
| 165 TestingProfile* otr_profile = new TestingProfile; | 166 TestingProfile* otr_profile = new TestingProfile; |
| 166 profile.SetOffTheRecordProfile(otr_profile); | 167 profile.SetOffTheRecordProfile(otr_profile); |
| 167 profile.SetPrefService(regular_prefs); | 168 profile.SetPrefService(regular_prefs); |
| 168 otr_profile->set_incognito(true); | 169 otr_profile->set_incognito(true); |
| 169 otr_profile->SetPrefService(otr_prefs); | 170 otr_profile->SetPrefService(otr_prefs); |
| 170 | 171 |
| 171 PrefProvider pref_content_settings_provider(regular_prefs, false); | 172 PrefProvider pref_content_settings_provider(regular_prefs, false); |
| 172 PrefProvider pref_content_settings_provider_incognito(otr_prefs, true); | 173 PrefProvider pref_content_settings_provider_incognito(otr_prefs, true); |
| 173 ContentSettingsPattern pattern = | 174 ContentSettingsPattern pattern = |
| 174 ContentSettingsPattern::FromString("[*.]example.com"); | 175 ContentSettingsPattern::FromString("[*.]example.com"); |
| 175 pref_content_settings_provider.SetContentSetting( | 176 pref_content_settings_provider.SetWebsiteSetting( |
| 176 pattern, | 177 pattern, |
| 177 pattern, | 178 pattern, |
| 178 CONTENT_SETTINGS_TYPE_IMAGES, | 179 CONTENT_SETTINGS_TYPE_IMAGES, |
| 179 "", | 180 "", |
| 180 CONTENT_SETTING_ALLOW); | 181 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); |
| 181 | 182 |
| 182 GURL host("http://example.com/"); | 183 GURL host("http://example.com/"); |
| 183 // The value should of course be visible in the regular PrefProvider. | 184 // The value should of course be visible in the regular PrefProvider. |
| 184 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 185 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 185 GetContentSetting( | 186 GetContentSetting( |
| 186 &pref_content_settings_provider, | 187 &pref_content_settings_provider, |
| 187 host, host, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 188 host, host, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 188 // And also in the OTR version. | 189 // And also in the OTR version. |
| 189 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 190 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 190 GetContentSetting( | 191 GetContentSetting( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 207 | 208 |
| 208 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 209 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 209 GetContentSetting(&provider, primary_url, primary_url, | 210 GetContentSetting(&provider, primary_url, primary_url, |
| 210 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 211 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 211 | 212 |
| 212 EXPECT_EQ(NULL, | 213 EXPECT_EQ(NULL, |
| 213 GetContentSettingValue( | 214 GetContentSettingValue( |
| 214 &provider, primary_url, primary_url, | 215 &provider, primary_url, primary_url, |
| 215 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 216 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 216 | 217 |
| 217 provider.SetContentSetting(primary_pattern, | 218 provider.SetWebsiteSetting( |
| 218 primary_pattern, | 219 primary_pattern, |
| 219 CONTENT_SETTINGS_TYPE_IMAGES, | 220 primary_pattern, |
| 220 "", | 221 CONTENT_SETTINGS_TYPE_IMAGES, |
| 221 CONTENT_SETTING_BLOCK); | 222 "", |
| 223 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 222 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 224 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 223 GetContentSetting(&provider, primary_url, primary_url, | 225 GetContentSetting(&provider, primary_url, primary_url, |
| 224 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 226 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 225 scoped_ptr<Value> value_ptr( | 227 scoped_ptr<Value> value_ptr( |
| 226 GetContentSettingValue(&provider, primary_url, primary_url, | 228 GetContentSettingValue(&provider, primary_url, primary_url, |
| 227 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 229 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 228 int int_value = -1; | 230 int int_value = -1; |
| 229 value_ptr->GetAsInteger(&int_value); | 231 value_ptr->GetAsInteger(&int_value); |
| 230 EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(int_value)); | 232 EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(int_value)); |
| 231 | 233 |
| 232 provider.SetContentSetting(primary_pattern, | 234 provider.SetWebsiteSetting(primary_pattern, |
| 233 primary_pattern, | 235 primary_pattern, |
| 234 CONTENT_SETTINGS_TYPE_IMAGES, | 236 CONTENT_SETTINGS_TYPE_IMAGES, |
| 235 "", | 237 "", |
| 236 CONTENT_SETTING_DEFAULT); | 238 NULL); |
| 237 EXPECT_EQ(NULL, | 239 EXPECT_EQ(NULL, |
| 238 GetContentSettingValue( | 240 GetContentSettingValue( |
| 239 &provider, primary_url, primary_url, | 241 &provider, primary_url, primary_url, |
| 240 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 242 CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 241 provider.ShutdownOnUIThread(); | 243 provider.ShutdownOnUIThread(); |
| 242 } | 244 } |
| 243 | 245 |
| 244 TEST_F(PrefProviderTest, Patterns) { | 246 TEST_F(PrefProviderTest, Patterns) { |
| 245 TestingProfile testing_profile; | 247 TestingProfile testing_profile; |
| 246 PrefProvider pref_content_settings_provider(testing_profile.GetPrefs(), | 248 PrefProvider pref_content_settings_provider(testing_profile.GetPrefs(), |
| 247 false); | 249 false); |
| 248 | 250 |
| 249 GURL host1("http://example.com/"); | 251 GURL host1("http://example.com/"); |
| 250 GURL host2("http://www.example.com/"); | 252 GURL host2("http://www.example.com/"); |
| 251 GURL host3("http://example.org/"); | 253 GURL host3("http://example.org/"); |
| 252 GURL host4("file:///tmp/test.html"); | 254 GURL host4("file:///tmp/test.html"); |
| 253 ContentSettingsPattern pattern1 = | 255 ContentSettingsPattern pattern1 = |
| 254 ContentSettingsPattern::FromString("[*.]example.com"); | 256 ContentSettingsPattern::FromString("[*.]example.com"); |
| 255 ContentSettingsPattern pattern2 = | 257 ContentSettingsPattern pattern2 = |
| 256 ContentSettingsPattern::FromString("example.org"); | 258 ContentSettingsPattern::FromString("example.org"); |
| 257 ContentSettingsPattern pattern3 = | 259 ContentSettingsPattern pattern3 = |
| 258 ContentSettingsPattern::FromString("file:///tmp/test.html"); | 260 ContentSettingsPattern::FromString("file:///tmp/test.html"); |
| 259 | 261 |
| 260 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 262 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 261 GetContentSetting( | 263 GetContentSetting( |
| 262 &pref_content_settings_provider, | 264 &pref_content_settings_provider, |
| 263 host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 265 host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 264 pref_content_settings_provider.SetContentSetting( | 266 pref_content_settings_provider.SetWebsiteSetting( |
| 265 pattern1, | 267 pattern1, |
| 266 pattern1, | 268 pattern1, |
| 267 CONTENT_SETTINGS_TYPE_IMAGES, | 269 CONTENT_SETTINGS_TYPE_IMAGES, |
| 268 "", | 270 "", |
| 269 CONTENT_SETTING_BLOCK); | 271 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 270 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 272 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 271 GetContentSetting( | 273 GetContentSetting( |
| 272 &pref_content_settings_provider, | 274 &pref_content_settings_provider, |
| 273 host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 275 host1, host1, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 274 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 276 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 275 GetContentSetting( | 277 GetContentSetting( |
| 276 &pref_content_settings_provider, | 278 &pref_content_settings_provider, |
| 277 host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 279 host2, host2, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 278 | 280 |
| 279 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 281 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 280 GetContentSetting( | 282 GetContentSetting( |
| 281 &pref_content_settings_provider, | 283 &pref_content_settings_provider, |
| 282 host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 284 host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 283 pref_content_settings_provider.SetContentSetting( | 285 pref_content_settings_provider.SetWebsiteSetting( |
| 284 pattern2, | 286 pattern2, |
| 285 pattern2, | 287 pattern2, |
| 286 CONTENT_SETTINGS_TYPE_IMAGES, | 288 CONTENT_SETTINGS_TYPE_IMAGES, |
| 287 "", | 289 "", |
| 288 CONTENT_SETTING_BLOCK); | 290 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 289 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 291 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 290 GetContentSetting( | 292 GetContentSetting( |
| 291 &pref_content_settings_provider, | 293 &pref_content_settings_provider, |
| 292 host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 294 host3, host3, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 293 | 295 |
| 294 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 296 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 295 GetContentSetting(&pref_content_settings_provider, | 297 GetContentSetting(&pref_content_settings_provider, |
| 296 host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", | 298 host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", |
| 297 false)); | 299 false)); |
| 298 pref_content_settings_provider.SetContentSetting( | 300 pref_content_settings_provider.SetWebsiteSetting( |
| 299 pattern3, | 301 pattern3, |
| 300 pattern3, | 302 pattern3, |
| 301 CONTENT_SETTINGS_TYPE_IMAGES, | 303 CONTENT_SETTINGS_TYPE_IMAGES, |
| 302 "", | 304 "", |
| 303 CONTENT_SETTING_BLOCK); | 305 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 304 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 306 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 305 GetContentSetting( | 307 GetContentSetting( |
| 306 &pref_content_settings_provider, | 308 &pref_content_settings_provider, |
| 307 host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); | 309 host4, host4, CONTENT_SETTINGS_TYPE_IMAGES, "", false)); |
| 308 | 310 |
| 309 pref_content_settings_provider.ShutdownOnUIThread(); | 311 pref_content_settings_provider.ShutdownOnUIThread(); |
| 310 } | 312 } |
| 311 | 313 |
| 312 TEST_F(PrefProviderTest, ResourceIdentifier) { | 314 TEST_F(PrefProviderTest, ResourceIdentifier) { |
| 313 TestingProfile testing_profile; | 315 TestingProfile testing_profile; |
| 314 PrefProvider pref_content_settings_provider(testing_profile.GetPrefs(), | 316 PrefProvider pref_content_settings_provider(testing_profile.GetPrefs(), |
| 315 false); | 317 false); |
| 316 | 318 |
| 317 GURL host("http://example.com/"); | 319 GURL host("http://example.com/"); |
| 318 ContentSettingsPattern pattern = | 320 ContentSettingsPattern pattern = |
| 319 ContentSettingsPattern::FromString("[*.]example.com"); | 321 ContentSettingsPattern::FromString("[*.]example.com"); |
| 320 std::string resource1("someplugin"); | 322 std::string resource1("someplugin"); |
| 321 std::string resource2("otherplugin"); | 323 std::string resource2("otherplugin"); |
| 322 | 324 |
| 323 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 325 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 324 GetContentSetting( | 326 GetContentSetting( |
| 325 &pref_content_settings_provider, | 327 &pref_content_settings_provider, |
| 326 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, | 328 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, |
| 327 resource1, false)); | 329 resource1, false)); |
| 328 pref_content_settings_provider.SetContentSetting( | 330 pref_content_settings_provider.SetWebsiteSetting( |
| 329 pattern, | 331 pattern, |
| 330 pattern, | 332 pattern, |
| 331 CONTENT_SETTINGS_TYPE_PLUGINS, | 333 CONTENT_SETTINGS_TYPE_PLUGINS, |
| 332 resource1, | 334 resource1, |
| 333 CONTENT_SETTING_BLOCK); | 335 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 334 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 336 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 335 GetContentSetting( | 337 GetContentSetting( |
| 336 &pref_content_settings_provider, | 338 &pref_content_settings_provider, |
| 337 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, | 339 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, |
| 338 resource1, false)); | 340 resource1, false)); |
| 339 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 341 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 340 GetContentSetting( | 342 GetContentSetting( |
| 341 &pref_content_settings_provider, | 343 &pref_content_settings_provider, |
| 342 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, | 344 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, |
| 343 resource2, false)); | 345 resource2, false)); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 // Assert pre-condition. | 408 // Assert pre-condition. |
| 407 const DictionaryValue* patterns = | 409 const DictionaryValue* patterns = |
| 408 prefs->GetDictionary(prefs::kContentSettingsPatterns); | 410 prefs->GetDictionary(prefs::kContentSettingsPatterns); |
| 409 ASSERT_TRUE(patterns->empty()); | 411 ASSERT_TRUE(patterns->empty()); |
| 410 | 412 |
| 411 // Simulate a user setting a content setting. | 413 // Simulate a user setting a content setting. |
| 412 ContentSettingsPattern primary_pattern = | 414 ContentSettingsPattern primary_pattern = |
| 413 ContentSettingsPattern::FromString("[*.]example.com"); | 415 ContentSettingsPattern::FromString("[*.]example.com"); |
| 414 ContentSettingsPattern secondary_pattern = | 416 ContentSettingsPattern secondary_pattern = |
| 415 ContentSettingsPattern::Wildcard(); | 417 ContentSettingsPattern::Wildcard(); |
| 416 provider.SetContentSetting(primary_pattern, | 418 provider.SetWebsiteSetting(primary_pattern, |
| 417 secondary_pattern, | 419 secondary_pattern, |
| 418 CONTENT_SETTINGS_TYPE_JAVASCRIPT, | 420 CONTENT_SETTINGS_TYPE_JAVASCRIPT, |
| 419 std::string(), | 421 std::string(), |
| 420 CONTENT_SETTING_BLOCK); | 422 Value::CreateIntegerValue(CONTENT_SETTING_BLOCK)); |
| 421 | 423 |
| 422 // Test whether the obsolete preference is synced correctly. | 424 // Test whether the obsolete preference is synced correctly. |
| 423 patterns = prefs->GetDictionary(prefs::kContentSettingsPatterns); | 425 patterns = prefs->GetDictionary(prefs::kContentSettingsPatterns); |
| 424 EXPECT_EQ(1U, patterns->size()); | 426 EXPECT_EQ(1U, patterns->size()); |
| 425 DictionaryValue* settings = NULL; | 427 DictionaryValue* settings = NULL; |
| 426 patterns->GetDictionaryWithoutPathExpansion(primary_pattern.ToString(), | 428 patterns->GetDictionaryWithoutPathExpansion(primary_pattern.ToString(), |
| 427 &settings); | 429 &settings); |
| 428 ASSERT_TRUE(NULL != settings); | 430 ASSERT_TRUE(NULL != settings); |
| 429 ASSERT_EQ(1U, settings->size()); | 431 ASSERT_EQ(1U, settings->size()); |
| 430 int setting_value; | 432 int setting_value; |
| (...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 672 | 674 |
| 673 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 675 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 674 GetContentSetting( | 676 GetContentSetting( |
| 675 &provider, | 677 &provider, |
| 676 primary_url, | 678 primary_url, |
| 677 primary_url, | 679 primary_url, |
| 678 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 680 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| 679 std::string(), | 681 std::string(), |
| 680 false)); | 682 false)); |
| 681 | 683 |
| 682 provider.SetContentSetting( | 684 provider.SetWebsiteSetting( |
| 683 ContentSettingsPattern::FromURL(primary_url), | 685 ContentSettingsPattern::FromURL(primary_url), |
| 684 ContentSettingsPattern::Wildcard(), | 686 ContentSettingsPattern::Wildcard(), |
| 685 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 687 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| 686 std::string(), | 688 std::string(), |
| 687 CONTENT_SETTING_ALLOW); | 689 Value::CreateIntegerValue(CONTENT_SETTING_ALLOW)); |
| 688 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 690 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 689 GetContentSetting( | 691 GetContentSetting( |
| 690 &provider, | 692 &provider, |
| 691 primary_url, | 693 primary_url, |
| 692 secondary_url, | 694 secondary_url, |
| 693 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | 695 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, |
| 694 std::string(), | 696 std::string(), |
| 695 false)); | 697 false)); |
| 696 provider.ShutdownOnUIThread(); | 698 provider.ShutdownOnUIThread(); |
| 697 } | 699 } |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 DictionaryValue* mutable_settings = update.Get(); | 864 DictionaryValue* mutable_settings = update.Get(); |
| 863 mutable_settings->SetWithoutPathExpansion("www.example.com,*", | 865 mutable_settings->SetWithoutPathExpansion("www.example.com,*", |
| 864 new base::DictionaryValue()); | 866 new base::DictionaryValue()); |
| 865 } | 867 } |
| 866 EXPECT_TRUE(observer.notification_received()); | 868 EXPECT_TRUE(observer.notification_received()); |
| 867 | 869 |
| 868 provider.ShutdownOnUIThread(); | 870 provider.ShutdownOnUIThread(); |
| 869 } | 871 } |
| 870 | 872 |
| 871 } // namespace content_settings | 873 } // namespace content_settings |
| OLD | NEW |