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 "base/memory/scoped_ptr.h" | 5 #include "base/memory/scoped_ptr.h" |
6 #include "base/message_loop/message_loop.h" | 6 #include "base/message_loop/message_loop.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/prefs/scoped_user_pref_update.h" | 8 #include "base/prefs/scoped_user_pref_update.h" |
9 #include "base/prefs/testing_pref_service.h" | 9 #include "base/prefs/testing_pref_service.h" |
10 #include "chrome/browser/content_settings/content_settings_mock_observer.h" | 10 #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
11 #include "chrome/common/pref_names.h" | 11 #include "chrome/common/pref_names.h" |
12 #include "chrome/test/base/testing_profile.h" | 12 #include "chrome/test/base/testing_profile.h" |
13 #include "components/content_settings/core/browser/content_settings_default_prov
ider.h" | 13 #include "components/content_settings/core/browser/content_settings_default_prov
ider.h" |
14 #include "components/content_settings/core/browser/content_settings_utils.h" | 14 #include "components/content_settings/core/browser/content_settings_utils.h" |
15 #include "components/content_settings/core/test/content_settings_test_utils.h" | 15 #include "components/content_settings/core/test/content_settings_test_utils.h" |
| 16 #include "content/public/test/test_browser_thread_bundle.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 17 #include "testing/gtest/include/gtest/gtest.h" |
17 #include "url/gurl.h" | 18 #include "url/gurl.h" |
18 | 19 |
19 using ::testing::_; | 20 using ::testing::_; |
20 | 21 |
21 class DefaultProviderTest : public testing::Test { | 22 class DefaultProviderTest : public testing::Test { |
22 public: | 23 public: |
23 DefaultProviderTest() | 24 DefaultProviderTest() |
24 : provider_(profile_.GetPrefs(), false) { | 25 : provider_(profile_.GetPrefs(), false) { |
25 } | 26 } |
26 ~DefaultProviderTest() override { provider_.ShutdownOnUIThread(); } | 27 ~DefaultProviderTest() override { provider_.ShutdownOnUIThread(); } |
27 | 28 |
28 protected: | 29 protected: |
| 30 content::TestBrowserThreadBundle thread_bundle_; |
29 TestingProfile profile_; | 31 TestingProfile profile_; |
30 content_settings::DefaultProvider provider_; | 32 content_settings::DefaultProvider provider_; |
31 }; | 33 }; |
32 | 34 |
33 TEST_F(DefaultProviderTest, DefaultValues) { | 35 TEST_F(DefaultProviderTest, DefaultValues) { |
34 // Check setting defaults. | 36 // Check setting defaults. |
35 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 37 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
36 GetContentSetting(&provider_, | 38 GetContentSetting(&provider_, |
37 GURL(), | 39 GURL(), |
38 GURL(), | 40 GURL(), |
(...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 | 297 |
296 default_settings_dictionary->GetIntegerWithoutPathExpansion( | 298 default_settings_dictionary->GetIntegerWithoutPathExpansion( |
297 content_settings::GetTypeName(CONTENT_SETTINGS_TYPE_JAVASCRIPT), | 299 content_settings::GetTypeName(CONTENT_SETTINGS_TYPE_JAVASCRIPT), |
298 &js_setting); | 300 &js_setting); |
299 has_cd_setting = default_settings_dictionary->HasKey( | 301 has_cd_setting = default_settings_dictionary->HasKey( |
300 content_settings::GetTypeName(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS)); | 302 content_settings::GetTypeName(CONTENT_SETTINGS_TYPE_SSL_CERT_DECISIONS)); |
301 | 303 |
302 EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(js_setting)); | 304 EXPECT_EQ(CONTENT_SETTING_BLOCK, IntToContentSetting(js_setting)); |
303 EXPECT_FALSE(has_cd_setting); | 305 EXPECT_FALSE(has_cd_setting); |
304 } | 306 } |
OLD | NEW |