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