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

Side by Side Diff: chrome/browser/supervised_user/supervised_user_service_browsertest.cc

Issue 1878143002: Convert //chrome/browser/supervised_user from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 std::string original_name = prefs->GetString(prefs::kProfileName); 123 std::string original_name = prefs->GetString(prefs::kProfileName);
124 124
125 SupervisedUserSettingsService* settings = 125 SupervisedUserSettingsService* settings =
126 SupervisedUserSettingsServiceFactory::GetForProfile(profile); 126 SupervisedUserSettingsServiceFactory::GetForProfile(profile);
127 127
128 // Change the name. Both the profile pref and the entry in 128 // Change the name. Both the profile pref and the entry in
129 // ProfileAttributesStorage should be updated. 129 // ProfileAttributesStorage should be updated.
130 std::string name = "Supervised User Test Name"; 130 std::string name = "Supervised User Test Name";
131 settings->SetLocalSetting( 131 settings->SetLocalSetting(
132 supervised_users::kUserName, 132 supervised_users::kUserName,
133 scoped_ptr<base::Value>(new base::StringValue(name))); 133 std::unique_ptr<base::Value>(new base::StringValue(name)));
134 EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kProfileName)); 134 EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kProfileName));
135 EXPECT_EQ(name, prefs->GetString(prefs::kProfileName)); 135 EXPECT_EQ(name, prefs->GetString(prefs::kProfileName));
136 136
137 ProfileAttributesEntry* entry; 137 ProfileAttributesEntry* entry;
138 ASSERT_TRUE(g_browser_process->profile_manager()-> 138 ASSERT_TRUE(g_browser_process->profile_manager()->
139 GetProfileAttributesStorage(). 139 GetProfileAttributesStorage().
140 GetProfileAttributesWithPath(profile->GetPath(), &entry)); 140 GetProfileAttributesWithPath(profile->GetPath(), &entry));
141 EXPECT_EQ(name, base::UTF16ToUTF8(entry->GetName())); 141 EXPECT_EQ(name, base::UTF16ToUTF8(entry->GetName()));
142 142
143 // Change the name once more. 143 // Change the name once more.
144 std::string new_name = "New Supervised User Test Name"; 144 std::string new_name = "New Supervised User Test Name";
145 settings->SetLocalSetting( 145 settings->SetLocalSetting(
146 supervised_users::kUserName, 146 supervised_users::kUserName,
147 scoped_ptr<base::Value>(new base::StringValue(new_name))); 147 std::unique_ptr<base::Value>(new base::StringValue(new_name)));
148 EXPECT_EQ(new_name, prefs->GetString(prefs::kProfileName)); 148 EXPECT_EQ(new_name, prefs->GetString(prefs::kProfileName));
149 EXPECT_EQ(new_name, base::UTF16ToUTF8(entry->GetName())); 149 EXPECT_EQ(new_name, base::UTF16ToUTF8(entry->GetName()));
150 150
151 // Remove the setting. 151 // Remove the setting.
152 settings->SetLocalSetting(supervised_users::kUserName, 152 settings->SetLocalSetting(supervised_users::kUserName,
153 scoped_ptr<base::Value>()); 153 std::unique_ptr<base::Value>());
154 EXPECT_EQ(original_name, prefs->GetString(prefs::kProfileName)); 154 EXPECT_EQ(original_name, prefs->GetString(prefs::kProfileName));
155 EXPECT_EQ(original_name, base::UTF16ToUTF8(entry->GetName())); 155 EXPECT_EQ(original_name, base::UTF16ToUTF8(entry->GetName()));
156 } 156 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698