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

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

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 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 <string> 5 #include <string>
6 6
7 #include "base/base_switches.h" 7 #include "base/base_switches.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 } 81 }
82 } 82 }
83 return sum; 83 return sum;
84 } 84 }
85 85
86 scoped_ptr<base::DictionaryValue> ReadPrefsDictionary( 86 scoped_ptr<base::DictionaryValue> ReadPrefsDictionary(
87 const base::FilePath& pref_file) { 87 const base::FilePath& pref_file) {
88 JSONFileValueDeserializer deserializer(pref_file); 88 JSONFileValueDeserializer deserializer(pref_file);
89 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR; 89 int error_code = JSONFileValueDeserializer::JSON_NO_ERROR;
90 std::string error_str; 90 std::string error_str;
91 scoped_ptr<base::Value> prefs( 91 scoped_ptr<base::Value> prefs =
92 deserializer.Deserialize(&error_code, &error_str)); 92 deserializer.Deserialize(&error_code, &error_str);
93 if (!prefs || error_code != JSONFileValueDeserializer::JSON_NO_ERROR) { 93 if (!prefs || error_code != JSONFileValueDeserializer::JSON_NO_ERROR) {
94 ADD_FAILURE() << "Error #" << error_code << ": " << error_str; 94 ADD_FAILURE() << "Error #" << error_code << ": " << error_str;
95 return scoped_ptr<base::DictionaryValue>(); 95 return scoped_ptr<base::DictionaryValue>();
96 } 96 }
97 if (!prefs->IsType(base::Value::TYPE_DICTIONARY)) { 97 if (!prefs->IsType(base::Value::TYPE_DICTIONARY)) {
98 ADD_FAILURE(); 98 ADD_FAILURE();
99 return scoped_ptr<base::DictionaryValue>(); 99 return scoped_ptr<base::DictionaryValue>();
100 } 100 }
101 return scoped_ptr<base::DictionaryValue>( 101 return scoped_ptr<base::DictionaryValue>(
102 static_cast<base::DictionaryValue*>(prefs.release())); 102 static_cast<base::DictionaryValue*>(prefs.release()));
(...skipping 814 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 "Settings.TrackedPreferenceNullInitialized", ALLOW_NONE)); 917 "Settings.TrackedPreferenceNullInitialized", ALLOW_NONE));
918 EXPECT_EQ( 918 EXPECT_EQ(
919 0, 919 0,
920 GetTrackedPrefHistogramCount( 920 GetTrackedPrefHistogramCount(
921 "Settings.TrackedPreferenceMigratedLegacyDeviceId", ALLOW_NONE)); 921 "Settings.TrackedPreferenceMigratedLegacyDeviceId", ALLOW_NONE));
922 } 922 }
923 }; 923 };
924 924
925 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedAdditionToPrefsAfterWipe, 925 PREF_HASH_BROWSER_TEST(PrefHashBrowserTestUntrustedAdditionToPrefsAfterWipe,
926 UntrustedAdditionToPrefsAfterWipe); 926 UntrustedAdditionToPrefsAfterWipe);
OLDNEW
« no previous file with comments | « chrome/browser/prefs/pref_service_browsertest.cc ('k') | chrome/browser/supervised_user/supervised_user_site_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698