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 "chromeos/login/auth/mock_auth_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 MockAuthStatusConsumer()13MockAuthStatusConsumer::MockAuthStatusConsumer() { 14 } 15 ~MockAuthStatusConsumer()16MockAuthStatusConsumer::~MockAuthStatusConsumer() { 17 } 18 19 // static OnRetailModeSuccessQuit(const UserContext & user_context)20void MockAuthStatusConsumer::OnRetailModeSuccessQuit( 21 const UserContext& user_context) { 22 base::MessageLoop::current()->Quit(); 23 } 24 25 // static OnRetailModeSuccessQuitAndFail(const UserContext & user_context)26void MockAuthStatusConsumer::OnRetailModeSuccessQuitAndFail( 27 const UserContext& user_context) { 28 ADD_FAILURE() << "Retail mode login should have failed!"; 29 base::MessageLoop::current()->Quit(); 30 } 31 32 // static OnGuestSuccessQuit()33void MockAuthStatusConsumer::OnGuestSuccessQuit() { 34 base::MessageLoop::current()->Quit(); 35 } 36 37 // static OnGuestSuccessQuitAndFail()38void MockAuthStatusConsumer::OnGuestSuccessQuitAndFail() { 39 ADD_FAILURE() << "Guest login should have failed!"; 40 base::MessageLoop::current()->Quit(); 41 } 42 43 // static OnSuccessQuit(const UserContext & user_context)44void MockAuthStatusConsumer::OnSuccessQuit(const UserContext& user_context) { 45 base::MessageLoop::current()->Quit(); 46 } 47 48 // static OnSuccessQuitAndFail(const UserContext & user_context)49void MockAuthStatusConsumer::OnSuccessQuitAndFail( 50 const UserContext& user_context) { 51 ADD_FAILURE() << "Login should NOT have succeeded!"; 52 base::MessageLoop::current()->Quit(); 53 } 54 55 // static OnFailQuit(const AuthFailure & error)56void MockAuthStatusConsumer::OnFailQuit(const AuthFailure& error) { 57 base::MessageLoop::current()->Quit(); 58 } 59 60 // static OnFailQuitAndFail(const AuthFailure & error)61void MockAuthStatusConsumer::OnFailQuitAndFail(const AuthFailure& error) { 62 ADD_FAILURE() << "Login should not have failed!"; 63 base::MessageLoop::current()->Quit(); 64 } 65 66 // static OnMigrateQuit()67void MockAuthStatusConsumer::OnMigrateQuit() { 68 base::MessageLoop::current()->Quit(); 69 } 70 71 // static OnMigrateQuitAndFail()72void MockAuthStatusConsumer::OnMigrateQuitAndFail() { 73 ADD_FAILURE() << "Should not have detected a PW change!"; 74 base::MessageLoop::current()->Quit(); 75 } 76 77 } // namespace chromeos 78