| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 "chrome/browser/chromeos/login/mock_login_status_consumer.h" | 5 #include "chrome/browser/chromeos/login/mock_login_status_consumer.h" |
| 6 | 6 |
| 7 #include "base/message_loop.h" | 7 #include "base/message_loop.h" |
| 8 #include "chrome/browser/chromeos/login/user.h" | 8 #include "chrome/browser/chromeos/login/user.h" |
| 9 #include "google_apis/gaia/gaia_auth_consumer.h" | 9 #include "google_apis/gaia/gaia_auth_consumer.h" |
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
| 11 | 11 |
| 12 namespace chromeos { | 12 namespace chromeos { |
| 13 | 13 |
| 14 MockConsumer::MockConsumer() {} | 14 MockConsumer::MockConsumer() {} |
| 15 | 15 |
| 16 MockConsumer::~MockConsumer() {} | 16 MockConsumer::~MockConsumer() {} |
| 17 | 17 |
| 18 // static | 18 // static |
| 19 void MockConsumer::OnRetailModeSuccessQuit(const UserContext& user_context) { | 19 void MockConsumer::OnRetailModeSuccessQuit(const UserContext& user_context) { |
| 20 MessageLoop::current()->Quit(); | 20 base::MessageLoop::current()->Quit(); |
| 21 } | 21 } |
| 22 | 22 |
| 23 // static | 23 // static |
| 24 void MockConsumer::OnRetailModeSuccessQuitAndFail( | 24 void MockConsumer::OnRetailModeSuccessQuitAndFail( |
| 25 const UserContext& user_context) { | 25 const UserContext& user_context) { |
| 26 ADD_FAILURE() << "Retail mode login should have failed!"; | 26 ADD_FAILURE() << "Retail mode login should have failed!"; |
| 27 MessageLoop::current()->Quit(); | 27 base::MessageLoop::current()->Quit(); |
| 28 } | 28 } |
| 29 | 29 |
| 30 // static | 30 // static |
| 31 void MockConsumer::OnGuestSuccessQuit() { | 31 void MockConsumer::OnGuestSuccessQuit() { |
| 32 MessageLoop::current()->Quit(); | 32 base::MessageLoop::current()->Quit(); |
| 33 } | 33 } |
| 34 | 34 |
| 35 // static | 35 // static |
| 36 void MockConsumer::OnGuestSuccessQuitAndFail() { | 36 void MockConsumer::OnGuestSuccessQuitAndFail() { |
| 37 ADD_FAILURE() << "Guest login should have failed!"; | 37 ADD_FAILURE() << "Guest login should have failed!"; |
| 38 MessageLoop::current()->Quit(); | 38 base::MessageLoop::current()->Quit(); |
| 39 } | 39 } |
| 40 | 40 |
| 41 // static | 41 // static |
| 42 void MockConsumer::OnSuccessQuit( | 42 void MockConsumer::OnSuccessQuit( |
| 43 const UserContext& user_context, | 43 const UserContext& user_context, |
| 44 bool pending_requests, | 44 bool pending_requests, |
| 45 bool using_oauth) { | 45 bool using_oauth) { |
| 46 MessageLoop::current()->Quit(); | 46 base::MessageLoop::current()->Quit(); |
| 47 } | 47 } |
| 48 | 48 |
| 49 // static | 49 // static |
| 50 void MockConsumer::OnSuccessQuitAndFail( | 50 void MockConsumer::OnSuccessQuitAndFail( |
| 51 const UserContext& user_context, | 51 const UserContext& user_context, |
| 52 bool pending_requests, | 52 bool pending_requests, |
| 53 bool using_oauth) { | 53 bool using_oauth) { |
| 54 ADD_FAILURE() << "Login should NOT have succeeded!"; | 54 ADD_FAILURE() << "Login should NOT have succeeded!"; |
| 55 MessageLoop::current()->Quit(); | 55 base::MessageLoop::current()->Quit(); |
| 56 } | 56 } |
| 57 | 57 |
| 58 // static | 58 // static |
| 59 void MockConsumer::OnFailQuit(const LoginFailure& error) { | 59 void MockConsumer::OnFailQuit(const LoginFailure& error) { |
| 60 MessageLoop::current()->Quit(); | 60 base::MessageLoop::current()->Quit(); |
| 61 } | 61 } |
| 62 | 62 |
| 63 // static | 63 // static |
| 64 void MockConsumer::OnFailQuitAndFail(const LoginFailure& error) { | 64 void MockConsumer::OnFailQuitAndFail(const LoginFailure& error) { |
| 65 ADD_FAILURE() << "Login should not have failed!"; | 65 ADD_FAILURE() << "Login should not have failed!"; |
| 66 MessageLoop::current()->Quit(); | 66 base::MessageLoop::current()->Quit(); |
| 67 } | 67 } |
| 68 | 68 |
| 69 // static | 69 // static |
| 70 void MockConsumer::OnMigrateQuit() { | 70 void MockConsumer::OnMigrateQuit() { |
| 71 MessageLoop::current()->Quit(); | 71 base::MessageLoop::current()->Quit(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 // static | 74 // static |
| 75 void MockConsumer::OnMigrateQuitAndFail() { | 75 void MockConsumer::OnMigrateQuitAndFail() { |
| 76 ADD_FAILURE() << "Should not have detected a PW change!"; | 76 ADD_FAILURE() << "Should not have detected a PW change!"; |
| 77 MessageLoop::current()->Quit(); | 77 base::MessageLoop::current()->Quit(); |
| 78 } | 78 } |
| 79 | 79 |
| 80 } // namespace chromeos | 80 } // namespace chromeos |
| OLD | NEW |