| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <vector> | 5 #include <vector> |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/prefs/pref_service.h" | 8 #include "base/prefs/pref_service.h" |
| 9 #include "base/values.h" | 9 #include "base/values.h" |
| 10 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat
e.h" | 10 #include "chrome/browser/chromeos/extensions/users_private/users_private_delegat
e.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 namespace extensions { | 23 namespace extensions { |
| 24 | 24 |
| 25 namespace { | 25 namespace { |
| 26 | 26 |
| 27 class TestPrefsUtil : public PrefsUtil { | 27 class TestPrefsUtil : public PrefsUtil { |
| 28 public: | 28 public: |
| 29 explicit TestPrefsUtil(Profile* profile) : PrefsUtil(profile) {} | 29 explicit TestPrefsUtil(Profile* profile) : PrefsUtil(profile) {} |
| 30 | 30 |
| 31 scoped_ptr<api::settings_private::PrefObject> GetPref( | 31 scoped_ptr<api::settings_private::PrefData> GetPref( |
| 32 const std::string& name) override { | 32 const std::string& name) override { |
| 33 if (name != "cros.accounts.users") | 33 if (name != "cros.accounts.users") |
| 34 return PrefsUtil::GetPref(name); | 34 return PrefsUtil::GetPref(name); |
| 35 | 35 |
| 36 scoped_ptr<api::settings_private::PrefObject> pref_object( | 36 scoped_ptr<api::settings_private::PrefData> pref_data( |
| 37 new api::settings_private::PrefObject()); | 37 new api::settings_private::PrefData()); |
| 38 pref_object->key = name; | 38 pref_data->key = name; |
| 39 pref_object->type = api::settings_private::PrefType::PREF_TYPE_LIST; | 39 pref_data->type = api::settings_private::PrefType::PREF_TYPE_LIST; |
| 40 | 40 |
| 41 base::ListValue* value = new base::ListValue(); | 41 base::ListValue* value = new base::ListValue(); |
| 42 for (auto& email : whitelisted_users_) { | 42 for (auto& email : whitelisted_users_) { |
| 43 value->AppendString(email); | 43 value->AppendString(email); |
| 44 } | 44 } |
| 45 pref_object->value.reset(value); | 45 pref_data->value.reset(value); |
| 46 | 46 |
| 47 return pref_object.Pass(); | 47 return pref_data.Pass(); |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool AppendToListCrosSetting(const std::string& pref_name, | 50 bool AppendToListCrosSetting(const std::string& pref_name, |
| 51 const base::Value& value) override { | 51 const base::Value& value) override { |
| 52 std::string email; | 52 std::string email; |
| 53 value.GetAsString(&email); | 53 value.GetAsString(&email); |
| 54 | 54 |
| 55 for (auto& user : whitelisted_users_) { | 55 for (auto& user : whitelisted_users_) { |
| 56 if (email == user) | 56 if (email == user) |
| 57 return false; | 57 return false; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 IN_PROC_BROWSER_TEST_F(UsersPrivateApiTest, AddAndRemoveUsers) { | 156 IN_PROC_BROWSER_TEST_F(UsersPrivateApiTest, AddAndRemoveUsers) { |
| 157 EXPECT_TRUE(RunSubtest("addAndRemoveUsers")) << message_; | 157 EXPECT_TRUE(RunSubtest("addAndRemoveUsers")) << message_; |
| 158 } | 158 } |
| 159 | 159 |
| 160 IN_PROC_BROWSER_TEST_F(UsersPrivateApiTest, IsOwner) { | 160 IN_PROC_BROWSER_TEST_F(UsersPrivateApiTest, IsOwner) { |
| 161 EXPECT_TRUE(RunSubtest("isOwner")) << message_; | 161 EXPECT_TRUE(RunSubtest("isOwner")) << message_; |
| 162 } | 162 } |
| 163 #endif | 163 #endif |
| 164 | 164 |
| 165 } // namespace extensions | 165 } // namespace extensions |
| OLD | NEW |