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 "chrome/browser/chromeos/login/users/fake_user_manager.h" | 5 #include "chrome/browser/chromeos/login/users/fake_user_manager.h" |
6 | 6 |
| 7 #include "base/task_runner.h" |
7 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h" | 8 #include "chrome/browser/chromeos/login/users/fake_supervised_user_manager.h" |
8 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
9 #include "chrome/grit/theme_resources.h" | 10 #include "chrome/grit/theme_resources.h" |
10 #include "components/user_manager/user_image/user_image.h" | 11 #include "components/user_manager/user_image/user_image.h" |
11 #include "components/user_manager/user_type.h" | 12 #include "components/user_manager/user_type.h" |
12 #include "ui/base/resource/resource_bundle.h" | 13 #include "ui/base/resource/resource_bundle.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // As defined in /chromeos/dbus/cryptohome_client.cc. | 17 // As defined in /chromeos/dbus/cryptohome_client.cc. |
17 static const char kUserIdHashSuffix[] = "-hash"; | 18 static const char kUserIdHashSuffix[] = "-hash"; |
18 | 19 |
| 20 class FakeTaskRunner : public base::TaskRunner { |
| 21 public: |
| 22 virtual bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 23 const base::Closure& task, |
| 24 base::TimeDelta delay) OVERRIDE { |
| 25 task.Run(); |
| 26 return true; |
| 27 } |
| 28 virtual bool RunsTasksOnCurrentThread() const OVERRIDE { return true; } |
| 29 |
| 30 protected: |
| 31 virtual ~FakeTaskRunner() {} |
| 32 }; |
| 33 |
19 } // namespace | 34 } // namespace |
20 | 35 |
21 namespace chromeos { | 36 namespace chromeos { |
22 | 37 |
23 FakeUserManager::FakeUserManager() | 38 FakeUserManager::FakeUserManager() |
24 : supervised_user_manager_(new FakeSupervisedUserManager), | 39 : ChromeUserManager(new FakeTaskRunner(), new FakeTaskRunner()), |
| 40 supervised_user_manager_(new FakeSupervisedUserManager), |
25 primary_user_(NULL), | 41 primary_user_(NULL), |
26 multi_profile_user_controller_(NULL) { | 42 multi_profile_user_controller_(NULL) { |
27 ProfileHelper::SetProfileToUserForTestingEnabled(true); | 43 ProfileHelper::SetProfileToUserForTestingEnabled(true); |
28 } | 44 } |
29 | 45 |
30 FakeUserManager::~FakeUserManager() { | 46 FakeUserManager::~FakeUserManager() { |
31 ProfileHelper::SetProfileToUserForTestingEnabled(false); | 47 ProfileHelper::SetProfileToUserForTestingEnabled(false); |
32 | 48 |
33 // Can't use STLDeleteElements because of the private destructor of User. | 49 // Can't use STLDeleteElements because of the private destructor of User. |
34 for (user_manager::UserList::iterator it = user_list_.begin(); | 50 for (user_manager::UserList::iterator it = user_list_.begin(); |
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 } | 313 } |
298 | 314 |
299 UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const { | 315 UserFlow* FakeUserManager::GetUserFlow(const std::string& email) const { |
300 return NULL; | 316 return NULL; |
301 } | 317 } |
302 | 318 |
303 bool FakeUserManager::AreSupervisedUsersAllowed() const { | 319 bool FakeUserManager::AreSupervisedUsersAllowed() const { |
304 return true; | 320 return true; |
305 } | 321 } |
306 | 322 |
| 323 bool FakeUserManager::AreEphemeralUsersEnabled() const { |
| 324 return false; |
| 325 } |
| 326 |
| 327 const std::string& FakeUserManager::GetApplicationLocale() const { |
| 328 static const std::string default_locale("en-US"); |
| 329 return default_locale; |
| 330 } |
| 331 |
| 332 PrefService* FakeUserManager::GetLocalState() const { |
| 333 return NULL; |
| 334 } |
| 335 |
| 336 bool FakeUserManager::IsEnterpriseManaged() const { |
| 337 return false; |
| 338 } |
| 339 |
| 340 bool FakeUserManager::IsDemoApp(const std::string& user_id) const { |
| 341 return false; |
| 342 } |
| 343 |
| 344 bool FakeUserManager::IsKioskApp(const std::string& user_id) const { |
| 345 return false; |
| 346 } |
| 347 |
| 348 bool FakeUserManager::IsPublicAccountMarkedForRemoval( |
| 349 const std::string& user_id) const { |
| 350 return false; |
| 351 } |
| 352 |
307 } // namespace chromeos | 353 } // namespace chromeos |
OLD | NEW |