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 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 base::DictionaryValue mic_pref_data; | 217 base::DictionaryValue mic_pref_data; |
218 mic_pref_data.SetWithoutPathExpansion(kPattern, std::move(mic_pattern_data)); | 218 mic_pref_data.SetWithoutPathExpansion(kPattern, std::move(mic_pattern_data)); |
219 prefs->Set(kMicPrefPath, mic_pref_data); | 219 prefs->Set(kMicPrefPath, mic_pref_data); |
220 | 220 |
221 // Instantiate a new PrefProvider here, because we want to test the | 221 // Instantiate a new PrefProvider here, because we want to test the |
222 // constructor's behavior after setting the above. | 222 // constructor's behavior after setting the above. |
223 PrefProvider provider(prefs, false); | 223 PrefProvider provider(prefs, false); |
224 | 224 |
225 // Check that last_used data has been deleted. | 225 // Check that last_used data has been deleted. |
226 EXPECT_TRUE(prefs->GetDictionary(kGeolocationPrefPath)->empty()); | 226 EXPECT_TRUE(prefs->GetDictionary(kGeolocationPrefPath)->empty()); |
227 auto* mic_prefs = prefs->GetDictionary(kMicPrefPath); | 227 auto mic_prefs = prefs->GetDictionary(kMicPrefPath); |
228 const base::DictionaryValue* mic_result_pattern_data; | 228 const base::DictionaryValue* mic_result_pattern_data; |
229 ASSERT_TRUE(mic_prefs->GetDictionaryWithoutPathExpansion( | 229 ASSERT_TRUE(mic_prefs->GetDictionaryWithoutPathExpansion( |
230 kPattern, &mic_result_pattern_data)); | 230 kPattern, &mic_result_pattern_data)); |
231 EXPECT_EQ(static_cast<size_t>(1), mic_result_pattern_data->size()); | 231 EXPECT_EQ(static_cast<size_t>(1), mic_result_pattern_data->size()); |
232 int mic_result_setting; | 232 int mic_result_setting; |
233 EXPECT_TRUE( | 233 EXPECT_TRUE( |
234 mic_result_pattern_data->GetInteger("setting", &mic_result_setting)); | 234 mic_result_pattern_data->GetInteger("setting", &mic_result_setting)); |
235 EXPECT_EQ(CONTENT_SETTING_ALLOW, mic_result_setting); | 235 EXPECT_EQ(CONTENT_SETTING_ALLOW, mic_result_setting); |
236 EXPECT_EQ(CONTENT_SETTING_ALLOW, | 236 EXPECT_EQ(CONTENT_SETTING_ALLOW, |
237 TestUtils::GetContentSetting(&provider, host, host, | 237 TestUtils::GetContentSetting(&provider, host, host, |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 for (const char* pref : nonempty_prefs) { | 595 for (const char* pref : nonempty_prefs) { |
596 DictionaryPrefUpdate update(&prefs, pref); | 596 DictionaryPrefUpdate update(&prefs, pref); |
597 const base::DictionaryValue* dictionary = update.Get(); | 597 const base::DictionaryValue* dictionary = update.Get(); |
598 EXPECT_EQ(1u, dictionary->size()); | 598 EXPECT_EQ(1u, dictionary->size()); |
599 } | 599 } |
600 | 600 |
601 provider.ShutdownOnUIThread(); | 601 provider.ShutdownOnUIThread(); |
602 } | 602 } |
603 | 603 |
604 } // namespace content_settings | 604 } // namespace content_settings |
OLD | NEW |