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