| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/browser/content_settings/stub_settings_observer.h" | 9 #include "chrome/browser/content_settings/stub_settings_observer.h" |
| 10 #include "chrome/browser/prefs/pref_service.h" | 10 #include "chrome/browser/prefs/pref_service.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 profile.set_off_the_record(true); | 100 profile.set_off_the_record(true); |
| 101 PrefDefaultProvider otr_provider(&profile); | 101 PrefDefaultProvider otr_provider(&profile); |
| 102 profile.set_off_the_record(false); | 102 profile.set_off_the_record(false); |
| 103 | 103 |
| 104 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 104 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 105 provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); | 105 provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 106 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 106 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 107 otr_provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); | 107 otr_provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 108 | 108 |
| 109 // Changing content settings on the main provider should also affect the | 109 // Changing content settings on the main provider should also affect the |
| 110 // off-the-record map. | 110 // incognito map. |
| 111 provider.UpdateDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES, | 111 provider.UpdateDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES, |
| 112 CONTENT_SETTING_BLOCK); | 112 CONTENT_SETTING_BLOCK); |
| 113 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 113 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 114 provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); | 114 provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 115 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 115 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 116 otr_provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); | 116 otr_provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 117 | 117 |
| 118 // Changing content settings on the off-the-record provider should be ignored. | 118 // Changing content settings on the incognito provider should be ignored. |
| 119 otr_provider.UpdateDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES, | 119 otr_provider.UpdateDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES, |
| 120 CONTENT_SETTING_ALLOW); | 120 CONTENT_SETTING_ALLOW); |
| 121 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 121 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 122 provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); | 122 provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 123 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 123 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 124 otr_provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); | 124 otr_provider.ProvideDefaultSetting(CONTENT_SETTINGS_TYPE_COOKIES)); |
| 125 } | 125 } |
| 126 | 126 |
| 127 // //////////////////////////////////////////////////////////////////////////// | 127 // //////////////////////////////////////////////////////////////////////////// |
| 128 // PrefProviderTest | 128 // PrefProviderTest |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 CONTENT_SETTING_BLOCK); | 250 CONTENT_SETTING_BLOCK); |
| 251 EXPECT_EQ(CONTENT_SETTING_BLOCK, | 251 EXPECT_EQ(CONTENT_SETTING_BLOCK, |
| 252 pref_content_settings_provider.GetContentSetting( | 252 pref_content_settings_provider.GetContentSetting( |
| 253 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1)); | 253 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource1)); |
| 254 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 254 EXPECT_EQ(CONTENT_SETTING_DEFAULT, |
| 255 pref_content_settings_provider.GetContentSetting( | 255 pref_content_settings_provider.GetContentSetting( |
| 256 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource2)); | 256 host, host, CONTENT_SETTINGS_TYPE_PLUGINS, resource2)); |
| 257 } | 257 } |
| 258 | 258 |
| 259 } // namespace content_settings | 259 } // namespace content_settings |
| OLD | NEW |