| Index: chromeos/login/auth/online_attempt_unittest.cc
|
| diff --git a/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc b/chromeos/login/auth/online_attempt_unittest.cc
|
| similarity index 80%
|
| rename from chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
|
| rename to chromeos/login/auth/online_attempt_unittest.cc
|
| index bb5502eb459d30a639ff06ad77afe2a92c6999b7..12585056175e1be9174ced5d7a5c8c3e26d4ced7 100644
|
| --- a/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
|
| +++ b/chromeos/login/auth/online_attempt_unittest.cc
|
| @@ -7,11 +7,11 @@
|
| #include "base/bind.h"
|
| #include "base/memory/ref_counted.h"
|
| #include "base/run_loop.h"
|
| -#include "chrome/browser/chromeos/login/auth/mock_url_fetchers.h"
|
| -#include "chrome/browser/chromeos/login/auth/online_attempt.h"
|
| #include "chrome/test/base/testing_profile.h"
|
| #include "chromeos/login/auth/auth_attempt_state.h"
|
| #include "chromeos/login/auth/mock_auth_attempt_state_resolver.h"
|
| +#include "chromeos/login/auth/mock_url_fetchers.h"
|
| +#include "chromeos/login/auth/online_attempt.h"
|
| #include "chromeos/login/auth/test_attempt_state.h"
|
| #include "chromeos/login/auth/user_context.h"
|
| #include "content/public/browser/browser_thread.h"
|
| @@ -34,29 +34,26 @@ class OnlineAttemptTest : public testing::Test {
|
| public:
|
| OnlineAttemptTest()
|
| : state_(UserContext(), false),
|
| - attempt_(new OnlineAttempt(&state_, &resolver_)) {
|
| - }
|
| + attempt_(new OnlineAttempt(&state_, &resolver_)) {}
|
|
|
| void RunFailureTest(const GoogleServiceAuthError& error) {
|
| - EXPECT_CALL(resolver_, Resolve())
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| -
|
| - BrowserThread::PostTask(
|
| - BrowserThread::UI, FROM_HERE,
|
| - base::Bind(&OnlineAttempt::OnClientLoginFailure,
|
| - attempt_->weak_factory_.GetWeakPtr(),
|
| - error));
|
| + EXPECT_CALL(resolver_, Resolve()).Times(1).RetiresOnSaturation();
|
| +
|
| + BrowserThread::PostTask(BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(&OnlineAttempt::OnClientLoginFailure,
|
| + attempt_->weak_factory_.GetWeakPtr(),
|
| + error));
|
| // Force UI thread to finish tasks so I can verify |state_|.
|
| base::RunLoop().RunUntilIdle();
|
| EXPECT_TRUE(error == state_.online_outcome().error());
|
| }
|
|
|
| void CancelLogin(OnlineAttempt* auth) {
|
| - BrowserThread::PostTask(
|
| - BrowserThread::UI, FROM_HERE,
|
| - base::Bind(&OnlineAttempt::CancelClientLogin,
|
| - auth->weak_factory_.GetWeakPtr()));
|
| + BrowserThread::PostTask(BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(&OnlineAttempt::CancelClientLogin,
|
| + auth->weak_factory_.GetWeakPtr()));
|
| }
|
|
|
| content::TestBrowserThreadBundle thread_bundle_;
|
| @@ -66,15 +63,13 @@ class OnlineAttemptTest : public testing::Test {
|
| };
|
|
|
| TEST_F(OnlineAttemptTest, LoginSuccess) {
|
| - EXPECT_CALL(resolver_, Resolve())
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| + EXPECT_CALL(resolver_, Resolve()).Times(1).RetiresOnSaturation();
|
|
|
| - BrowserThread::PostTask(
|
| - BrowserThread::UI, FROM_HERE,
|
| - base::Bind(&OnlineAttempt::OnClientLoginSuccess,
|
| - attempt_->weak_factory_.GetWeakPtr(),
|
| - GaiaAuthConsumer::ClientLoginResult()));
|
| + BrowserThread::PostTask(BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(&OnlineAttempt::OnClientLoginSuccess,
|
| + attempt_->weak_factory_.GetWeakPtr(),
|
| + GaiaAuthConsumer::ClientLoginResult()));
|
| // Force UI thread to finish tasks so I can verify |state_|.
|
| base::RunLoop().RunUntilIdle();
|
| }
|
| @@ -204,15 +199,13 @@ TEST_F(OnlineAttemptTest, CaptchaErrorOutputted) {
|
| }
|
|
|
| TEST_F(OnlineAttemptTest, TwoFactorSuccess) {
|
| - EXPECT_CALL(resolver_, Resolve())
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| + EXPECT_CALL(resolver_, Resolve()).Times(1).RetiresOnSaturation();
|
| GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR);
|
| - BrowserThread::PostTask(
|
| - BrowserThread::UI, FROM_HERE,
|
| - base::Bind(&OnlineAttempt::OnClientLoginFailure,
|
| - attempt_->weak_factory_.GetWeakPtr(),
|
| - error));
|
| + BrowserThread::PostTask(BrowserThread::UI,
|
| + FROM_HERE,
|
| + base::Bind(&OnlineAttempt::OnClientLoginFailure,
|
| + attempt_->weak_factory_.GetWeakPtr(),
|
| + error));
|
|
|
| // Force UI thread to finish tasks so I can verify |state_|.
|
| base::RunLoop().RunUntilIdle();
|
|
|