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

Side by Side Diff: chrome/browser/prefs/tracked/pref_hash_browsertest.cc

Issue 2806283002: Revert of Stop passing raw pointers to base::Value API in c/b/chromeos and c/b/extensions (Closed)
Patch Set: Created 3 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <memory> 5 #include <memory>
6 #include <string> 6 #include <string>
7 #include <utility>
8 7
9 #include "base/base_switches.h" 8 #include "base/base_switches.h"
10 #include "base/command_line.h" 9 #include "base/command_line.h"
11 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
12 #include "base/files/file_util.h" 11 #include "base/files/file_util.h"
13 #include "base/json/json_file_value_serializer.h" 12 #include "base/json/json_file_value_serializer.h"
14 #include "base/json/json_reader.h" 13 #include "base/json/json_reader.h"
15 #include "base/memory/ptr_util.h"
16 #include "base/metrics/histogram_base.h" 14 #include "base/metrics/histogram_base.h"
17 #include "base/metrics/histogram_samples.h" 15 #include "base/metrics/histogram_samples.h"
18 #include "base/metrics/statistics_recorder.h" 16 #include "base/metrics/statistics_recorder.h"
19 #include "base/path_service.h" 17 #include "base/path_service.h"
20 #include "base/strings/string_number_conversions.h" 18 #include "base/strings/string_number_conversions.h"
21 #include "base/strings/string_util.h" 19 #include "base/strings/string_util.h"
22 #include "base/strings/utf_string_conversions.h" 20 #include "base/strings/utf_string_conversions.h"
23 #include "base/values.h" 21 #include "base/values.h"
24 #include "build/build_config.h" 22 #include "build/build_config.h"
25 #include "chrome/browser/extensions/extension_browsertest.h" 23 #include "chrome/browser/extensions/extension_browsertest.h"
(...skipping 854 matching lines...) Expand 10 before | Expand all | Expand 10 after
880 // Tamper with any installed setting for good.crx 878 // Tamper with any installed setting for good.crx
881 base::DictionaryValue* good_crx_dict; 879 base::DictionaryValue* good_crx_dict;
882 EXPECT_TRUE(extensions_dict->GetDictionary(kGoodCrxId, &good_crx_dict)); 880 EXPECT_TRUE(extensions_dict->GetDictionary(kGoodCrxId, &good_crx_dict));
883 int good_crx_state; 881 int good_crx_state;
884 EXPECT_TRUE(good_crx_dict->GetInteger("state", &good_crx_state)); 882 EXPECT_TRUE(good_crx_dict->GetInteger("state", &good_crx_state));
885 EXPECT_EQ(extensions::Extension::ENABLED, good_crx_state); 883 EXPECT_EQ(extensions::Extension::ENABLED, good_crx_state);
886 good_crx_dict->SetInteger("state", extensions::Extension::DISABLED); 884 good_crx_dict->SetInteger("state", extensions::Extension::DISABLED);
887 885
888 // Drop a fake extension (for the purpose of this test, dropped settings 886 // Drop a fake extension (for the purpose of this test, dropped settings
889 // don't need to be valid extension settings). 887 // don't need to be valid extension settings).
890 auto fake_extension = base::MakeUnique<base::DictionaryValue>(); 888 base::DictionaryValue* fake_extension = new base::DictionaryValue;
891 fake_extension->SetString("name", "foo"); 889 fake_extension->SetString("name", "foo");
892 extensions_dict->Set(std::string(32, 'a'), std::move(fake_extension)); 890 extensions_dict->Set(std::string(32, 'a'), fake_extension);
893 } 891 }
894 892
895 void VerifyReactionToPrefAttack() override { 893 void VerifyReactionToPrefAttack() override {
896 // Expect a single split pref changed report with a count of 2 for tracked 894 // Expect a single split pref changed report with a count of 2 for tracked
897 // pref #5 (extensions). 895 // pref #5 (extensions).
898 EXPECT_EQ(protection_level_ > PROTECTION_DISABLED_ON_PLATFORM ? 1 : 0, 896 EXPECT_EQ(protection_level_ > PROTECTION_DISABLED_ON_PLATFORM ? 1 : 0,
899 GetTrackedPrefHistogramCount( 897 GetTrackedPrefHistogramCount(
900 user_prefs::tracked::kTrackedPrefHistogramChanged, 898 user_prefs::tracked::kTrackedPrefHistogramChanged,
901 BEGIN_ALLOW_SINGLE_BUCKET + 5)); 899 BEGIN_ALLOW_SINGLE_BUCKET + 5));
902 EXPECT_EQ(protection_level_ > PROTECTION_DISABLED_ON_PLATFORM ? 1 : 0, 900 EXPECT_EQ(protection_level_ > PROTECTION_DISABLED_ON_PLATFORM ? 1 : 0,
(...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after
1273 EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, dse_source); 1271 EXPECT_EQ(DefaultSearchManager::FROM_FALLBACK, dse_source);
1274 EXPECT_NE(current_dse->keyword(), base::UTF8ToUTF16("badkeyword")); 1272 EXPECT_NE(current_dse->keyword(), base::UTF8ToUTF16("badkeyword"));
1275 EXPECT_NE(current_dse->short_name(), base::UTF8ToUTF16("badname")); 1273 EXPECT_NE(current_dse->short_name(), base::UTF8ToUTF16("badname"));
1276 EXPECT_NE(current_dse->url(), 1274 EXPECT_NE(current_dse->url(),
1277 "http://bad_default_engine/search?q=dirty_user_query"); 1275 "http://bad_default_engine/search?q=dirty_user_query");
1278 } 1276 }
1279 } 1277 }
1280 }; 1278 };
1281 1279
1282 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestDefaultSearch, SearchProtected); 1280 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestDefaultSearch, SearchProtected);
OLDNEW
« no previous file with comments | « chrome/browser/prefs/session_startup_pref_unittest.cc ('k') | chrome/common/extensions/sync_type_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698