Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(402)

Unified Diff: chrome/browser/chromeos/login/mock_login_status_consumer.h

Issue 3442009: [Chrome OS] Attempt offline and online login simultaneously (Closed)
Patch Set: Fix crash on data recover Created 10 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/chromeos/login/mock_login_status_consumer.h
diff --git a/chrome/browser/chromeos/login/mock_login_status_consumer.h b/chrome/browser/chromeos/login/mock_login_status_consumer.h
index 28e3e852c35a02f4bee920f538b9417156164dc5..3f0317c7b618cd709fb45979e296dddb85a3722c 100644
--- a/chrome/browser/chromeos/login/mock_login_status_consumer.h
+++ b/chrome/browser/chromeos/login/mock_login_status_consumer.h
@@ -25,6 +25,56 @@ class MockConsumer : public LoginStatusConsumer {
MOCK_METHOD0(OnOffTheRecordLoginSuccess, void(void));
MOCK_METHOD1(OnPasswordChangeDetected,
void(const GaiaAuthConsumer::ClientLoginResult& result));
+
+ // The following functions can be used in gmock Invoke() clauses.
+
+ // Compatible with LoginStatusConsumer::OnOffTheRecordLoginSuccess()
+ static void OnGuestSuccessQuit() {
+ MessageLoop::current()->Quit();
+ }
+
+ static void OnGuestSuccessQuitAndFail() {
+ ADD_FAILURE() << "Guest Login should have failed!";
+ MessageLoop::current()->Quit();
+ }
+
+ // Compatible with LoginStatusConsumer::OnLoginSuccess()
+ static void OnSuccessQuit(
+ const std::string& username,
+ const GaiaAuthConsumer::ClientLoginResult& credentials,
+ bool pending_requests) {
+ MessageLoop::current()->Quit();
+ }
+
+ static void OnSuccessQuitAndFail(
+ const std::string& username,
+ const GaiaAuthConsumer::ClientLoginResult& credentials,
+ bool pending_requests) {
+ ADD_FAILURE() << "Login should NOT have succeeded!";
+ MessageLoop::current()->Quit();
+ }
+
+ // Compatible with LoginStatusConsumer::OnLoginFailure()
+ static void OnFailQuit(const LoginFailure& error) {
+ MessageLoop::current()->Quit();
+ }
+
+ static void OnFailQuitAndFail(const LoginFailure& error) {
+ ADD_FAILURE() << "Login should not have failed!";
+ MessageLoop::current()->Quit();
+ }
+
+ // Compatible with LoginStatusConsumer::OnPasswordChangeDetected()
+ static void OnMigrateQuit(
+ const GaiaAuthConsumer::ClientLoginResult& credentials) {
+ MessageLoop::current()->Quit();
+ }
+
+ static void OnMigrateQuitAndFail(
+ const GaiaAuthConsumer::ClientLoginResult& credentials) {
+ ADD_FAILURE() << "Should not have detected a PW change!";
+ MessageLoop::current()->Quit();
+ }
};
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698