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

Unified Diff: chrome/browser/chromeos/login/auth/online_attempt_unittest.cc

Issue 1121233010: [chrome/browser/chromeos/login] Replace MessageLoopProxy usage with ThreadTaskRunnerHandle (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screens/user_image_screen.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
diff --git a/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc b/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
index 668394049eba88d8de9f399b1efc946914306e4e..3e51a245dfc2b85b68b3bd4be67e4ea75da00023 100644
--- a/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
+++ b/chrome/browser/chromeos/login/auth/online_attempt_unittest.cc
@@ -8,7 +8,9 @@
#include "base/location.h"
#include "base/memory/ref_counted.h"
#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
#include "base/test/null_task_runner.h"
+#include "base/thread_task_runner_handle.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"
@@ -63,30 +65,29 @@ class OnlineAttemptTest : public testing::Test {
attempt_(new OnlineAttempt(&state_, &resolver_)) {}
void SetUp() override {
- message_loop_ = base::MessageLoopProxy::current();
+ task_runner_ = base::ThreadTaskRunnerHandle::Get();
request_context_ = new TestContextURLRequestContextGetter();
}
void RunFailureTest(const GoogleServiceAuthError& error) {
EXPECT_CALL(resolver_, Resolve()).Times(1).RetiresOnSaturation();
- message_loop_->PostTask(FROM_HERE,
- base::Bind(&OnlineAttempt::OnClientLoginFailure,
- attempt_->weak_factory_.GetWeakPtr(),
- error));
+ task_runner_->PostTask(
+ 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) {
- message_loop_->PostTask(FROM_HERE,
- base::Bind(&OnlineAttempt::CancelClientLogin,
- auth->weak_factory_.GetWeakPtr()));
+ task_runner_->PostTask(FROM_HERE,
+ base::Bind(&OnlineAttempt::CancelClientLogin,
+ auth->weak_factory_.GetWeakPtr()));
}
content::TestBrowserThreadBundle thread_bundle_;
- scoped_refptr<base::MessageLoopProxy> message_loop_;
+ scoped_refptr<base::SingleThreadTaskRunner> task_runner_;
scoped_refptr<net::URLRequestContextGetter> request_context_;
TestAttemptState state_;
MockAuthAttemptStateResolver resolver_;
@@ -96,10 +97,10 @@ class OnlineAttemptTest : public testing::Test {
TEST_F(OnlineAttemptTest, LoginSuccess) {
EXPECT_CALL(resolver_, Resolve()).Times(1).RetiresOnSaturation();
- message_loop_->PostTask(FROM_HERE,
- base::Bind(&OnlineAttempt::OnClientLoginSuccess,
- attempt_->weak_factory_.GetWeakPtr(),
- GaiaAuthConsumer::ClientLoginResult()));
+ task_runner_->PostTask(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();
}
@@ -231,10 +232,9 @@ TEST_F(OnlineAttemptTest, CaptchaErrorOutputted) {
TEST_F(OnlineAttemptTest, TwoFactorSuccess) {
EXPECT_CALL(resolver_, Resolve()).Times(1).RetiresOnSaturation();
GoogleServiceAuthError error(GoogleServiceAuthError::TWO_FACTOR);
- message_loop_->PostTask(FROM_HERE,
- base::Bind(&OnlineAttempt::OnClientLoginFailure,
- attempt_->weak_factory_.GetWeakPtr(),
- error));
+ task_runner_->PostTask(
+ 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();
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/screens/user_image_screen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698