| 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 <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/auto_reset.h" | 9 #include "base/auto_reset.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 #if !defined(OS_ANDROID) | 157 #if !defined(OS_ANDROID) |
| 158 prefs->Set(kMouselockPrefPath, pref_data); | 158 prefs->Set(kMouselockPrefPath, pref_data); |
| 159 #endif | 159 #endif |
| 160 prefs->Set(kGeolocationPrefPath, pref_data); | 160 prefs->Set(kGeolocationPrefPath, pref_data); |
| 161 | 161 |
| 162 // Instantiate a new PrefProvider here, because we want to test the | 162 // Instantiate a new PrefProvider here, because we want to test the |
| 163 // constructor's behavior after setting the above. | 163 // constructor's behavior after setting the above. |
| 164 PrefProvider provider(prefs, false); | 164 PrefProvider provider(prefs, false); |
| 165 provider.ShutdownOnUIThread(); | 165 provider.ShutdownOnUIThread(); |
| 166 | 166 |
| 167 // Check that fullscreen and mouselock have been reset back to defaults. | 167 // Check that fullscreen and mouselock have been deleted. |
| 168 // TODO(mgiuca): These should be fully deleted, except that they keep being | 168 EXPECT_FALSE(prefs->HasPrefPath(kFullscreenPrefPath)); |
| 169 // recreated due to the content settings enum still existing. Delete the enum, | |
| 170 // then update this test to expect full deletion. https://crbug.com/591896. | |
| 171 // EXPECT_FALSE(prefs->HasPrefPath(kFullscreenPrefPath)); | |
| 172 // EXPECT_FALSE(prefs->HasPrefPath(kMouselockPrefPath)); | |
| 173 GURL primary_url("http://example.com/"); | |
| 174 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | |
| 175 TestUtils::GetContentSetting(&provider, primary_url, primary_url, | |
| 176 CONTENT_SETTINGS_TYPE_FULLSCREEN, | |
| 177 std::string(), false)); | |
| 178 #if !defined(OS_ANDROID) | 169 #if !defined(OS_ANDROID) |
| 179 EXPECT_EQ(CONTENT_SETTING_DEFAULT, | 170 EXPECT_FALSE(prefs->HasPrefPath(kMouselockPrefPath)); |
| 180 TestUtils::GetContentSetting(&provider, primary_url, primary_url, | |
| 181 CONTENT_SETTINGS_TYPE_MOUSELOCK, | |
| 182 std::string(), false)); | |
| 183 #endif | 171 #endif |
| 184 EXPECT_TRUE(prefs->HasPrefPath(kGeolocationPrefPath)); | 172 EXPECT_TRUE(prefs->HasPrefPath(kGeolocationPrefPath)); |
| 173 GURL primary_url("http://example.com/"); |
| 185 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 174 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
| 186 TestUtils::GetContentSetting(&provider, primary_url, primary_url, | 175 TestUtils::GetContentSetting(&provider, primary_url, primary_url, |
| 187 CONTENT_SETTINGS_TYPE_GEOLOCATION, | 176 CONTENT_SETTINGS_TYPE_GEOLOCATION, |
| 188 std::string(), false)); | 177 std::string(), false)); |
| 189 } | 178 } |
| 190 | 179 |
| 191 // Test for regression in which the PrefProvider modified the user pref store | 180 // Test for regression in which the PrefProvider modified the user pref store |
| 192 // of the OTR unintentionally: http://crbug.com/74466. | 181 // of the OTR unintentionally: http://crbug.com/74466. |
| 193 TEST_F(PrefProviderTest, Incognito) { | 182 TEST_F(PrefProviderTest, Incognito) { |
| 194 PersistentPrefStore* user_prefs = new TestingPrefStore(); | 183 PersistentPrefStore* user_prefs = new TestingPrefStore(); |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 578 for (const char* pref : nonempty_prefs) { | 567 for (const char* pref : nonempty_prefs) { |
| 579 DictionaryPrefUpdate update(&prefs, pref); | 568 DictionaryPrefUpdate update(&prefs, pref); |
| 580 const base::DictionaryValue* dictionary = update.Get(); | 569 const base::DictionaryValue* dictionary = update.Get(); |
| 581 EXPECT_EQ(1u, dictionary->size()); | 570 EXPECT_EQ(1u, dictionary->size()); |
| 582 } | 571 } |
| 583 | 572 |
| 584 provider.ShutdownOnUIThread(); | 573 provider.ShutdownOnUIThread(); |
| 585 } | 574 } |
| 586 | 575 |
| 587 } // namespace content_settings | 576 } // namespace content_settings |
| OLD | NEW |