Commit a647c750 authored by Wez's avatar Wez Committed by Commit Bot

Update ChromeOS tests to use QuitClosure to terminate RunLoops.

These tests previously relied upon QuitCurrent*Deprecated() to terminate
RunLoops when the expected conditions arose.

Bug: 844016
Change-Id: I290599b94936b2ef253925f6f58b67d017b4603b
Reviewed-on: https://chromium-review.googlesource.com/1107242Reviewed-by: default avatarAlexander Alekseev <alemate@chromium.org>
Reviewed-by: default avatarMaksim Ivanov <emaxx@chromium.org>
Commit-Queue: Wez <wez@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569563}
parent 35b56274
...@@ -128,25 +128,19 @@ class InputMethodEngineBrowserTest ...@@ -128,25 +128,19 @@ class InputMethodEngineBrowserTest
class KeyEventDoneCallback { class KeyEventDoneCallback {
public: public:
explicit KeyEventDoneCallback(bool expected_argument) explicit KeyEventDoneCallback(bool expected_argument)
: expected_argument_(expected_argument), : expected_argument_(expected_argument) {}
is_called_(false) {}
~KeyEventDoneCallback() {} ~KeyEventDoneCallback() {}
void Run(bool consumed) { void Run(bool consumed) {
if (consumed == expected_argument_) { if (consumed == expected_argument_)
base::RunLoop::QuitCurrentWhenIdleDeprecated(); run_loop_.Quit();
is_called_ = true;
}
} }
void WaitUntilCalled() { void WaitUntilCalled() { run_loop_.Run(); }
while (!is_called_)
content::RunMessageLoop();
}
private: private:
bool expected_argument_; bool expected_argument_;
bool is_called_; base::RunLoop run_loop_;
DISALLOW_COPY_AND_ASSIGN(KeyEventDoneCallback); DISALLOW_COPY_AND_ASSIGN(KeyEventDoneCallback);
}; };
......
...@@ -197,6 +197,7 @@ class CryptohomeAuthenticatorTest : public testing::Test { ...@@ -197,6 +197,7 @@ class CryptohomeAuthenticatorTest : public testing::Test {
user_manager_(new chromeos::FakeChromeUserManager()), user_manager_(new chromeos::FakeChromeUserManager()),
user_manager_enabler_(base::WrapUnique(user_manager_)), user_manager_enabler_(base::WrapUnique(user_manager_)),
mock_caller_(NULL), mock_caller_(NULL),
consumer_(run_loop_.QuitClosure()),
owner_key_util_(new ownership::MockOwnerKeyUtil()) { owner_key_util_(new ownership::MockOwnerKeyUtil()) {
// Testing profile must be initialized after user_manager_ + // Testing profile must be initialized after user_manager_ +
// user_manager_enabler_, because it will create another UserManager // user_manager_enabler_, because it will create another UserManager
...@@ -267,45 +268,48 @@ class CryptohomeAuthenticatorTest : public testing::Test { ...@@ -267,45 +268,48 @@ class CryptohomeAuthenticatorTest : public testing::Test {
// wasn't supposed to happen. // wasn't supposed to happen.
void FailOnLoginFailure() { void FailOnLoginFailure() {
ON_CALL(consumer_, OnAuthFailure(_)) ON_CALL(consumer_, OnAuthFailure(_))
.WillByDefault(Invoke(MockAuthStatusConsumer::OnFailQuitAndFail)); .WillByDefault(
Invoke(&consumer_, &MockAuthStatusConsumer::OnFailQuitAndFail));
} }
// Allow test to fail and exit gracefully, even if OnAuthSuccess() // Allow test to fail and exit gracefully, even if OnAuthSuccess()
// wasn't supposed to happen. // wasn't supposed to happen.
void FailOnLoginSuccess() { void FailOnLoginSuccess() {
ON_CALL(consumer_, OnAuthSuccess(_)) ON_CALL(consumer_, OnAuthSuccess(_))
.WillByDefault(Invoke(MockAuthStatusConsumer::OnSuccessQuitAndFail)); .WillByDefault(
Invoke(&consumer_, &MockAuthStatusConsumer::OnSuccessQuitAndFail));
} }
// Allow test to fail and exit gracefully, even if // Allow test to fail and exit gracefully, even if
// OnOffTheRecordAuthSuccess() wasn't supposed to happen. // OnOffTheRecordAuthSuccess() wasn't supposed to happen.
void FailOnGuestLoginSuccess() { void FailOnGuestLoginSuccess() {
ON_CALL(consumer_, OnOffTheRecordAuthSuccess()) ON_CALL(consumer_, OnOffTheRecordAuthSuccess())
.WillByDefault( .WillByDefault(Invoke(
Invoke(MockAuthStatusConsumer::OnGuestSuccessQuitAndFail)); &consumer_, &MockAuthStatusConsumer::OnGuestSuccessQuitAndFail));
} }
void ExpectLoginFailure(const AuthFailure& failure) { void ExpectLoginFailure(const AuthFailure& failure) {
EXPECT_CALL(consumer_, OnAuthFailure(failure)) EXPECT_CALL(consumer_, OnAuthFailure(failure))
.WillOnce(Invoke(MockAuthStatusConsumer::OnFailQuit)) .WillOnce(Invoke(&consumer_, &MockAuthStatusConsumer::OnFailQuit))
.RetiresOnSaturation(); .RetiresOnSaturation();
} }
void ExpectLoginSuccess(const UserContext& user_context) { void ExpectLoginSuccess(const UserContext& user_context) {
EXPECT_CALL(consumer_, OnAuthSuccess(user_context)) EXPECT_CALL(consumer_, OnAuthSuccess(user_context))
.WillOnce(Invoke(MockAuthStatusConsumer::OnSuccessQuit)) .WillOnce(Invoke(&consumer_, &MockAuthStatusConsumer::OnSuccessQuit))
.RetiresOnSaturation(); .RetiresOnSaturation();
} }
void ExpectGuestLoginSuccess() { void ExpectGuestLoginSuccess() {
EXPECT_CALL(consumer_, OnOffTheRecordAuthSuccess()) EXPECT_CALL(consumer_, OnOffTheRecordAuthSuccess())
.WillOnce(Invoke(MockAuthStatusConsumer::OnGuestSuccessQuit)) .WillOnce(
Invoke(&consumer_, &MockAuthStatusConsumer::OnGuestSuccessQuit))
.RetiresOnSaturation(); .RetiresOnSaturation();
} }
void ExpectPasswordChange() { void ExpectPasswordChange() {
EXPECT_CALL(consumer_, OnPasswordChangeDetected()) EXPECT_CALL(consumer_, OnPasswordChangeDetected())
.WillOnce(Invoke(MockAuthStatusConsumer::OnMigrateQuit)) .WillOnce(Invoke(&consumer_, &MockAuthStatusConsumer::OnMigrateQuit))
.RetiresOnSaturation(); .RetiresOnSaturation();
} }
...@@ -390,6 +394,7 @@ class CryptohomeAuthenticatorTest : public testing::Test { ...@@ -390,6 +394,7 @@ class CryptohomeAuthenticatorTest : public testing::Test {
cryptohome::MockAsyncMethodCaller* mock_caller_; cryptohome::MockAsyncMethodCaller* mock_caller_;
base::RunLoop run_loop_;
MockAuthStatusConsumer consumer_; MockAuthStatusConsumer consumer_;
scoped_refptr<CryptohomeAuthenticator> auth_; scoped_refptr<CryptohomeAuthenticator> auth_;
...@@ -586,7 +591,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveGuestLogin) { ...@@ -586,7 +591,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveGuestLogin) {
EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)).Times(1).RetiresOnSaturation(); EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)).Times(1).RetiresOnSaturation();
auth_->LoginOffTheRecord(); auth_->LoginOffTheRecord();
base::RunLoop().Run(); run_loop_.Run();
} }
TEST_F(CryptohomeAuthenticatorTest, DriveGuestLoginButFail) { TEST_F(CryptohomeAuthenticatorTest, DriveGuestLoginButFail) {
...@@ -599,7 +604,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveGuestLoginButFail) { ...@@ -599,7 +604,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveGuestLoginButFail) {
EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)).Times(1).RetiresOnSaturation(); EXPECT_CALL(*mock_caller_, AsyncMountGuest(_)).Times(1).RetiresOnSaturation();
auth_->LoginOffTheRecord(); auth_->LoginOffTheRecord();
base::RunLoop().Run(); run_loop_.Run();
} }
TEST_F(CryptohomeAuthenticatorTest, DriveDataResync) { TEST_F(CryptohomeAuthenticatorTest, DriveDataResync) {
...@@ -628,7 +633,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveDataResync) { ...@@ -628,7 +633,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveDataResync) {
SetAttemptState(auth_.get(), state_.release()); SetAttemptState(auth_.get(), state_.release());
auth_->ResyncEncryptedData(); auth_->ResyncEncryptedData();
base::RunLoop().Run(); run_loop_.Run();
} }
TEST_F(CryptohomeAuthenticatorTest, DriveResyncFail) { TEST_F(CryptohomeAuthenticatorTest, DriveResyncFail) {
...@@ -646,7 +651,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveResyncFail) { ...@@ -646,7 +651,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveResyncFail) {
SetAttemptState(auth_.get(), state_.release()); SetAttemptState(auth_.get(), state_.release());
auth_->ResyncEncryptedData(); auth_->ResyncEncryptedData();
base::RunLoop().Run(); run_loop_.Run();
} }
TEST_F(CryptohomeAuthenticatorTest, DriveRequestOldPassword) { TEST_F(CryptohomeAuthenticatorTest, DriveRequestOldPassword) {
...@@ -686,7 +691,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveDataRecover) { ...@@ -686,7 +691,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveDataRecover) {
SetAttemptState(auth_.get(), state_.release()); SetAttemptState(auth_.get(), state_.release());
auth_->RecoverEncryptedData(std::string()); auth_->RecoverEncryptedData(std::string());
base::RunLoop().Run(); run_loop_.Run();
} }
TEST_F(CryptohomeAuthenticatorTest, DriveDataRecoverButFail) { TEST_F(CryptohomeAuthenticatorTest, DriveDataRecoverButFail) {
...@@ -706,7 +711,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveDataRecoverButFail) { ...@@ -706,7 +711,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveDataRecoverButFail) {
SetAttemptState(auth_.get(), state_.release()); SetAttemptState(auth_.get(), state_.release());
auth_->RecoverEncryptedData(std::string()); auth_->RecoverEncryptedData(std::string());
base::RunLoop().Run(); run_loop_.Run();
} }
TEST_F(CryptohomeAuthenticatorTest, ResolveOfflineNoMount) { TEST_F(CryptohomeAuthenticatorTest, ResolveOfflineNoMount) {
...@@ -791,7 +796,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveUnlock) { ...@@ -791,7 +796,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveUnlock) {
ExpectCheckKeyExCall(); ExpectCheckKeyExCall();
auth_->AuthenticateToUnlock(user_context_); auth_->AuthenticateToUnlock(user_context_);
base::RunLoop().Run(); run_loop_.Run();
} }
TEST_F(CryptohomeAuthenticatorTest, DriveLoginWithPreHashedPassword) { TEST_F(CryptohomeAuthenticatorTest, DriveLoginWithPreHashedPassword) {
...@@ -812,7 +817,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveLoginWithPreHashedPassword) { ...@@ -812,7 +817,7 @@ TEST_F(CryptohomeAuthenticatorTest, DriveLoginWithPreHashedPassword) {
ExpectMountExCall(false /* expect_create_attempt */); ExpectMountExCall(false /* expect_create_attempt */);
auth_->AuthenticateToLogin(NULL, user_context_); auth_->AuthenticateToLogin(NULL, user_context_);
base::RunLoop().Run(); run_loop_.Run();
} }
TEST_F(CryptohomeAuthenticatorTest, FailLoginWithMissingSalt) { TEST_F(CryptohomeAuthenticatorTest, FailLoginWithMissingSalt) {
...@@ -828,7 +833,7 @@ TEST_F(CryptohomeAuthenticatorTest, FailLoginWithMissingSalt) { ...@@ -828,7 +833,7 @@ TEST_F(CryptohomeAuthenticatorTest, FailLoginWithMissingSalt) {
std::unique_ptr<std::string>()); std::unique_ptr<std::string>());
auth_->AuthenticateToLogin(NULL, user_context_); auth_->AuthenticateToLogin(NULL, user_context_);
base::RunLoop().Run(); run_loop_.Run();
} }
} // namespace chromeos } // namespace chromeos
...@@ -47,7 +47,7 @@ namespace { ...@@ -47,7 +47,7 @@ namespace {
// An object that wait for lock state and fullscreen state. // An object that wait for lock state and fullscreen state.
class Waiter : public content::NotificationObserver { class Waiter : public content::NotificationObserver {
public: public:
explicit Waiter(Browser* browser) : browser_(browser), running_(false) { explicit Waiter(Browser* browser) : browser_(browser) {
registrar_.Add(this, chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED, registrar_.Add(this, chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED,
content::NotificationService::AllSources()); content::NotificationService::AllSources());
registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED, registrar_.Add(this, chrome::NOTIFICATION_FULLSCREEN_CHANGED,
...@@ -61,30 +61,29 @@ class Waiter : public content::NotificationObserver { ...@@ -61,30 +61,29 @@ class Waiter : public content::NotificationObserver {
const content::NotificationDetails& details) override { const content::NotificationDetails& details) override {
DCHECK(type == chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED || DCHECK(type == chrome::NOTIFICATION_SCREEN_LOCK_STATE_CHANGED ||
type == chrome::NOTIFICATION_FULLSCREEN_CHANGED); type == chrome::NOTIFICATION_FULLSCREEN_CHANGED);
if (running_) if (quit_loop_)
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_loop_).Run();
} }
// Wait until the two conditions are met. // Wait until the two conditions are met.
void Wait(bool locker_state, bool fullscreen) { void Wait(bool locker_state, bool fullscreen) {
running_ = true;
std::unique_ptr<chromeos::test::ScreenLockerTester> tester( std::unique_ptr<chromeos::test::ScreenLockerTester> tester(
chromeos::ScreenLocker::GetTester()); chromeos::ScreenLocker::GetTester());
while (tester->IsLocked() != locker_state || while (tester->IsLocked() != locker_state ||
browser_->window()->IsFullscreen() != fullscreen) { browser_->window()->IsFullscreen() != fullscreen) {
content::RunMessageLoop(); base::RunLoop run_loop;
quit_loop_ = run_loop.QuitClosure();
run_loop.Run();
} }
// Make sure all pending tasks are executed. // Make sure all pending tasks are executed.
content::RunAllPendingInMessageLoop(); content::RunAllPendingInMessageLoop();
running_ = false;
} }
private: private:
Browser* browser_; Browser* browser_;
content::NotificationRegistrar registrar_; content::NotificationRegistrar registrar_;
// Are we currently running the message loop? base::OnceClosure quit_loop_;
bool running_;
DISALLOW_COPY_AND_ASSIGN(Waiter); DISALLOW_COPY_AND_ASSIGN(Waiter);
}; };
......
...@@ -2090,7 +2090,8 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, TermsOfServiceWithLocaleSwitch) { ...@@ -2090,7 +2090,8 @@ IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, TermsOfServiceWithLocaleSwitch) {
// Set up an observer that will quit the message loop when login has succeeded // Set up an observer that will quit the message loop when login has succeeded
// and the first wizard screen, if any, is being shown. // and the first wizard screen, if any, is being shown.
base::RunLoop login_wait_run_loop; base::RunLoop login_wait_run_loop;
chromeos::MockAuthStatusConsumer login_status_consumer; chromeos::MockAuthStatusConsumer login_status_consumer(
login_wait_run_loop.QuitClosure());
EXPECT_CALL(login_status_consumer, OnAuthSuccess(_)).Times(1).WillOnce( EXPECT_CALL(login_status_consumer, OnAuthSuccess(_)).Times(1).WillOnce(
InvokeWithoutArgs(&login_wait_run_loop, &base::RunLoop::Quit)); InvokeWithoutArgs(&login_wait_run_loop, &base::RunLoop::Quit));
chromeos::ExistingUserController* controller = chromeos::ExistingUserController* controller =
...@@ -2308,7 +2309,8 @@ IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) { ...@@ -2308,7 +2309,8 @@ IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) {
// Set up an observer that will quit the message loop when login has succeeded // Set up an observer that will quit the message loop when login has succeeded
// and the first wizard screen, if any, is being shown. // and the first wizard screen, if any, is being shown.
base::RunLoop login_wait_run_loop; base::RunLoop login_wait_run_loop;
chromeos::MockAuthStatusConsumer login_status_consumer; chromeos::MockAuthStatusConsumer login_status_consumer(
login_wait_run_loop.QuitClosure());
EXPECT_CALL(login_status_consumer, OnAuthSuccess(_)).Times(1).WillOnce( EXPECT_CALL(login_status_consumer, OnAuthSuccess(_)).Times(1).WillOnce(
InvokeWithoutArgs(&login_wait_run_loop, &base::RunLoop::Quit)); InvokeWithoutArgs(&login_wait_run_loop, &base::RunLoop::Quit));
......
...@@ -10,66 +10,57 @@ ...@@ -10,66 +10,57 @@
namespace chromeos { namespace chromeos {
MockAuthStatusConsumer::MockAuthStatusConsumer() = default; MockAuthStatusConsumer::MockAuthStatusConsumer(base::OnceClosure quit_closure)
: quit_closure_(std::move(quit_closure)) {}
MockAuthStatusConsumer::~MockAuthStatusConsumer() = default; MockAuthStatusConsumer::~MockAuthStatusConsumer() = default;
// static
void MockAuthStatusConsumer::OnRetailModeSuccessQuit( void MockAuthStatusConsumer::OnRetailModeSuccessQuit(
const UserContext& user_context) { const UserContext& user_context) {
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnRetailModeSuccessQuitAndFail( void MockAuthStatusConsumer::OnRetailModeSuccessQuitAndFail(
const UserContext& user_context) { const UserContext& user_context) {
ADD_FAILURE() << "Retail mode login should have failed!"; ADD_FAILURE() << "Retail mode login should have failed!";
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnGuestSuccessQuit() { void MockAuthStatusConsumer::OnGuestSuccessQuit() {
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnGuestSuccessQuitAndFail() { void MockAuthStatusConsumer::OnGuestSuccessQuitAndFail() {
ADD_FAILURE() << "Guest login should have failed!"; ADD_FAILURE() << "Guest login should have failed!";
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnSuccessQuit(const UserContext& user_context) { void MockAuthStatusConsumer::OnSuccessQuit(const UserContext& user_context) {
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnSuccessQuitAndFail( void MockAuthStatusConsumer::OnSuccessQuitAndFail(
const UserContext& user_context) { const UserContext& user_context) {
ADD_FAILURE() << "Login should NOT have succeeded!"; ADD_FAILURE() << "Login should NOT have succeeded!";
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnFailQuit(const AuthFailure& error) { void MockAuthStatusConsumer::OnFailQuit(const AuthFailure& error) {
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnFailQuitAndFail(const AuthFailure& error) { void MockAuthStatusConsumer::OnFailQuitAndFail(const AuthFailure& error) {
ADD_FAILURE() << "Login should not have failed!"; ADD_FAILURE() << "Login should not have failed!";
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnMigrateQuit() { void MockAuthStatusConsumer::OnMigrateQuit() {
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
// static
void MockAuthStatusConsumer::OnMigrateQuitAndFail() { void MockAuthStatusConsumer::OnMigrateQuitAndFail() {
ADD_FAILURE() << "Should not have detected a PW change!"; ADD_FAILURE() << "Should not have detected a PW change!";
base::RunLoop::QuitCurrentWhenIdleDeprecated(); std::move(quit_closure_).Run();
} }
} // namespace chromeos } // namespace chromeos
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#ifndef CHROMEOS_LOGIN_AUTH_MOCK_AUTH_STATUS_CONSUMER_H_ #ifndef CHROMEOS_LOGIN_AUTH_MOCK_AUTH_STATUS_CONSUMER_H_
#define CHROMEOS_LOGIN_AUTH_MOCK_AUTH_STATUS_CONSUMER_H_ #define CHROMEOS_LOGIN_AUTH_MOCK_AUTH_STATUS_CONSUMER_H_
#include "base/callback.h"
#include "chromeos/chromeos_export.h" #include "chromeos/chromeos_export.h"
#include "chromeos/login/auth/auth_status_consumer.h" #include "chromeos/login/auth/auth_status_consumer.h"
#include "chromeos/login/auth/user_context.h" #include "chromeos/login/auth/user_context.h"
...@@ -14,7 +15,7 @@ namespace chromeos { ...@@ -14,7 +15,7 @@ namespace chromeos {
class CHROMEOS_EXPORT MockAuthStatusConsumer : public AuthStatusConsumer { class CHROMEOS_EXPORT MockAuthStatusConsumer : public AuthStatusConsumer {
public: public:
MockAuthStatusConsumer(); explicit MockAuthStatusConsumer(base::OnceClosure quit_closure);
virtual ~MockAuthStatusConsumer(); virtual ~MockAuthStatusConsumer();
MOCK_METHOD1(OnAuthFailure, void(const AuthFailure& error)); MOCK_METHOD1(OnAuthFailure, void(const AuthFailure& error));
...@@ -26,24 +27,27 @@ class CHROMEOS_EXPORT MockAuthStatusConsumer : public AuthStatusConsumer { ...@@ -26,24 +27,27 @@ class CHROMEOS_EXPORT MockAuthStatusConsumer : public AuthStatusConsumer {
// The following functions can be used in gmock Invoke() clauses. // The following functions can be used in gmock Invoke() clauses.
// Compatible with AuthStatusConsumer::OnRetailModeAuthSuccess() // Compatible with AuthStatusConsumer::OnRetailModeAuthSuccess()
static void OnRetailModeSuccessQuit(const UserContext& user_context); void OnRetailModeSuccessQuit(const UserContext& user_context);
static void OnRetailModeSuccessQuitAndFail(const UserContext& user_context); void OnRetailModeSuccessQuitAndFail(const UserContext& user_context);
// Compatible with AuthStatusConsumer::OnOffTheRecordAuthSuccess() // Compatible with AuthStatusConsumer::OnOffTheRecordAuthSuccess()
static void OnGuestSuccessQuit(); void OnGuestSuccessQuit();
static void OnGuestSuccessQuitAndFail(); void OnGuestSuccessQuitAndFail();
// Compatible with AuthStatusConsumer::OnAuthSuccess() // Compatible with AuthStatusConsumer::OnAuthSuccess()
static void OnSuccessQuit(const UserContext& user_context); void OnSuccessQuit(const UserContext& user_context);
static void OnSuccessQuitAndFail(const UserContext& user_context); void OnSuccessQuitAndFail(const UserContext& user_context);
// Compatible with AuthStatusConsumer::OnAuthFailure() // Compatible with AuthStatusConsumer::OnAuthFailure()
static void OnFailQuit(const AuthFailure& error); void OnFailQuit(const AuthFailure& error);
static void OnFailQuitAndFail(const AuthFailure& error); void OnFailQuitAndFail(const AuthFailure& error);
// Compatible with AuthStatusConsumer::OnPasswordChangeDetected() // Compatible with AuthStatusConsumer::OnPasswordChangeDetected()
static void OnMigrateQuit(); void OnMigrateQuit();
static void OnMigrateQuitAndFail(); void OnMigrateQuitAndFail();
private:
base::OnceClosure quit_closure_;
}; };
} // namespace chromeos } // namespace chromeos
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment