Index: chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc |
diff --git a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc |
index 660055c2066d2d3e676826712d55846182c3ef94..ff8da1826f1ac305e2e86926e808ba1c6007746f 100644 |
--- a/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc |
+++ b/chrome/browser/chromeos/login/users/chrome_user_manager_impl.cc |
@@ -178,7 +178,9 @@ ChromeUserManagerImpl::CreateChromeUserManager() { |
} |
ChromeUserManagerImpl::ChromeUserManagerImpl() |
- : ChromeUserManager(base::ThreadTaskRunnerHandle::Get()), |
+ : ChromeUserManager(base::ThreadTaskRunnerHandle::IsSet() |
+ ? base::ThreadTaskRunnerHandle::Get() |
+ : scoped_refptr<base::TaskRunner>()), |
cros_settings_(CrosSettings::Get()), |
device_local_account_policy_service_(NULL), |
supervised_user_manager_(new SupervisedUserManagerImpl(this)), |
@@ -187,7 +189,10 @@ ChromeUserManagerImpl::ChromeUserManagerImpl() |
UpdateNumberOfUsers(); |
// UserManager instance should be used only on UI thread. |
- DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ // (or in unit tests) |
+ if (base::ThreadTaskRunnerHandle::IsSet()) |
+ DCHECK_CURRENTLY_ON(BrowserThread::UI); |
+ |
registrar_.Add(this, |
chrome::NOTIFICATION_OWNERSHIP_STATUS_CHANGED, |
content::NotificationService::AllSources()); |