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

Unified Diff: chrome/browser/chromeos/login/parallel_authenticator_unittest.cc

Issue 17127002: Correctly integrate StoragePartition into TestingProfile. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: cleanup TODOs. merge code. kill more threads. i never get tired of thread carnage. Created 7 years, 5 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/parallel_authenticator_unittest.cc
diff --git a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
index d57c0f18eef9f75f577729471eb306eb031f127e..5eb479fa4e14dbe00668f72660794570491f12a4 100644
--- a/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
+++ b/chrome/browser/chromeos/login/parallel_authenticator_unittest.cc
@@ -27,7 +27,7 @@
#include "chromeos/cryptohome/mock_cryptohome_library.h"
#include "chromeos/dbus/fake_cryptohome_client.h"
#include "chromeos/dbus/mock_dbus_thread_manager_without_gmock.h"
-#include "content/public/test/test_browser_thread.h"
+#include "content/public/test/test_browser_thread_bundle.h"
#include "google_apis/gaia/mock_url_fetcher_factory.h"
#include "net/base/net_errors.h"
#include "net/url_request/url_request_status.h"
@@ -36,13 +36,9 @@
#include "third_party/cros_system_api/dbus/service_constants.h"
#include "url/gurl.h"
-using ::testing::AnyNumber;
-using ::testing::DoAll;
using ::testing::Invoke;
using ::testing::Return;
-using ::testing::SetArgPointee;
using ::testing::_;
-using content::BrowserThread;
namespace chromeos {
@@ -57,15 +53,10 @@ class TestOnlineAttempt : public OnlineAttempt {
class ParallelAuthenticatorTest : public testing::Test {
public:
ParallelAuthenticatorTest()
- : message_loop_(base::MessageLoop::TYPE_UI),
- ui_thread_(BrowserThread::UI, &message_loop_),
- file_thread_(BrowserThread::FILE, &message_loop_),
- io_thread_(BrowserThread::IO),
- username_("me@nowhere.org"),
+ : username_("me@nowhere.org"),
password_("fakepass"),
+ hash_ascii_("0a010000000000a0" + std::string(16, '0')),
user_manager_enabler_(new MockUserManager) {
- hash_ascii_.assign("0a010000000000a0");
- hash_ascii_.append(std::string(16, '0'));
}
virtual ~ParallelAuthenticatorTest() {
@@ -79,8 +70,6 @@ class ParallelAuthenticatorTest : public testing::Test {
mock_cryptohome_library_ .reset(new MockCryptohomeLibrary());
CryptohomeLibrary::SetForTest(mock_cryptohome_library_.get());
- io_thread_.Start();
-
auth_ = new ParallelAuthenticator(&consumer_);
auth_->set_using_oauth(false);
state_.reset(new TestAttemptState(UserContext(username_,
@@ -178,7 +167,7 @@ class ParallelAuthenticatorTest : public testing::Test {
void RunResolve(ParallelAuthenticator* auth) {
auth->Resolve();
- message_loop_.RunUntilIdle();
+ base::MessageLoop::current()->RunUntilIdle();
}
void SetAttemptState(ParallelAuthenticator* auth, TestAttemptState* state) {
@@ -199,10 +188,7 @@ class ParallelAuthenticatorTest : public testing::Test {
auth_->set_online_attempt(new TestOnlineAttempt(state_.get(), auth_.get()));
}
- base::MessageLoop message_loop_;
- content::TestBrowserThread ui_thread_;
- content::TestBrowserThread file_thread_;
- content::TestBrowserThread io_thread_;
+ content::TestBrowserThreadBundle thread_bundle_;
std::string username_;
std::string password_;
@@ -392,7 +378,7 @@ TEST_F(ParallelAuthenticatorTest, DriveGuestLogin) {
.RetiresOnSaturation();
auth_->LoginOffTheRecord();
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
TEST_F(ParallelAuthenticatorTest, DriveGuestLoginButFail) {
@@ -407,7 +393,7 @@ TEST_F(ParallelAuthenticatorTest, DriveGuestLoginButFail) {
.RetiresOnSaturation();
auth_->LoginOffTheRecord();
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
TEST_F(ParallelAuthenticatorTest, DriveRetailModeUserLogin) {
@@ -422,7 +408,7 @@ TEST_F(ParallelAuthenticatorTest, DriveRetailModeUserLogin) {
.RetiresOnSaturation();
auth_->LoginRetailMode();
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
TEST_F(ParallelAuthenticatorTest, DriveRetailModeLoginButFail) {
@@ -437,7 +423,7 @@ TEST_F(ParallelAuthenticatorTest, DriveRetailModeLoginButFail) {
.RetiresOnSaturation();
auth_->LoginRetailMode();
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
TEST_F(ParallelAuthenticatorTest, DriveDataResync) {
@@ -466,7 +452,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataResync) {
SetAttemptState(auth_.get(), state_.release());
auth_->ResyncEncryptedData();
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
TEST_F(ParallelAuthenticatorTest, DriveResyncFail) {
@@ -482,7 +468,7 @@ TEST_F(ParallelAuthenticatorTest, DriveResyncFail) {
SetAttemptState(auth_.get(), state_.release());
auth_->ResyncEncryptedData();
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
TEST_F(ParallelAuthenticatorTest, DriveRequestOldPassword) {
@@ -523,7 +509,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecover) {
SetAttemptState(auth_.get(), state_.release());
auth_->RecoverEncryptedData(std::string());
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) {
@@ -543,7 +529,7 @@ TEST_F(ParallelAuthenticatorTest, DriveDataRecoverButFail) {
SetAttemptState(auth_.get(), state_.release());
auth_->RecoverEncryptedData(std::string());
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
TEST_F(ParallelAuthenticatorTest, ResolveNoMount) {
@@ -692,8 +678,8 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetNewPassword) {
std::string()),
std::string(),
std::string());
- message_loop_.Run();
- message_loop_.RunUntilIdle();
+ base::MessageLoop::current()->Run();
+ base::MessageLoop::current()->RunUntilIdle();
}
TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetCaptchad) {
@@ -736,8 +722,8 @@ TEST_F(ParallelAuthenticatorTest, DriveOfflineLoginGetCaptchad) {
std::string()),
std::string(),
std::string());
- message_loop_.Run();
- message_loop_.RunUntilIdle();
+ base::MessageLoop::current()->Run();
+ base::MessageLoop::current()->RunUntilIdle();
}
TEST_F(ParallelAuthenticatorTest, DriveOnlineLogin) {
@@ -789,7 +775,7 @@ TEST_F(ParallelAuthenticatorTest, DriveUnlock) {
auth_->AuthenticateToUnlock(UserContext(username_,
std::string(),
std::string()));
- message_loop_.Run();
+ base::MessageLoop::current()->Run();
}
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698