| 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 "components/user_manager/fake_user_manager.h" | 5 #include "components/user_manager/fake_user_manager.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/sys_info.h" | 9 #include "base/sys_info.h" |
| 10 #include "base/task_runner.h" | 10 #include "base/task_runner.h" |
| 11 #include "chromeos/chromeos_switches.h" | 11 #include "chromeos/chromeos_switches.h" |
| 12 #include "chromeos/login/user_names.h" | 12 #include "components/user_manager/user_names.h" |
| 13 #include "components/user_manager/user_type.h" | 13 #include "components/user_manager/user_type.h" |
| 14 | 14 |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class FakeTaskRunner : public base::TaskRunner { | 17 class FakeTaskRunner : public base::TaskRunner { |
| 18 public: | 18 public: |
| 19 bool PostDelayedTask(const tracked_objects::Location& from_here, | 19 bool PostDelayedTask(const tracked_objects::Location& from_here, |
| 20 const base::Closure& task, | 20 const base::Closure& task, |
| 21 base::TimeDelta delay) override { | 21 base::TimeDelta delay) override { |
| 22 task.Run(); | 22 task.Run(); |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 279 | 279 |
| 280 PrefService* FakeUserManager::GetLocalState() const { | 280 PrefService* FakeUserManager::GetLocalState() const { |
| 281 return nullptr; | 281 return nullptr; |
| 282 } | 282 } |
| 283 | 283 |
| 284 bool FakeUserManager::IsEnterpriseManaged() const { | 284 bool FakeUserManager::IsEnterpriseManaged() const { |
| 285 return false; | 285 return false; |
| 286 } | 286 } |
| 287 | 287 |
| 288 bool FakeUserManager::IsDemoApp(const AccountId& account_id) const { | 288 bool FakeUserManager::IsDemoApp(const AccountId& account_id) const { |
| 289 return account_id == chromeos::login::DemoAccountId(); | 289 return account_id == chromeos::DemoAccountId(); |
| 290 } | 290 } |
| 291 | 291 |
| 292 bool FakeUserManager::IsDeviceLocalAccountMarkedForRemoval( | 292 bool FakeUserManager::IsDeviceLocalAccountMarkedForRemoval( |
| 293 const AccountId& account_id) const { | 293 const AccountId& account_id) const { |
| 294 return false; | 294 return false; |
| 295 } | 295 } |
| 296 | 296 |
| 297 void FakeUserManager::UpdateLoginState(const user_manager::User* active_user, | 297 void FakeUserManager::UpdateLoginState(const user_manager::User* active_user, |
| 298 const user_manager::User* primary_user, | 298 const user_manager::User* primary_user, |
| 299 bool is_current_user_owner) const {} | 299 bool is_current_user_owner) const {} |
| 300 | 300 |
| 301 bool FakeUserManager::GetPlatformKnownUserId(const std::string& user_email, | 301 bool FakeUserManager::GetPlatformKnownUserId(const std::string& user_email, |
| 302 const std::string& gaia_id, | 302 const std::string& gaia_id, |
| 303 AccountId* out_account_id) const { | 303 AccountId* out_account_id) const { |
| 304 if (user_email == chromeos::login::kStubUser) { | 304 if (user_email == chromeos::kStubUser) { |
| 305 *out_account_id = chromeos::login::StubAccountId(); | 305 *out_account_id = chromeos::StubAccountId(); |
| 306 return true; | 306 return true; |
| 307 } | 307 } |
| 308 | 308 |
| 309 if (user_email == chromeos::login::kGuestUserName) { | 309 if (user_email == chromeos::kGuestUserName) { |
| 310 *out_account_id = chromeos::login::GuestAccountId(); | 310 *out_account_id = chromeos::GuestAccountId(); |
| 311 return true; | 311 return true; |
| 312 } | 312 } |
| 313 return false; | 313 return false; |
| 314 } | 314 } |
| 315 | 315 |
| 316 const AccountId& FakeUserManager::GetGuestAccountId() const { | 316 const AccountId& FakeUserManager::GetGuestAccountId() const { |
| 317 return chromeos::login::GuestAccountId(); | 317 return chromeos::GuestAccountId(); |
| 318 } | 318 } |
| 319 | 319 |
| 320 bool FakeUserManager::IsFirstExecAfterBoot() const { | 320 bool FakeUserManager::IsFirstExecAfterBoot() const { |
| 321 return base::CommandLine::ForCurrentProcess()->HasSwitch( | 321 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 322 chromeos::switches::kFirstExecAfterBoot); | 322 ::chromeos::switches::kFirstExecAfterBoot); |
| 323 } | 323 } |
| 324 | 324 |
| 325 void FakeUserManager::AsyncRemoveCryptohome(const AccountId& account_id) const { | 325 void FakeUserManager::AsyncRemoveCryptohome(const AccountId& account_id) const { |
| 326 NOTIMPLEMENTED(); | 326 NOTIMPLEMENTED(); |
| 327 } | 327 } |
| 328 | 328 |
| 329 bool FakeUserManager::IsGuestAccountId(const AccountId& account_id) const { | 329 bool FakeUserManager::IsGuestAccountId(const AccountId& account_id) const { |
| 330 return account_id == chromeos::login::GuestAccountId(); | 330 return account_id == chromeos::GuestAccountId(); |
| 331 } | 331 } |
| 332 | 332 |
| 333 bool FakeUserManager::IsStubAccountId(const AccountId& account_id) const { | 333 bool FakeUserManager::IsStubAccountId(const AccountId& account_id) const { |
| 334 return account_id == chromeos::login::StubAccountId(); | 334 return account_id == chromeos::StubAccountId(); |
| 335 } | 335 } |
| 336 | 336 |
| 337 bool FakeUserManager::IsSupervisedAccountId(const AccountId& account_id) const { | 337 bool FakeUserManager::IsSupervisedAccountId(const AccountId& account_id) const { |
| 338 return false; | 338 return false; |
| 339 } | 339 } |
| 340 | 340 |
| 341 bool FakeUserManager::HasBrowserRestarted() const { | 341 bool FakeUserManager::HasBrowserRestarted() const { |
| 342 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); | 342 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); |
| 343 return base::SysInfo::IsRunningOnChromeOS() && | 343 return base::SysInfo::IsRunningOnChromeOS() && |
| 344 command_line->HasSwitch(chromeos::switches::kLoginUser); | 344 command_line->HasSwitch(::chromeos::switches::kLoginUser); |
| 345 } | 345 } |
| 346 | 346 |
| 347 const gfx::ImageSkia& FakeUserManager::GetResourceImagekiaNamed(int id) const { | 347 const gfx::ImageSkia& FakeUserManager::GetResourceImagekiaNamed(int id) const { |
| 348 NOTIMPLEMENTED(); | 348 NOTIMPLEMENTED(); |
| 349 return empty_image_; | 349 return empty_image_; |
| 350 } | 350 } |
| 351 | 351 |
| 352 base::string16 FakeUserManager::GetResourceStringUTF16(int string_id) const { | 352 base::string16 FakeUserManager::GetResourceStringUTF16(int string_id) const { |
| 353 return base::string16(); | 353 return base::string16(); |
| 354 } | 354 } |
| 355 | 355 |
| 356 void FakeUserManager::ScheduleResolveLocale( | 356 void FakeUserManager::ScheduleResolveLocale( |
| 357 const std::string& locale, | 357 const std::string& locale, |
| 358 const base::Closure& on_resolved_callback, | 358 const base::Closure& on_resolved_callback, |
| 359 std::string* out_resolved_locale) const { | 359 std::string* out_resolved_locale) const { |
| 360 NOTIMPLEMENTED(); | 360 NOTIMPLEMENTED(); |
| 361 return; | 361 return; |
| 362 } | 362 } |
| 363 | 363 |
| 364 bool FakeUserManager::IsValidDefaultUserImageId(int image_index) const { | 364 bool FakeUserManager::IsValidDefaultUserImageId(int image_index) const { |
| 365 NOTIMPLEMENTED(); | 365 NOTIMPLEMENTED(); |
| 366 return false; | 366 return false; |
| 367 } | 367 } |
| 368 | 368 |
| 369 } // namespace user_manager | 369 } // namespace user_manager |
| OLD | NEW |