| OLD | NEW |
| 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 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 std::string original_name = prefs->GetString(prefs::kProfileName); | 124 std::string original_name = prefs->GetString(prefs::kProfileName); |
| 125 | 125 |
| 126 SupervisedUserSettingsService* settings = | 126 SupervisedUserSettingsService* settings = |
| 127 SupervisedUserSettingsServiceFactory::GetForProfile(profile); | 127 SupervisedUserSettingsServiceFactory::GetForProfile(profile); |
| 128 | 128 |
| 129 // Change the name. Both the profile pref and the entry in | 129 // Change the name. Both the profile pref and the entry in |
| 130 // ProfileAttributesStorage should be updated. | 130 // ProfileAttributesStorage should be updated. |
| 131 std::string name = "Supervised User Test Name"; | 131 std::string name = "Supervised User Test Name"; |
| 132 settings->SetLocalSetting( | 132 settings->SetLocalSetting( |
| 133 supervised_users::kUserName, | 133 supervised_users::kUserName, |
| 134 std::unique_ptr<base::Value>(new base::StringValue(name))); | 134 std::unique_ptr<base::Value>(new base::Value(name))); |
| 135 EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kProfileName)); | 135 EXPECT_FALSE(prefs->IsUserModifiablePreference(prefs::kProfileName)); |
| 136 EXPECT_EQ(name, prefs->GetString(prefs::kProfileName)); | 136 EXPECT_EQ(name, prefs->GetString(prefs::kProfileName)); |
| 137 | 137 |
| 138 ProfileAttributesEntry* entry; | 138 ProfileAttributesEntry* entry; |
| 139 ASSERT_TRUE(g_browser_process->profile_manager()-> | 139 ASSERT_TRUE(g_browser_process->profile_manager()-> |
| 140 GetProfileAttributesStorage(). | 140 GetProfileAttributesStorage(). |
| 141 GetProfileAttributesWithPath(profile->GetPath(), &entry)); | 141 GetProfileAttributesWithPath(profile->GetPath(), &entry)); |
| 142 EXPECT_EQ(name, base::UTF16ToUTF8(entry->GetName())); | 142 EXPECT_EQ(name, base::UTF16ToUTF8(entry->GetName())); |
| 143 | 143 |
| 144 // Change the name once more. | 144 // Change the name once more. |
| 145 std::string new_name = "New Supervised User Test Name"; | 145 std::string new_name = "New Supervised User Test Name"; |
| 146 settings->SetLocalSetting( | 146 settings->SetLocalSetting( |
| 147 supervised_users::kUserName, | 147 supervised_users::kUserName, |
| 148 std::unique_ptr<base::Value>(new base::StringValue(new_name))); | 148 std::unique_ptr<base::Value>(new base::Value(new_name))); |
| 149 EXPECT_EQ(new_name, prefs->GetString(prefs::kProfileName)); | 149 EXPECT_EQ(new_name, prefs->GetString(prefs::kProfileName)); |
| 150 EXPECT_EQ(new_name, base::UTF16ToUTF8(entry->GetName())); | 150 EXPECT_EQ(new_name, base::UTF16ToUTF8(entry->GetName())); |
| 151 | 151 |
| 152 // Remove the setting. | 152 // Remove the setting. |
| 153 settings->SetLocalSetting(supervised_users::kUserName, | 153 settings->SetLocalSetting(supervised_users::kUserName, |
| 154 std::unique_ptr<base::Value>()); | 154 std::unique_ptr<base::Value>()); |
| 155 EXPECT_EQ(original_name, prefs->GetString(prefs::kProfileName)); | 155 EXPECT_EQ(original_name, prefs->GetString(prefs::kProfileName)); |
| 156 EXPECT_EQ(original_name, base::UTF16ToUTF8(entry->GetName())); | 156 EXPECT_EQ(original_name, base::UTF16ToUTF8(entry->GetName())); |
| 157 } | 157 } |
| OLD | NEW |