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 "base/auto_reset.h" | 5 #include "base/auto_reset.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/json/json_reader.h" | 7 #include "base/json/json_reader.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/prefs/scoped_user_pref_update.h" | 11 #include "base/prefs/scoped_user_pref_update.h" |
12 #include "chrome/browser/content_settings/content_settings_mock_observer.h" | 12 #include "chrome/browser/content_settings/content_settings_mock_observer.h" |
13 #include "chrome/browser/content_settings/cookie_settings.h" | 13 #include "chrome/browser/content_settings/cookie_settings.h" |
14 #include "chrome/browser/content_settings/host_content_settings_map.h" | 14 #include "chrome/browser/content_settings/host_content_settings_map.h" |
15 #include "chrome/browser/content_settings/mock_settings_observer.h" | 15 #include "chrome/browser/content_settings/mock_settings_observer.h" |
16 #include "chrome/common/chrome_switches.h" | 16 #include "chrome/common/chrome_switches.h" |
17 #include "chrome/common/pref_names.h" | 17 #include "chrome/common/pref_names.h" |
18 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
19 #include "chrome/test/base/testing_pref_service_syncable.h" | 19 #include "chrome/test/base/testing_pref_service_syncable.h" |
20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
21 #include "components/content_settings/core/browser/content_settings_details.h" | 21 #include "components/content_settings/core/browser/content_settings_details.h" |
22 #include "content/public/test/test_browser_thread.h" | 22 #include "content/public/test/test_browser_thread_bundle.h" |
23 #include "net/base/static_cookie_policy.h" | 23 #include "net/base/static_cookie_policy.h" |
24 #include "testing/gtest/include/gtest/gtest.h" | 24 #include "testing/gtest/include/gtest/gtest.h" |
25 #include "url/gurl.h" | 25 #include "url/gurl.h" |
26 | 26 |
27 using content::BrowserThread; | |
28 | |
29 using ::testing::_; | 27 using ::testing::_; |
30 | 28 |
31 class HostContentSettingsMapTest : public testing::Test { | 29 class HostContentSettingsMapTest : public testing::Test { |
32 public: | 30 public: |
33 HostContentSettingsMapTest() : ui_thread_(BrowserThread::UI, &message_loop_) { | 31 HostContentSettingsMapTest() {} |
34 } | |
35 | 32 |
36 protected: | 33 protected: |
37 base::MessageLoop message_loop_; | 34 content::TestBrowserThreadBundle thread_bundle_; |
38 content::TestBrowserThread ui_thread_; | |
39 }; | 35 }; |
40 | 36 |
41 TEST_F(HostContentSettingsMapTest, DefaultValues) { | 37 TEST_F(HostContentSettingsMapTest, DefaultValues) { |
42 TestingProfile profile; | 38 TestingProfile profile; |
43 HostContentSettingsMap* host_content_settings_map = | 39 HostContentSettingsMap* host_content_settings_map = |
44 profile.GetHostContentSettingsMap(); | 40 profile.GetHostContentSettingsMap(); |
45 | 41 |
46 // Check setting defaults. | 42 // Check setting defaults. |
47 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 43 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
48 host_content_settings_map->GetDefaultContentSetting( | 44 host_content_settings_map->GetDefaultContentSetting( |
(...skipping 1027 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1076 CONTENT_SETTINGS_TYPE_IMAGES, true); | 1072 CONTENT_SETTINGS_TYPE_IMAGES, true); |
1077 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 1073 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
1078 host_content_settings_map->GetContentSetting( | 1074 host_content_settings_map->GetContentSetting( |
1079 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1075 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
1080 host_content_settings_map->SetDefaultContentSetting( | 1076 host_content_settings_map->SetDefaultContentSetting( |
1081 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); | 1077 CONTENT_SETTINGS_TYPE_IMAGES, CONTENT_SETTING_BLOCK); |
1082 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 1078 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
1083 host_content_settings_map->GetContentSetting( | 1079 host_content_settings_map->GetContentSetting( |
1084 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); | 1080 host, host, CONTENT_SETTINGS_TYPE_IMAGES, std::string())); |
1085 } | 1081 } |
OLD | NEW |