Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: chrome/browser/content_settings/content_settings_policy_provider_unittest.cc

Issue 2853983002: Ensure settings returned from Content Settings providers are valid (Closed)
Patch Set: Ensure settings returned from Content Settings providers are valid Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "components/content_settings/core/browser/content_settings_policy_provi der.h" 5 #include "components/content_settings/core/browser/content_settings_policy_provi der.h"
6 6
7 #include <memory> 7 #include <memory>
8 #include <string> 8 #include <string>
9 9
10 #include "base/auto_reset.h" 10 #include "base/auto_reset.h"
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 274
275 ASSERT_EQ(base::Value::Type::DICTIONARY, cert_filter->GetType()); 275 ASSERT_EQ(base::Value::Type::DICTIONARY, cert_filter->GetType());
276 base::DictionaryValue* dict_value = 276 base::DictionaryValue* dict_value =
277 static_cast<base::DictionaryValue*>(cert_filter.get()); 277 static_cast<base::DictionaryValue*>(cert_filter.get());
278 std::string actual_common_name; 278 std::string actual_common_name;
279 ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name)); 279 ASSERT_TRUE(dict_value->GetString("ISSUER.CN", &actual_common_name));
280 EXPECT_EQ("issuer name", actual_common_name); 280 EXPECT_EQ("issuer name", actual_common_name);
281 provider.ShutdownOnUIThread(); 281 provider.ShutdownOnUIThread();
282 } 282 }
283 283
284 TEST_F(PolicyProviderTest, InvalidManagedDefaultContentSetting) {
285 TestingProfile profile;
286 sync_preferences::TestingPrefServiceSyncable* prefs =
287 profile.GetTestingPrefService();
288 PolicyProvider provider(prefs);
289
290 prefs->SetManagedPref(
291 prefs::kManagedDefaultCookiesSetting,
292 base::MakeUnique<base::Value>(CONTENT_SETTING_DETECT_IMPORTANT_CONTENT));
293
294 // The setting provided in the cookies pref is not valid for cookies. It
295 // should be ignored.
296 std::unique_ptr<RuleIterator> rule_iterator(provider.GetRuleIterator(
297 CONTENT_SETTINGS_TYPE_COOKIES, std::string(), false));
298 EXPECT_FALSE(rule_iterator);
299
300 provider.ShutdownOnUIThread();
301 }
302
284 } // namespace content_settings 303 } // namespace content_settings
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698