Home | History | Annotate | Download | only in auth
      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
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/chromeos/login/auth/mock_login_status_consumer.h"
      6 
      7 #include "base/message_loop/message_loop.h"
      8 #include "google_apis/gaia/gaia_auth_consumer.h"
      9 #include "testing/gtest/include/gtest/gtest.h"
     10 
     11 namespace chromeos {
     12 
     13 MockConsumer::MockConsumer() {}
     14 
     15 MockConsumer::~MockConsumer() {}
     16 
     17 // static
     18 void MockConsumer::OnRetailModeSuccessQuit(const UserContext& user_context) {
     19   base::MessageLoop::current()->Quit();
     20 }
     21 
     22 // static
     23 void MockConsumer::OnRetailModeSuccessQuitAndFail(
     24     const UserContext& user_context) {
     25   ADD_FAILURE() << "Retail mode login should have failed!";
     26   base::MessageLoop::current()->Quit();
     27 }
     28 
     29 // static
     30 void MockConsumer::OnGuestSuccessQuit() {
     31   base::MessageLoop::current()->Quit();
     32 }
     33 
     34 // static
     35 void MockConsumer::OnGuestSuccessQuitAndFail() {
     36   ADD_FAILURE() << "Guest login should have failed!";
     37   base::MessageLoop::current()->Quit();
     38 }
     39 
     40 // static
     41 void MockConsumer::OnSuccessQuit(const UserContext& user_context) {
     42   base::MessageLoop::current()->Quit();
     43 }
     44 
     45 // static
     46 void MockConsumer::OnSuccessQuitAndFail(const UserContext& user_context) {
     47   ADD_FAILURE() << "Login should NOT have succeeded!";
     48   base::MessageLoop::current()->Quit();
     49 }
     50 
     51 // static
     52 void MockConsumer::OnFailQuit(const LoginFailure& error) {
     53   base::MessageLoop::current()->Quit();
     54 }
     55 
     56 // static
     57 void MockConsumer::OnFailQuitAndFail(const LoginFailure& error) {
     58   ADD_FAILURE() << "Login should not have failed!";
     59   base::MessageLoop::current()->Quit();
     60 }
     61 
     62 // static
     63 void MockConsumer::OnMigrateQuit() {
     64   base::MessageLoop::current()->Quit();
     65 }
     66 
     67 // static
     68 void MockConsumer::OnMigrateQuitAndFail() {
     69   ADD_FAILURE() << "Should not have detected a PW change!";
     70   base::MessageLoop::current()->Quit();
     71 }
     72 
     73 }  // namespace chromeos
     74