| OLD | NEW |
| 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 "components/content_settings/core/browser/content_settings_pref_provide
r.h" | 5 #include "components/content_settings/core/browser/content_settings_pref_provide
r.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/message_loop/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 resource1, false)); | 383 resource1, false)); |
| 384 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 384 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 385 GetContentSetting( | 385 GetContentSetting( |
| 386 &pref_content_settings_provider, | 386 &pref_content_settings_provider, |
| 387 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, | 387 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, |
| 388 resource2, false)); | 388 resource2, false)); |
| 389 | 389 |
| 390 pref_content_settings_provider.ShutdownOnUIThread(); | 390 pref_content_settings_provider.ShutdownOnUIThread(); |
| 391 } | 391 } |
| 392 | 392 |
| 393 TEST_F(PrefProviderTest, AutoSubmitCertificateContentSetting) { | |
| 394 TestingProfile profile; | |
| 395 syncable_prefs::TestingPrefServiceSyncable* prefs = | |
| 396 profile.GetTestingPrefService(); | |
| 397 GURL primary_url("https://www.example.com"); | |
| 398 GURL secondary_url("https://www.sample.com"); | |
| 399 | |
| 400 PrefProvider provider(prefs, false); | |
| 401 | |
| 402 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | |
| 403 GetContentSetting( | |
| 404 &provider, | |
| 405 primary_url, | |
| 406 primary_url, | |
| 407 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | |
| 408 std::string(), | |
| 409 false)); | |
| 410 | |
| 411 provider.SetWebsiteSetting(ContentSettingsPattern::FromURL(primary_url), | |
| 412 ContentSettingsPattern::Wildcard(), | |
| 413 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | |
| 414 std::string(), | |
| 415 new base::FundamentalValue(CONTENT_SETTING_ALLOW)); | |
| 416 EXPECT_EQ(CONTENT_SETTING_ALLOW, | |
| 417 GetContentSetting( | |
| 418 &provider, | |
| 419 primary_url, | |
| 420 secondary_url, | |
| 421 CONTENT_SETTINGS_TYPE_AUTO_SELECT_CERTIFICATE, | |
| 422 std::string(), | |
| 423 false)); | |
| 424 provider.ShutdownOnUIThread(); | |
| 425 } | |
| 426 | |
| 427 // http://crosbug.com/17760 | 393 // http://crosbug.com/17760 |
| 428 TEST_F(PrefProviderTest, Deadlock) { | 394 TEST_F(PrefProviderTest, Deadlock) { |
| 429 syncable_prefs::TestingPrefServiceSyncable prefs; | 395 syncable_prefs::TestingPrefServiceSyncable prefs; |
| 430 PrefProvider::RegisterProfilePrefs(prefs.registry()); | 396 PrefProvider::RegisterProfilePrefs(prefs.registry()); |
| 431 | 397 |
| 432 // Chain of events: a preference changes, |PrefProvider| notices it, and reads | 398 // Chain of events: a preference changes, |PrefProvider| notices it, and reads |
| 433 // and writes the preference. When the preference is written, a notification | 399 // and writes the preference. When the preference is written, a notification |
| 434 // is sent, and this used to happen when |PrefProvider| was still holding its | 400 // is sent, and this used to happen when |PrefProvider| was still holding its |
| 435 // lock. | 401 // lock. |
| 436 | 402 |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 618 for (const char* pref : nonempty_prefs) { | 584 for (const char* pref : nonempty_prefs) { |
| 619 DictionaryPrefUpdate update(&prefs, pref); | 585 DictionaryPrefUpdate update(&prefs, pref); |
| 620 const base::DictionaryValue* dictionary = update.Get(); | 586 const base::DictionaryValue* dictionary = update.Get(); |
| 621 EXPECT_EQ(1u, dictionary->size()); | 587 EXPECT_EQ(1u, dictionary->size()); |
| 622 } | 588 } |
| 623 | 589 |
| 624 provider.ShutdownOnUIThread(); | 590 provider.ShutdownOnUIThread(); |
| 625 } | 591 } |
| 626 | 592 |
| 627 } // namespace content_settings | 593 } // namespace content_settings |
| OLD | NEW |