Home | History | Annotate | Download | only in login
      1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/chromeos/login/test_login_utils.h"
      6 
      7 #include "base/callback.h"
      8 #include "base/logging.h"
      9 #include "chromeos/login/auth/mock_authenticator.h"
     10 #include "chromeos/login/auth/user_context.h"
     11 
     12 namespace chromeos {
     13 
     14 TestLoginUtils::TestLoginUtils(const UserContext& user_context)
     15     : expected_user_context_(user_context) {
     16 }
     17 
     18 TestLoginUtils::~TestLoginUtils() {}
     19 
     20 void TestLoginUtils::RespectLocalePreference(Profile* profile,
     21                                              const base::Closure& callback) {
     22   callback.Run();
     23 }
     24 
     25 void TestLoginUtils::PrepareProfile(
     26     const UserContext& user_context,
     27     bool has_auth_cookies,
     28     bool has_active_session,
     29     Delegate* delegate) {
     30   if (user_context != expected_user_context_)
     31     NOTREACHED();
     32   // Profile hasn't been loaded.
     33   delegate->OnProfilePrepared(NULL);
     34 }
     35 
     36 void TestLoginUtils::DelegateDeleted(Delegate* delegate) {
     37 }
     38 
     39 scoped_refptr<Authenticator> TestLoginUtils::CreateAuthenticator(
     40     AuthStatusConsumer* consumer) {
     41   return new MockAuthenticator(consumer, expected_user_context_);
     42 }
     43 
     44 bool TestLoginUtils::RestartToApplyPerSessionFlagsIfNeed(Profile* profile,
     45                                                          bool early_restart) {
     46   return false;
     47 }
     48 
     49 }  // namespace chromeos
     50